part…
Building governance for MCP?
The gateway applies what the guide teaches: policies on discovery, invocation and authorisation.
The gateway applies what the guide teaches: policies on discovery, invocation and authorisation.
The spec does not define an audit format, but it scatters across its pages what should be logged and what must never be logged. This lesson consolidates it into an event schema for the gateway.
| Source | Event |
|---|---|
| Tools | Tool usage "for audit purposes" (client SHOULD); rejection of tools for an invalid x-mcp-header, with name and reason (SHOULD). |
| Cancellation | Reason for the cancellation (both parties SHOULD). |
| Scopes | Elevations: scope requested, subset granted, correlation ids. |
| Tasks | Creation, completion and retrieval, with authorisation context; suspicious patterns (many failed lookups, excessive polling). |
| URLs | Suspicious authorisation URLs (clients SHOULD log). |
$ref |
Dereferenced URIs if the opt-in mode is active. |
| Local servers | Commands executed, consents, MCP activity on managed machines. |
| OAuth proxies | Consent decisions per client. |
jti).notifications/message logs MUST NOT contain PII or secrets.requestState (opaque; log only a hash).| Identifier | Scope |
|---|---|
JSON-RPC id |
One request and its response (per side; the gateway translates). |
progressToken |
Progress of one request. |
io.modelcontextprotocol/subscriptionId |
Notifications of one subscription. |
taskId |
Lifetime of one task. |
traceparent |
End to end across systems. |
Mcp-Session-Id (legacy) |
Session; log hashed. |
Own _meta keys |
Policy applied, decision, policy version. |
{ "ts": "2026-10-25T10:00:00Z", "trace_id": "0af7…", "actor": { "sub": "u-123", "client": "host-x" },
"server": "srv-weather", "era": "modern", "method": "tools/call", "target": "get_weather",
"decision": "allow", "policy_id": "pol-07", "mrtr_round": 0, "result_type": "complete", "is_error": false,
"error_code": null, "latency_ms": 212, "redactions": 0, "request_hash": "sha256:…" }
list_changed followed by a change in the tools hash, repeated -32021/-32022, URL elicitations to new domains, cacheScope: public on authenticated servers, header validation errors.1. How must requestState be recorded in the audit log?
It is opaque and potentially sensitive; the gateway must not inspect it.
2. What does the spec recommend logging when rejecting a tool for an invalid x-mcp-header?
It SHOULD log a warning with the name and the reason.