@sedata-ai/mcp runs an OpenTelemetry NodeSDK inside your process and exports
data over OTLP. This page covers the moving parts.
Exporters
The exporter type is controlled byconfig.exporterType:
Endpoint composition:
https://host/v1 and https://host/v1/
work.
Authentication headers
exporterAuth is converted to HTTP headers and applied to both the trace
and metric exporters:
basic auth is permitted by ConfigValidator but the actual header is
commented out in the OTLP setup. Use bearer or apiKey until that ships.Sampling
TraceIdRatioBasedSampler — deterministic by trace id, head-based.
Out-of-range values throw on validation.
Metrics are not sampled —
enableMetrics is the only switch for metrics.
Batching
Trace exporter batching is delegated to OTel’s standardBatchSpanProcessor
defaults.
The metric reader is a PeriodicExportingMetricReader with two knobs:
Resource detection
The SDK runs these resource detectors at startup:envDetector— picks upOTEL_RESOURCE_ATTRIBUTES.hostDetector— host name + arch.osDetector— OS name + version.serviceInstanceIdDetectorSync— generates a stableservice.instance.id.
service.namefromconfig.serverNameservice.versionfromconfig.serverVersionmcp.session.id(per-process UUID)
Toggles
Every part of the pipeline is opt-out:Custom data processors
You can mutate every attribute set right before export:mcp.session.id). See Data processors.
Shutdown
Always callshutdown on graceful exit so in-flight metrics flush:
shutdown() records mcp.server.session.duration and then calls
NodeSDK.shutdown(), which flushes both the trace exporter and metric reader.
Next
Authentication
All three auth shapes with examples.
Sampling
Choosing a rate that survives production.