Package org.gridgain.internal.mcp.audit
Class AuditInterceptor
java.lang.Object
org.gridgain.internal.mcp.audit.AuditInterceptor
Interceptor that wraps MCP tool execution handlers to capture audit events.
For each tool invocation, this interceptor:
- Records start time
- Extracts user identity and request context
- Executes the wrapped tool handler
- Extracts result metadata (row count, query)
- Logs audit event with timing information
Thread-safe and non-blocking - uses Reactor operators for async composition.
-
Constructor Summary
ConstructorsConstructorDescriptionAuditInterceptor(AuditLogger auditLogger) Constructs a new audit interceptor. -
Method Summary
Modifier and TypeMethodDescriptionBiFunction<io.modelcontextprotocol.server.McpAsyncServerExchange,Map<String, Object>, reactor.core.publisher.Mono<io.modelcontextprotocol.spec.McpSchema.CallToolResult>> wrap(String toolName, BiFunction<io.modelcontextprotocol.server.McpAsyncServerExchange, Map<String, Object>, reactor.core.publisher.Mono<io.modelcontextprotocol.spec.McpSchema.CallToolResult>> handler) Wraps a tool handler with audit logging.
-
Constructor Details
-
AuditInterceptor
Constructs a new audit interceptor.- Parameters:
auditLogger- the audit logger to use
-
-
Method Details
-
wrap
public BiFunction<io.modelcontextprotocol.server.McpAsyncServerExchange,Map<String, wrapObject>, reactor.core.publisher.Mono<io.modelcontextprotocol.spec.McpSchema.CallToolResult>> (String toolName, BiFunction<io.modelcontextprotocol.server.McpAsyncServerExchange, Map<String, Object>, reactor.core.publisher.Mono<io.modelcontextprotocol.spec.McpSchema.CallToolResult>> handler) Wraps a tool handler with audit logging.- Parameters:
toolName- the name of the toolhandler- the original tool handler- Returns:
- wrapped handler that logs audit events
-