MCP Instrumentation
The MCP Server module instruments Anthropic's Model Context Protocol (MCP) SDKs. At the moment it only supports the MCP Typescript SDK.
Currently, it doesn't support automatic instrumentation due to this issue related to import-in-the-middle
.
Instrumentation must be done by wrapping the MCP server instance. This is done by the wrapMcpServerWithSentry
function. For example:
Copied
import * as Sentry from "@sentry/core";
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
const mcpServer = new McpServer({
name: 'My MCP Server',
});
const server = Sentry.wrapMcpServerWithSentry(mcpServer);
Was this helpful?
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").