Skip to main content
This guide walks you through installing @sedata-ai/mcp, wrapping a basic MCP server, and verifying that traces are flowing.
You need Node.js ≥ 22.16 and @modelcontextprotocol/sdk ≥ 1.21.1. See Installation for compatibility details.

1. Install the package

2. Get an API key

Sign in to the Sedata dashboard, open Settings → API keys, and create a new key scoped to your project. Set it as an environment variable:

3. Wire up instrumentServer

Create a file server.ts:
server.ts
instrumentServer returns an ObservabilityInstance you can use later to record custom spans, histograms, and counters.

4. Register a tool — with optional safety check

server.ts (continued)

5. Run it

Within a few seconds you should see traces in your Sedata dashboard:
Trace appears in Sedata dashboard

What’s instrumented automatically

Every call to a tool registered via server.registerTool is wrapped in a span named tools/call <toolName> with attributes for tool metadata, request id, session id, and client address.
mcp.server.operation.duration records milliseconds per call, tagged by method, tool name, and success.
mcp.server.operation.count increments once per invocation.
mcp.server.session.duration is recorded when you call telemetry.shutdown() — capturing how long the process ran.

Next steps

Add custom spans

Record domain-specific operations alongside the auto-spans.

Tune sampling

Reduce volume in production while keeping signal in dev.

Configure auth

Bearer, API key, or basic auth against your own collector.

Production checklist

What to verify before shipping.