Protocol handler configuration.
Allows customizing behavior when MCP protocol events occur. All handlers are optional - the framework provides default behavior.
Note: Cancellation is handled automatically by the framework. There is no hook for cancellation as it must always abort requests.
const handlers: HandlersConfig = { onPing: () => metrics.increment('mcp.ping'),}; Copy
const handlers: HandlersConfig = { onPing: () => metrics.increment('mcp.ping'),};
Optional
Called when a ping request is received.
Use for health checks, metrics, or heartbeat tracking. Return value is ignored (ping always returns empty object).
Protocol handler configuration.
Allows customizing behavior when MCP protocol events occur. All handlers are optional - the framework provides default behavior.
Note: Cancellation is handled automatically by the framework. There is no hook for cancellation as it must always abort requests.
Example