Observability

Integrating MCPTrust with monitoring and logging systems.


OpenTelemetry Tracing

Enable:

mcptrust lock --otel -- "..."

Flags:

FlagDefaultDescription
--otelfalseEnable tracing
--otel-endpointlocalhost:4318OTLP endpoint
--otel-protocolotlphttpotlphttp or otlpgrpc
--otel-service-namemcptrustService name
--otel-sample-ratio1.0Sampling ratio
--otel-insecurefalseAllow non-TLS connections (e.g. to localhost)

Environment Variables:

  • OTEL_EXPORTER_OTLP_ENDPOINT: Overrides --otel-endpoint if set.

Span Attributes

  • mcptrust.command: Command name (lock, scan, etc.)
  • mcptrust.op_id: Unique operation ID for correlation
  • Context-specific: lockfile path, preset, server command

JSONL Logging

Enable:

mcptrust lock --log-format jsonl -- "..."

Output: NDJSON lines to stderr or file. Fields: timestamp, level, message, op_id, etc.

Use Case: SIEM integration (Splunk, Datadog, Elastic).

Graceful Degradation

If OTel collector is down, mcptrust still runs (spans dropped silently). No enforcement changes based on observability state.