Skip to main content
Glama
manufacts

mcp-use-sentry-example

by manufacts

Sentry tool monitoring

Trace mcp-use tool callbacks and report both returned tool errors and exceptions using existing MCP middleware. No SDK changes or additional application services are required.

Run

Requires Node.js 22.22.2 or newer. Clone this repository, then:

npm install
cp .env.example .env
# Set MCP_USE_SENTRY_DSN to your Sentry project DSN.
npm run dev

In Inspector, call monitored_report with outcome set to success, tool_error, or exception. Look for tools/call monitored_report in Sentry Traces and the failures in Issues. Without a DSN, tools still work but no telemetry is sent.

The example initializes Sentry once with automatic integrations disabled and every trace sampled. Arguments and returned content are not recorded. Exception messages and stacks are captured. Reuse an existing Sentry initialization when adapting this middleware, and check for duplicate capture from other instrumentation.

This monitors registered tool callbacks, not transport failures or validation rejected before callback dispatch. It targets a long-running Node process; serverless runtimes need lifecycle-aware flushing.

Related MCP server: mcp-tool-observability

Verify

npm run typecheck
npm run test
npm run build

Tests invoke the server over MCP and use real Sentry spans and error processing with a local transport. No Sentry account or network access is needed for the tests.

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    C
    maintenance
    Enables live tracing and observability of MCP tool calls, persisting execution traces to MongoDB and streaming them in real time to a dashboard.
    -
  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables AI agents to trace Python code execution in real time via PEP 669, exposing call trees, variable deltas, and async context through MCP tools.
    1
    MIT
  • A
    license
    Not graded
    quality
    F
    maintenance
    Enables transparent security for any MCP server by intercepting tool calls, blocking prompt injection attempts, masking PII in responses, and writing immutable audit logs.
    302 npm
    MIT