MCP Observability
Logging, tracing, and metrics for the DMTR MCP server.
Overview
Observability for the DMTR MCP server includes logging, tracing, and metrics. Use these to debug issues, monitor performance, and meet compliance requirements. The server emits structured logs and can integrate with OpenTelemetry or similar frameworks.
Logging
Logs go to stderr by default. Set LOG_LEVEL to debug, info, warn, or error. Structured JSON logging is available with LOG_FORMAT=json. Logs include: request ID, tool/resource name, DMTR API status, duration. Never log API keys or PII. Rotate logs in production.
Tracing
Distributed tracing is supported via OpenTelemetry. Set OTEL_EXPORTER_OTLP_ENDPOINT to export traces to Jaeger, Zipkin, or a vendor. Spans cover: MCP request, DMTR API call, tool execution. Use trace IDs to correlate requests across services.
Metrics
Metrics (if enabled) include: request count by tool/resource, latency histograms, error rate. Export to Prometheus or StatsD. Key metrics: mcp_requests_total, mcp_request_duration_seconds, dmtr_api_calls_total. Use for SLOs and alerting.
Debugging
For local debugging: set DEBUG=dmtr-mcp or LOG_LEVEL=debug. Inspect stderr for request/response details. Use MCP inspector to replay requests. For production: enable tracing, correlate logs with trace IDs, and check DMTR API audit logs for downstream issues.