All posts
AI

What an MCP Audit Trail Needs

What an MCP Audit Trail Needs

Sooner or later, someone will ask what an AI agent did and who it did it for. It might be an auditor, a regulator, a customer, or your own incident response team. If the answer depends on stitching together model logs, server logs, and application logs by hand, it will take days and still leave gaps.

An MCP audit trail fixes that. Because agents act through MCP tools, the MCP layer is where every action can be recorded in one consistent format and traced back to the person behind it. This guide covers what auditors will ask for, what each record needs to contain, and how to keep the chain from a tool call back to a person intact.

What is an MCP audit trail?

An MCP audit trail is a complete, tamper-resistant record of every tool call AI agents make through the Model Context Protocol: who asked for it, which agent made it, which tool and arguments it used, what policy decided, and what happened. It lets an organization trace any action an agent took back to the person and request that started it.

A good MCP audit trail records denied and failed calls as well as successful ones. A trail that only shows what worked can’t show that your controls were working too.

What auditors will ask for

Whether the review is driven by SOC 2, ISO/IEC 42001, internal audit, or AI regulation, the questions about agents tend to be the same:

  1. What AI agents do you run, and who owns each one?
  2. What can each agent access, and who approved that access?
  3. Show me everything this agent did during this period.
  4. Who was this action taken for?
  5. What controls checked it, and what did they decide?
  6. Show me an action that was blocked, and why.
  7. Can these records be changed after the fact?
  8. How long do you keep them, and who can see them?

Regulation is adding weight to these questions. Under the EU AI Act, high-risk AI systems must support automatic logging of events, and deployers must keep those logs for at least six months unless other law says otherwise. The obligations for stand-alone high-risk systems apply from December 2, 2027.

Why agent audit trails are harder than regular audit logs

Traditional audit logs assume a person clicked a button in an application. Agents break that assumption:

  • The actor isn’t a person. The agent made the call, but a person asked for the work, often several steps earlier.
  • Actions span many systems. One task can touch a CRM, a code host, and a database, each with its own log in its own format.
  • Downstream systems see a service account. If the MCP server uses a shared credential, the CRM’s log says “integration user,” not “Maria in sales.”
  • Agents call agents. An orchestrator delegates to a specialist, which calls a tool. Each hop can lose the link to the original request.
  • Tools change. A tool’s description or behavior can change between versions, which changes what an agent was told it could do.

What every MCP audit record needs

Each tool call should produce one record with these fields:

Field group What to record Why auditors care
Who asked The human user, their department, and how they authenticated Ties the action to an accountable person
Which agent Agent ID, agent owner, agent version, and the client or app it ran in Shows which AI system acted
Delegation chain Task or run ID, parent agent or run ID, and session or request ID Links multi-step and multi-agent work back to the original request
What tool MCP server, server version, tool name, and tool description version Shows exactly what was called and what the agent was told about it
With what inputs Arguments, with sensitive values masked or hashed Shows what the agent tried to do
Under what authority The credential or token used, its scopes, and its audience Shows the agent stayed within approved access
What policy decided Allowed, denied, or escalated; the rule or policy version; any human approver Proves controls ran
What happened Success, error, or timeout; a result summary or hash; data protection actions taken Shows the outcome
When and how much Timestamps, latency, and the tokens and cost of the agent run Supports investigation and cost review

How to trace every tool call back to a person

Tracing is where most audit trails break. These practices keep the chain intact.

1. Authenticate the person, not just the agent

Every agent run should start from an authenticated user or an explicitly owned service. Use your corporate identity provider, and carry that identity into every request the agent makes. For remote MCP servers, OAuth 2.1 tokens issued on the user’s behalf preserve who the work is for.

2. Give every agent its own identity and owner

Shared keys erase the difference between agents. Each agent needs a distinct ID and a named owner, so a record can say both “who asked” and “which agent acted.”

3. Carry a run ID through every hop

Assign a task or run ID when the user’s request starts, and pass it through every model call, tool call, and agent handoff. When an orchestrator delegates to a sub-agent, record the parent run ID. That single thread lets you rebuild the whole chain from one record.

4. Don’t pass tokens through

An MCP server that forwards a user’s token to a downstream API breaks the audit chain and widens the token’s reach. The MCP specification forbids it. Instead, a gateway or server should get its own credential for the downstream system and record which user and agent the call was for.

5. Log at a single control point

When agents call MCP servers directly, each server logs differently, if at all. Routing tool calls through an MCP gateway gives you one record format, one clock, and one place where identity, policy, and outcome are captured together.

6. Record the tool’s version, not just its name

Pin MCP server versions and record which version handled each call, along with the version of the tool description. If a tool changes, you can show what the agent saw at the time.

7. Join MCP records with model and approval records

The MCP record shows what the agent did. Model logs show why it decided to, and approval records show who signed off. Use the run ID to connect them.

Make the trail trustworthy

An audit trail is only as good as its integrity:

  • Tamper resistance. Write records to append-only or write-once storage, and restrict who can delete them.
  • Complete coverage. Record denied, failed, and escalated calls, not just successful ones.
  • Accurate time. Use synchronized clocks and consistent time zones.
  • Retention. Set retention to meet your strictest requirement, such as six months for EU AI Act deployer logs or longer for financial and health records.
  • Privacy. Mask or hash sensitive arguments and results. An audit trail shouldn’t become a second copy of the data you’re protecting.
  • Access control. Limit who can read audit records, and log access to them too.
  • Export. Forward records to your SIEM and long-term storage so security and audit teams can work in tools they already use.

Common MCP audit trail gaps

  • Logging only successful calls
  • Recording the service account instead of the person
  • Losing the link between an orchestrator and its sub-agents
  • Storing full sensitive arguments in plain text
  • Keeping logs only on individual MCP servers, in different formats
  • Not recording which policy or approver allowed a high-risk action
  • No record of which version of a tool the agent used

MCP audit trail checklist

  • Every agent has its own ID and a named owner
  • Every run starts from an authenticated person or owned service
  • A run ID is carried through every model call, tool call, and handoff
  • All tool calls go through one control point
  • Each record includes who, which agent, what tool, inputs, authority, decision, outcome, and time
  • Denied and failed calls are recorded
  • Sensitive values are masked or hashed
  • Records are append-only and forwarded to the SIEM
  • Retention meets your strictest requirement
  • You can answer all eight auditor questions from the trail alone

How Airia builds an MCP audit trail

Airia captures the audit trail at the point where agents call tools:

  • Every call logged. Airia’s MCP Gateway records every tool call as succeeded, denied, or errored, so the trail shows controls at work, not just activity.
  • Identity and access in one place. MCP servers must be approved by an administrator before use, and access is set by role at the app, tool, and parameter level, so each record ties back to an approved scope.
  • Decisions you can show. Inline security runbooks log each decision, including the checks performed, the conditions evaluated, and the verdict for each tool call. Agent Constraints add deterministic rules on what agents can do.
  • Security events recorded. Airia Secure includes an AI Audit Trail, along with prompt injection blocking and data loss prevention for AI traffic, including MCP server responses.
  • Sent where auditors look. Audit, guardrail violation, and tool constraint violation events can be forwarded to your SIEM in real time.
  • Evidence for reviews. Compliance reporting helps turn records into the documentation auditors ask for.
  • Find what’s not covered. Airia Discover includes MCP Server Detection, so servers outside the gateway can be found and brought into the trail.

FAQ

What is an MCP audit trail? It’s a complete record of every tool call AI agents make through MCP, including who asked, which agent acted, what tool and arguments were used, what policy decided, and what happened.

How do you trace an agent’s action back to a person? Authenticate the user at the start of every run, carry their identity and a run ID through every model call, tool call, and agent handoff, and record both the user and the agent on every tool call.

Should denied tool calls be logged? Yes. Denied and failed calls show that controls were working, and they’re often the first sign of an attack or a misconfigured agent.

How long should AI agent logs be kept? At least as long as your strictest requirement. Under the EU AI Act, deployers of high-risk AI systems must keep logs for at least six months unless other law says otherwise. Many companies keep them longer for security and financial audits.

Answer the auditor’s next question in minutes, not days. Request a demo to see how Airia traces every MCP tool call back to the person and agent behind it.

Put these ideas to work.

Schedule a 30-minute walkthrough with our team.

Talk through your use case