Safeguard
AI Security•

What does MCP say about audit logging, and what is left to you?

The MCP spec says clients should log tool usage and servers should log scope elevations. The rest of audit logging is your job. Here is the gap and a fix.

Safeguard Security Team
4 min read

The MCP spec says clients should log tool usage for audit purposes and that servers should log scope elevation events with correlation IDs. It says nothing about log format, retention, tamper protection or who reviews them. Those decisions are left to you, so write them down before the first incident.

What the spec actually says

Two places mention logging. The tools page lists, among client recommendations, that clients should log tool usage for audit purposes. The scope minimization guidance says servers should log elevation events, recording the scope requested and the subset granted, with correlation IDs. The stdio proxy guidance adds that proxy services should log all stdio transport usage.

All of these are shoulds. A client can be fully compliant and keep no audit trail.

What the spec leaves open

QuestionSpecYou decide
Which fields to recordNot definedIdentity, tool, arguments, result, time
Where logs liveNot definedCentral store the agent cannot edit
How long to keep themNot definedPer your retention rules
Tamper protectionNot definedAppend only or signed storage
Who reviewsNot definedA named owner and a schedule
How to link stepsCorrelation IDs for elevationsOne ID per task across tools

A minimum useful record

For each tool call, aim to capture the agent identity, the human it acted for, the server and tool name, the arguments in redacted form, the outcome, the time and a correlation ID that ties it to the wider task. A separate post on this site covers the fields in more detail.

Redact secrets and personal data before storage. A log that contains tokens becomes a target of its own.

Where logs should be written

If the only log is the one the agent's own process writes, a compromised agent can alter it. Write logs from the client, proxy or server side, ship them off the host, and restrict who can change them. The spec's token passthrough guidance makes a related point: when tokens pass through unchecked, downstream logs show a different identity from the one acting, which makes investigation harder.

Make the logs useful

  1. Test one scenario: pick an agent action and trace it from prompt to downstream effect.
  2. Alert on elevation events and on tools called for the first time.
  3. Review a sample every week, not only after an incident.
  4. Check that stdio servers write logs to stderr or files, not to the protocol stream.

Safeguard includes policies, gates and guardrails and agent identity so that actions can be tied to a named agent. A free scan is at https://gold.safeguard.sh/scan.

Try it yourself

Watch how a monitoring view records changes over time, and think about what the same view would need to show for agent tool calls.

Click through it at your own pace, or open it full screen.

Quick check

Is client side logging enough?

It is a start, but a client under attack may not be trustworthy. Add logs from a proxy or the downstream system when you can.

Should I log full tool arguments?

Log enough to reconstruct what happened, with secrets and personal data redacted. Keep the raw form only where policy and law allow.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.