import type * as ClientSSEModule from "@modelcontextprotocol/sdk/client/sse"; import type * as ClientStdioModule from "@modelcontextprotocol/sdk/client/stdio"; import type * as ClientStreamableHTTPModule from "@modelcontextprotocol/sdk/client/streamableHttp"; import type * as ServerSSEModule from "@modelcontextprotocol/sdk/server/sse"; import type * as ServerStdioModule from "@modelcontextprotocol/sdk/server/stdio"; import type * as ServerStreamableHTTPModule from "@modelcontextprotocol/sdk/server/streamableHttp"; import type { InstrumentationConfig } from "@opentelemetry/instrumentation"; import { InstrumentationBase, InstrumentationNodeModuleDefinition } from "@opentelemetry/instrumentation"; /** * Flags to check if a module has already been patched. * Note: This is a fallback in case the module is made immutable (e.x. Deno, webpack, etc.) */ declare const patchedModules: { "@modelcontextprotocol/sdk/client/sse": boolean; "@modelcontextprotocol/sdk/server/sse": boolean; "@modelcontextprotocol/sdk/client/stdio": boolean; "@modelcontextprotocol/sdk/server/stdio": boolean; "@modelcontextprotocol/sdk/client/streamableHttp": boolean; "@modelcontextprotocol/sdk/server/streamableHttp": boolean; }; /** * function to check if instrumentation is enabled / disabled for the module */ export declare function isPatched(moduleName: keyof typeof patchedModules): boolean; /** * Instrumentation for the MCP SDK which propagates context between client and server to allow * traces to be connected across tool calls. * @param instrumentationConfig The config for the instrumentation @see {@link InstrumentationConfig} */ export declare class MCPInstrumentation extends InstrumentationBase { constructor({ instrumentationConfig, }?: { /** * The config for the instrumentation * @see {@link InstrumentationConfig} */ instrumentationConfig?: InstrumentationConfig; }); /** * Manually instruments the MCP client and/or server modules. Currently, auto-instrumentation does not work * with the MCP SDK and this method must be used to enable instrumentation. * @param {Object} modules - The modules to manually instrument. * @param {typeof ClientSSEModule} modules.clientSSEModule - The MCP client SSE module, e.g. require('@modelcontextprotocol/sdk/client/sse.js') * @param {typeof ServerSSEModule} modules.serverSSEModule - The MCP server SSE module, e.g. require('@modelcontextprotocol/sdk/server/sse.js') * @param {typeof ClientStdioModule} modules.clientStdioModule - The MCP client stdio module, e.g. require('@modelcontextprotocol/sdk/server/stdio.js') * @param {typeof ServerStdioModule} modules.serverStdioModule - The MCP server stdio module, e.g. require('@modelcontextprotocol/sdk/client/stdio.js') * @param {typeof ClientStreamableHTTPModule} modules.clientStreamableHTTPModule - The MCP client streamable HTTP module, e.g. require('@modelcontextprotocol/sdk/client/streamableHttp.js') * @param {typeof ServerStreamableHTTPModule} modules.serverStreamableHTTPModule - The MCP server streamable HTTP module, e.g. require('@modelcontextprotocol/sdk/server/streamableHttp.js') */ manuallyInstrument({ clientSSEModule, serverSSEModule, clientStdioModule, serverStdioModule, clientStreamableHTTPModule, serverStreamableHTTPModule, }: { clientSSEModule?: typeof ClientSSEModule; serverSSEModule?: typeof ServerSSEModule; clientStdioModule?: typeof ClientStdioModule; serverStdioModule?: typeof ServerStdioModule; clientStreamableHTTPModule?: typeof ClientStreamableHTTPModule; serverStreamableHTTPModule?: typeof ServerStreamableHTTPModule; }): void; protected init(): (InstrumentationNodeModuleDefinition | InstrumentationNodeModuleDefinition | InstrumentationNodeModuleDefinition | InstrumentationNodeModuleDefinition | InstrumentationNodeModuleDefinition | InstrumentationNodeModuleDefinition)[]; private _patchClientSSEModule; private _unpatchClientSSEModule; private _patchServerSSEModule; private _unpatchServerSSEModule; private _patchClientStdioModule; private _unpatchClientStdioModule; private _patchServerStdioModule; private _unpatchServerStdioModule; private _patchClientStreamableHTTPModule; private _unpatchClientStreamableHTTPModule; private _patchServerStreamableHTTPModule; private _unpatchServerStreamableHTTPModule; private _patchTransport; private _unpatchTransport; private _getTransportSendPatch; private _getTransportStartPatch; private static _isJSONRPCRequest; } export {}; //# sourceMappingURL=mcp.d.ts.map