Home
Home/resources/mcp audit logging how to log mcp too…
Ed25519 signaturesSHA-256 hashes8 SDKs
Status
Sign inStart free
Home
AI GovernanceMCPAI AgentsAudit Trail

MCP Audit Logging: How to Log MCP Tool Calls

The Model Context Protocol tells clients they should log tool usage for audit purposes, and says nothing more: no fields, no format, no retention. Here is where to record MCP tool calls, what each record needs, what to keep out of it, and how to turn a log into evidence.

Start freeConnect the MCP server
1,000 signed events a month on the free plan. No card.
Adeola OkunolaFounder, Invoance12 November 2026·9 min read
Summarize with ClaudeSummarize with ChatGPTSummarize with Google AISummarize with Perplexity
On this page
  1. What the MCP specification says
  2. Where to record the call
  3. What one record needs
  4. What to keep out of the record
  5. From a log to evidence
  6. Recording a tool call with Invoance
  7. Letting the agent write records itself
  8. A checklist to start from
  9. What this does not give you

What the MCP specification says

Very little. In the current specification (2026-07-28), the page on tools ends with a list of things clients should do, and the last item is: log tool usage for audit purposes. That is the whole of it. There are no required fields, no format, no word on how long to keep anything or who should be able to read it.

Two other parts of the specification sound related and are not. The logging utility lets a server send diagnostic messages to a client, at levels like debug and error. It is for troubleshooting, and the specification says those messages must not contain credentials or personal information. The security best practices page mentions audit trails only in passing, as a reason not to pass tokens through and to keep scopes narrow.

So the question "who called which tool, with what, and can we show it later?" has no official answer. You have to design the record yourself. The rest of this guide is one way to do it.

  • MCP specification: tools The security considerations at the end carry the one line on audit.
  • MCP specification: logging The diagnostic logging utility, which is not an audit log.

Where to record the call

A tool call passes through up to three places, and each sees something different.

WhereWhat it seesWhat it missesBest for
The client or agent hostThe user, the conversation, every server it callsNothing, but the agent's own process can often reach the logKnowing why a call was made
A gateway or proxyEvery call to every server, the caller's identity, both request and resultThe reasoning behind the callOne consistent record that the agent cannot rewrite
The MCP serverThe calls it received and what it didCalls to other servers, and often which person was behind the clientA tool owner's record of what its own system did
If you can only do one, record at a gateway. It sees every server, it sits outside the agent's process, and it is where you already check who is allowed to call what.

What one record needs

A useful record can be read a year later by someone who was not there. In MCP terms, a tools/call request carries the tool's name and its arguments, and the result carries the content returned and a flag saying whether it was an error. Around those, add who asked, when, and whether a person approved it.

Two details are easy to miss. Record the person and the agent separately, because "the support agent did it" does not tell you whose request it was acting on. And record calls that were refused or failed. A blocked attempt to export every customer record is one of the most useful lines a log can hold.

One MCP tool call, written down

tools/call · issue_refund
user: "user_2207"client: "support-agent-v3"
Who asked

The person the agent acts for and the agent itself. A shared service account answers neither.

server: "billing-mcp"tool: "issue_refund"
Which tool

The server and the tool name from the tools/call request.

arguments: { "order": "ord_9102", "amount": 4200 }arguments_hash: "3f9a1c07…e2b4"
With what

The arguments, or only their hash when they hold personal data. The hash still lets you match the call later.

approved_by: "user_0031"
Who approved

For actions that needed a person: who said yes, tied to this exact call.

is_error: falseresult_hash: "b71d44e9…90ac"
What came back

Whether it worked, and a fingerprint of the result. Refused and failed calls belong here too.

requested_at: "2026-11-12T09:41:12.000Z"completed_at: "2026-11-12T09:41:13.210Z"
When

Both ends of the call, in UTC, from the gateway's clock.

seq: 4820signature: "mN3xQ8vT…Lw=="
Why anyone should believe it

Added where the record is stored, outside the agent's reach. The specification asks for none of this.

The gateway or client writes the first six rows; the last is written by the system that stores the record.
One made-up tool call, field by field. The last row is what lets someone else check the others.

What to keep out of the record

Tool arguments and results are where the sensitive data lives: customer names, message bodies, query results, sometimes credentials that should never have been passed at all. An audit log is kept for a long time and read by people who were not part of the conversation, so copy as little of that into it as you can.

Store a fingerprint instead. A SHA-256 hash of the arguments and of the result lets you show later that a particular call happened with exactly those inputs, without the log holding the inputs themselves. Keep the full payloads, if you need them, in a store with shorter retention and tighter access.

Never record access tokens, API keys or session secrets. Leave out the model's private reasoning unless you have decided you need it. And remember that a signed record cannot be edited afterwards, which is the point, so decide what goes in before you sign, not after.

From a log to evidence

A log file on the machine that runs the agent is useful for debugging. It is weak as evidence, for one reason: whoever can change the agent can usually change the file. That includes the agent itself, if a tool gives it shell or file access.

Three properties change that. The record is written somewhere the agent cannot reach, through a credential held by the gateway and not by the agent. Each record is signed and numbered when it is stored, so an edited or missing record is detectable. And the people who may need to rely on it, such as your customer or your security team, can check a record themselves.

None of this is specific to MCP. It is the same standard an audit log for human users has to meet. MCP only makes it more pressing, because an agent can make hundreds of calls in the time a person makes one.

  • Tamper-evident vs tamper-proof vs immutable What each word promises, and which one you can claim.
  • AI agents can delete their own traces Why the record has to live outside the agent's reach.

Recording a tool call with Invoance

Invoance is not an MCP gateway and does not sit in the path of your tool calls. It is where the gateway, or your own code, writes the record. Post one event per call to the Event Ledger. Invoance hashes the payload, signs it with your organization's Ed25519 key, stores it where deletes are blocked, and returns an ID with a public proof page.

For calls that change something, write two events: one before the tool runs, saying what is about to happen, and one after, with the outcome. If the first write fails, do not run the tool. That way no action exists without a record of the attempt.

To keep a record of what the model itself said, such as the answer that led to the call, use an AI attestation. It stores a hash of the input and of the output separately, with the model's name. A trace groups all the records from one agent run into a single sealed bundle.

One tool call, recorded from a gateway
curl -X POST https://api.invoance.com/v1/events \
  -H "Authorization: Bearer $INVOANCE_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "event_type": "mcp.tool_call.completed",
    "payload": {
      "user": "user_2207",
      "client": "support-agent-v3",
      "server": "billing-mcp",
      "tool": "issue_refund",
      "arguments_hash": "3f9a1c07...e2b4",
      "approved_by": "user_0031",
      "is_error": false,
      "result_hash": "b71d44e9...90ac",
      "requested_at": "2026-11-12T09:41:12.000Z",
      "completed_at": "2026-11-12T09:41:13.210Z"
    }
  }'
  • Event Ledger Signed, append-only records of events you may need to show later.
  • Events API The request, the response and how verification works.
  • AI attestation: what it is and why it matters The record type for model inputs and outputs.

Letting the agent write records itself

Invoance also runs its own MCP server, at https://mcp.invoance.com/mcp. Add it to Claude, ChatGPT or another MCP client, and the agent gains tools that write the same signed records: log_event for something that happened, attest_ai_output for a model's input and output, and anchor_document for a file's fingerprint. Each returns a proof link.

This is the quick way to start, and it has an obvious limit. A record the agent chooses to write is a record of what the agent reported. It is good for keeping a signed note of decisions and outputs as work happens. It is not a substitute for a gateway that records every call whether or not the agent mentions it. Use the gateway for completeness and the MCP server for convenience.

  • Invoance MCP server Setup for each client, the tools and how sign-in works.

Start free: 1,000 signed events and 50 AI attestations a month. The Developer plan needs no card. Post each tool call from your gateway, or add the Invoance MCP server and let the agent record through it.

Start freeConnect the MCP server

A checklist to start from

1. Pick the place: a gateway if you have one, the client if you do not.

2. Record every tools/call, including refused and failed ones.

3. Record the person and the agent as separate fields.

4. Hash arguments and results, and keep raw payloads out of the long-lived log.

5. Tie approvals to the exact call they approved.

6. Keep the writing credential out of the agent's environment.

7. Sign and number each record where it is stored.

8. Decide how long to keep records, and write that down.

9. Have someone outside the agent team check a sample on a schedule.

What this does not give you

A signed record shows that the record has not changed since it was written. It does not show that the record was true, or complete. A call that bypassed your gateway leaves nothing, and no signature will reveal it, so the control that matters most is making sure there is no path around the place you record.

It also does not make the tool call safe. Logging tells you what happened. Deciding what an agent is allowed to do, and when a person has to approve it, is a separate job.

On this page
  1. What the MCP specification says
  2. Where to record the call
  3. What one record needs
  4. What to keep out of the record
  5. From a log to evidence
  6. Recording a tool call with Invoance
  7. Letting the agent write records itself
  8. A checklist to start from
  9. What this does not give you
Adeola Okunola

Adeola Okunola

Founder, Invoance
About the author

I'm Adeola, founder of Invoance.

I build proof infrastructure for audit logs, AI attestations, and business records that need to stand up to security, compliance, and legal scrutiny.

Most systems document what happened. Invoance helps prove it.

All articles by Adeola
Related product

AI Attestation

The evidence layer for AI agent actions: what an agent was asked, what it decided, and what it did.

Open AI Attestation
Keep readingAll articles
AI AGENTSsha-256 · f782602b…bd60
Security10 min read

AI Agents Can Delete Their Own Traces. Sign the Record Somewhere Else.

Researchers got coding agents to delete their own session logs with a direct request, a planted skill file, and a scoring rule that rewarded shorter traces. The usual fix moves the log somewhere else. This guide goes further: the gateway signs every action, the proxy attests every model exchange, approvals are bound to one exact call, and a deleted row shows up as a gap.

Adeola Okunola·8 October 2026Read
MCPsha-256 · 89f45dc5…0f54
Product8 min read

Use Invoance From Claude: Anchor a Document, Check a Copy, Keep the Proof

Add https://mcp.invoance.com/mcp as a custom connector and Claude can write signed records for your organization and check them later, with no SDK and no API key to handle. The setup, what the approval actually grants, and the first three things to try.

Adeola Okunola·26 October 2026Read
AI AGENTSsha-256 · efc96dc0…6717
AI Governance9 min read

How to Give a Long-Running AI Agent a Verifiable Trace

An agent that runs for hours leaves a long trail of model calls, tool invocations, and side effects. Application logs record that trail; they cannot prove it was not edited afterward. Here is how to give every agent run a signed, sealed, independently verifiable trace with Invoance: create, attest, anchor, seal.

Adeola Okunola·15 July 2026Read

Start free: 1,000 signed events and 50 AI attestations a month.

The Developer plan needs no card. Post each tool call from your gateway, or add the Invoance MCP server and let the agent record through it.

Start freeConnect the MCP server

Verified documents and records. Invoance records the exact version of every invoice, report and notice your company sends, so the people who receive them can confirm they have the version you sent, without taking your word for it.

Products

  • Evidence Rooms
  • Audit Logs
  • Event Ledger
  • AI Attestation
  • Document Anchoring
  • Traces

Developers

  • Documentation
  • API reference
  • SDKs
  • How it works
  • How traces seal
  • System status

Verify

  • Audit Log
  • Event
  • AI Attestation
  • Document
  • Trace

Company

  • Company overview
  • What is Invoance
  • Pricing
  • Security
  • Compliance teams
  • Finance teams
  • Partners
  • Brand assets
  • Resources
  • Help center
  • Contact
© 2025 – 2026 Invoance, Inc. All rights reserved.© 2026 Invoance, Inc. All rights reserved.
TermsPrivacyLegal noticeLegal FAQ