For every MCP tool call, log who the call was for, which agent made it, which server and tool, the arguments, the outcome and the time, in a store that cannot be edited and that you can search. Keep the logs as long as your records policy requires, protect them because arguments can hold sensitive data, and rehearse an audit question before an auditor asks one.
The MCP specification does not define an audit log, so what follows is general practice built on its security guidance. Retention periods depend on your regulator and your records policy.
What to log
| Field | Example | Why |
|---|---|---|
| Timestamp | UTC, with source clock | Order of events |
| Request or trace ID | Same ID across gateway, server and model call | Follow one action |
| End user | Directory ID of the person | Accountability |
| Agent identity | Agent name and version | Revocation and review |
| MCP server | Registry name | Which system |
| Tool name | The tool called | What was attempted |
| Arguments | The values sent, with sensitive values masked | What it was asked to do |
| Result status | Allowed, denied, error, and result size | Outcome |
| Policy decision | Which rule allowed or denied | Why |
| Approval | Human approver, if any | Evidence of control |
| Downstream credential | Which service account was used, not the secret | Chain of identity |
Also log administrative events: registry changes, policy changes, new servers and permission changes.
Decide the sensitive-data rule up front. Arguments and results may carry personal or regulated data. Options are to mask known fields, store hashes plus a pointer, or store full text in a restricted store. Whatever you choose, document it.
Retention
- Start from your records policy and regulator rules for the type of activity involved.
- Keep security events longer than debug detail.
- Separate hot storage for recent searches from cheaper storage for older logs.
- Set deletion dates, and apply legal holds when needed.
- Keep logs of log access too.
If personal data is in the logs, retention also falls under your privacy obligations. Ask legal before you pick a number.
Search
A log you cannot search is not evidence.
- Index by user, agent, server, tool and request ID.
- Save the common searches: all calls by one user, all uses of one tool, all denials this week, all calls to a new server.
- Time-sync every component, or event order will be wrong.
- Test with a real question, such as "which customer records did this agent read for this user on this date".
- Send alerts for repeated denials, a tool never used before, and a spike in calls.
Evidence
Auditors and incident responders ask for the same things. Prepare them in advance.
| Question | Where the answer comes from |
|---|---|
| Who approved this server? | Registry and approval record, see governance model |
| What can this agent call? | Gateway policy and registry |
| What did it call for this user? | Call log by user and agent |
| Was anything blocked? | Denied calls and policy decisions |
| Did a human approve the risky step? | Approval field |
| Can logs have been altered? | Write-once storage and access logs |
| How do you know the logs are complete? | Compare gateway counts with server counts regularly |
Runbook
- Daily: check that logs are arriving from every gateway instance.
- Weekly: review denials and new servers or tools.
- Monthly: run a sample trace from a user request to a log entry.
- After an incident: preserve logs first, then search.
- Yearly: review retention, masking and access against policy.
For the controls the log supports, read the MCP server security checklist. For injection risks that logs help to find, see prompt injection controls. For the service, see MCP gateway.
Pitfalls
- Logging at the server only. If the gateway is bypassed, the log has gaps you cannot see.
- Logging results in full. A result can contain a customer's record, so the log becomes a second copy of sensitive data.
- No shared request ID, so the gateway log and the server log cannot be joined.
- Logs held by the team being audited, with no independent copy.
- Never testing. Run the Tuesday question once a quarter and fix what the answer is missing.
Who reads the logs
Decide this before launch. Security operations reads denials and anomalies, the platform team reads errors, and compliance reads samples against policy. Give each group a saved view and a named person. A log nobody is assigned to read becomes evidence only after something goes wrong, which is the most expensive time to find out it is incomplete. Agree who may export logs for a regulator, and keep a record of every export.
Questions we hear
Should we log full tool arguments? Log enough to reconstruct what was asked, and mask sensitive values or store them in a restricted store. Decide and document the rule.
How long should we keep MCP logs? As long as your records policy and regulators require for that type of activity. Ask legal and compliance.
Does the MCP specification define audit logs? No. It defines the protocol and authorization, so the audit design is yours.
Sources checked November 27, 2026:




