tools/call, and forwards it unchanged; the agent only connects to a different URL. The audit server goes the other way: it exposes RootSign’s own records as read-only MCP tools, so an auditing agent can list sessions and verify chains.
Install
See it work
This script runs all three parts on your machine in one process: an ordinary MCP server, the RootSign proxy in front of it, and an MCP client that calls two tools through the proxy. Nothing is mocked; they talk real HTTP to each other on ports 8001 and 8000.demo.py
Verify the session
Put the proxy in front of your server
In production the proxy is its own process. Save this asproxy.py, point it at your server with MCP_UPSTREAM_URL, and change your agent’s MCP server URL to http://127.0.0.1:8000/mcp:
proxy.py
tools/call from every client lands on that session’s chain until you stop it with Ctrl+C. When it stops, it prints the session ID to verify:
create_proxy_app() also accepts redaction_config= to redact arguments and results before they are hashed, and require_approval=True to hold each call until a person approves it. See Redact PII and Require human approval.
What the proxy records and forwards
For a
tools/call, tool_name is the MCP tool name and the input is the call’s arguments, exactly as the client sent them:
result, so the record shows exactly what the agent received:
tools/call with an HTTP error, the call is still recorded, with an empty output, and the client receives the server’s error response. If the server redirects, the proxy follows the redirect itself, so a client can never be sent around the proxy to the server’s real address.
Let an agent query the audit log
The audit server exposes RootSign’s records as four read-only MCP tools:The audit server reads the PostgreSQL store, so it needs
pip install 'rootsign[mcp,postgres]' and a database set up with rootsign-admin. It cannot read JSONL session files.audit_server.py:
audit_server.py
http://127.0.0.1:8002/mcp:
How interception works
The proxy is an ASGI app built with FastAPI. It reads each JSON-RPC request, and fortools/call it records the call through the same code path as @rootsign.trace, with redaction applied before hashing, then forwards it. The session is found the same way as for framework tools: from rootsign.session() when the proxy runs inside one, or from ctx= and client= passed to create_proxy_app(). The design is in ADR-010.
Limitations
- Streamable HTTP only. The proxy is an HTTP service, so it cannot sit in front of an MCP server that a client launches over stdio.
- Messages a server sends before a tool’s result are dropped. If a server streams progress notifications ahead of a
tools/callresult, the proxy returns only the result. - One session per proxy process. All clients share it, so their calls interleave on one chain.
Full example
Both scripts are inexamples/mcp-proxy in the repository, and CI runs demo.py.
LangGraph and LangChain
Instrument the tools in a LangGraph agent.
CrewAI
Instrument the tools of a CrewAI agent.
Any Python function
Record calls to functions that are not framework tools.