Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.sedata-ai.tech/llms.txt

Use this file to discover all available pages before exploring further.

The package is a thin wrapper around the OpenTelemetry Node SDK plus a small HTTP client for safety checks. Everything runs in your process — no sidecar, no agent.

Components

TelemetryManager

Owns the OpenTelemetry NodeSDK, the trace exporter, the metric reader, and the session id. Validates config on construction.

McpServerInstrumentation

Patches server.registerTool so every registered handler becomes instrumented. Records spans, durations, counters, and safety attributes.

safetyCheck wrapper

Decorates a tool handler. Calls https://api.sedata-ai.tech/security/safety-check with the chosen parameter, blocks if flagged, otherwise lets the handler run.

ConfigValidator

Pure validation. Throws on missing exporterEndpoint, out-of-range samplingRate, malformed auth blocks, etc.

Data flow

  1. The MCP client (Claude, an agent, an editor) issues tools/call.
  2. The MCP SDK invokes the registered handler — but the handler was replaced at registerTool time with an instrumented version.
  3. The instrumented handler opens an active span, increments a counter, and runs your original handler inside it.
  4. If the handler is wrapped by safetyCheck, a network call to api.sedata-ai.tech happens first. A flagged result short-circuits the handler with a safe blocked response.
  5. The span ends with status + duration. The OTLP exporter batches spans and metrics out to your exporterEndpoint.

Where the SDK runs

Everything is in-process:
  • The NodeSDK starts on instrumentServer(...) and stops when you call telemetry.shutdown().
  • Trace export uses OTLP/HTTP by default. Switch to console for local dev. See Console debugging.
  • Metric export uses a PeriodicExportingMetricReader that pushes every metricExportIntervalMs (default 5000 ms).
The package never opens an inbound socket and never holds your tool calls open waiting for telemetry to flush — exports are batched in the background.

What is instrumented today

SurfaceStatus
tools/call (every registerTool)✅ Auto-instrumented
Completions🚧 Planned
Logs🚧 Planned
Notifications🚧 Planned
Pings🚧 Planned
Prompts🚧 Planned
Resources🚧 Planned
Roots🚧 Planned
Sampling🚧 Planned
You can always record any of these yourself today using the custom instrumentation API.

Next

Tracing

What gets recorded on each span.

Telemetry pipeline

Exporters, samplers, and batching.