Audit logging

Every operation that passes through mcp is logged — CLI commands, proxy requests, tool calls, registry searches. The audit log gives you full visibility into what happened, when, how long it took, and whether it succeeded.

How it works

mcp writes audit entries to an embedded ChronDBarrow-up-right database stored locally. Logging happens in a background thread via an async channel, so it never blocks your commands.

mcp <any command>  -->  AuditLogger (mpsc channel)  -->  ChronDB (background writer)
                                                             |
                                                    ~/.config/mcp/audit/

Every entry records:

Field
Description

timestamp

ISO 8601 timestamp

source

Where it came from: cli, serve:http, serve:stdio

method

What was called: tools/call, tools/list, registry/search, etc.

tool_name

Tool name (for tools/call)

server_name

Backend server name

identity

Who called it: local for CLI, user subject for proxy

duration_ms

How long it took

success

Whether it worked

error_message

Error details when it failed

What gets logged

Everything:

Command
Method

mcp --list

servers/list

mcp search <query>

registry/search

mcp add <name>

config/add

mcp remove <name>

config/remove

mcp <server> --list

tools/list

mcp <server> --info

tools/info

mcp <server> <tool>

tools/call

Proxy: any JSON-RPC request

initialize, tools/list, tools/call

The only command that doesn't log itself is mcp logs (that would be recursive).

Querying logs

Output formats

Terminal (interactive) — colored table:

JSON (piped or --json) — composable with jq:

Follow mode

Stream new entries in real-time, like tail -f:

Follow mode uses polling (1s interval) on the ChronDB database, so it works even when mcp serve runs in a separate process.

Configuration

Add an audit section to ~/.config/mcp/servers.json:

Field
Default
Description

enabled

true

Enable/disable audit logging

log_arguments

false

Log tool call arguments (may contain PII)

path

~/.config/mcp/audit/data

ChronDB data directory

index_path

~/.config/mcp/audit/index

ChronDB index directory

Logging arguments

By default, tool call arguments are not logged to avoid capturing sensitive data (API keys, personal info, query contents). Enable log_arguments only if you need it:

With this enabled, mcp logs --json will include the full arguments:

Storage

Audit data lives in ~/.config/mcp/audit/ by default:

Each entry is stored as a JSON document with key audit:{timestamp_millis}-{uuid}, which gives natural chronological ordering via prefix listing.

Disabling audit logging

When disabled, the logger is a no-op — zero overhead, no files created.

Last updated

Was this helpful?