Skip to content

Auditability & Observability

An auditable MCP deployment records:

  • Tool invocations — which tool, which server, arguments (redacted where sensitive), result status, timestamp, initiating user/request
  • Consent decisions — what was approved or denied, by whom, when, and under what policy
  • Connection and request lifecycle — server launches/connections, protocol versions, capability sets negotiated or discovered
  • Errors — protocol errors, tool execution errors, timeouts, cancellations
  • Authorization events — token issuance, scope grants, rejections
  • Definition changes — tool/resource/prompt list_changed events (rug-pull detection)
  • MCP includes a logging utility: a server that declares the logging capability can emit notifications/message log entries with an optional logger name and arbitrary JSON data
  • Log severity levels follow RFC 5424 (syslog): debug, info, notice, warning, error, critical, alert, emergency — 8 levels
  • How the client sets verbosity depends on the spec revision: through 2025-11-25 the client sent a logging/setLevel request; in 2026-07-28 that method was removed and the level travels per-request in _meta (io.modelcontextprotocol/logLevel)
  • Progress notifications (notifications/progress) give visibility into long-running operations
  • ping supported liveness monitoring in revisions through 2025-11-25; it was removed in 2026-07-28
  • The 2026-07-28 revision deprecates the logging feature itself — migration guidance is to log to stderr (stdio) or use OpenTelemetry
  • stdio servers must never write logs to stdout (only valid MCP messages are allowed there — anything else corrupts the protocol stream); the server MAY write UTF-8 logs to stderr, which the client may capture, forward, or ignore
flowchart LR
C[Client / Host] -- "stdin: JSON-RPC only" --> S[stdio Server]
S -- "stdout: JSON-RPC only" --> C
S -. "stderr: logs (capture, forward, or ignore)" .-> C
stdio streams: protocol vs. logs
  • Centralize logs from hosts and servers; correlate by request IDs
  • Monitor for anomalies: unusual tool-call frequency, unexpected argument patterns, spikes in errors, calls outside business hours
  • Alert on high-risk events: destructive tool use, consent bypass attempts, token validation failures
  • Retain audit logs per compliance requirements (e.g. SOC 2, GDPR data-access records)

Server inventory

Maintain an inventory of approved servers: versions, publishers, scopes.

Onboarding policy

Define policies for adding new servers: review, sandbox testing, approval.

Permission reviews

Periodically review granted permissions against actual usage.

  • stdio servers log to stderr, never stdout
  • MCP’s logging levels follow RFC 5424 (syslog severities), 8 levels from debug to emergency
  • Server log entries are sent as notifications/message; verbosity was controlled via logging/setLevel before the stateless 2026-07-28 revision moved it into per-request _meta
  • Log content must exclude secrets and personal information
  • Auditability requires logging both actions (tool calls) and decisions (consent)

📝 Check your knowledge

1. Why must a stdio-based server avoid writing logs to stdout?
2. Which standard defines the severity levels used by MCP's logging utility?
3. Which notification carries a server's log entries to the client?
4. What does the MCP spec say about log message content?
5. Why does token passthrough undermine auditability?
6. Why is monitoring list_changed events an audit practice?