Repository navigation
Integrations MCP
Stable: tested with
tests/adapter_contract.pyagainst the pinned library on every push to main and every pull request (what's stable).
tracekit.integrations.mcp.TracekitSession gates the tool calls an agent makes through an MCP ClientSession (the
Python mcp package). Before each call_tool it asks the Tracekit signer for a policy decision; after the server
answers it records the outcome. It works with any object that implements the signer RPC
(tracekit.signer.rpc_schema.SignerAPI), including tracekit.testing.FakeSigner.
pip install tracekit-ai "mcp>=2.3,<2.4"Python 3.10 or newer (the mcp package's own requirement).
from mcp import ClientSession
from tracekit.integrations.mcp import TracekitSession
run = signer.register_run({"request_id": "run-start-1", "agent": {"name": "triage-agent"}})
async with ClientSession(read, write) as session:
await session.initialize()
session = TracekitSession(session, signer, run)
result = await session.call_tool("create_issue", {"title": "..."})Every other attribute is the wrapped session's. Only calls made through the wrapped session are seen.
| When | RPC | Sent |
|---|---|---|
| before the call is sent | decide |
a fresh tool_call_id, the tool as mcp:<server>/<tool>, tool_class_hint: mcp, the arguments as given (parsed) |
| right before it is sent | approval_consume |
the same call and arguments, and the approval id when the call waited for one |
| after the server answers | complete |
status ok, or error for a result with isError: true; a sha256: commitment to the result (not the result), or the exception type and message |
<server> is the name in the server's initialize result, with every character outside A-Za-z0-9_.- replaced by _
(unknown when the server gave none). The policy's tools map should map mcp:*/* to the mcp class (the coding
pack does), so rules can match the server, tool and args fields. A class hint that disagrees with the policy is
recorded as a capture.gap and the stricter decision applies.
- allow: the call is sent to the server.
-
deny: the call is not sent.
call_toolreturns aCallToolResultwithisError: trueand the textTool call blocked by policy: <rule ids>, and the run goes on. -
ask: the adapter opens an approval in the signer and holds the call while it waits, up to
approval_wait_sseconds (default 300), for a person to decide (CLI, web). Approved, the call is sent; rejected, expired or still undecided at the deadline, it is refused as for a deny, and an undecided approval is withdrawn (approval.abandoned), as it is when the caller cancels the waitingcall_tool.TracekitSession(session, signer, run, approval_wait_s=0)is for a caller that cannot wait: anaskis then refused without opening an approval.
Every call that is not denied is sent only after the signer's approval_consume agrees for this exact call and these
exact arguments. A result with isError: true is returned unchanged; an exception from the session (a protocol error,
a lost connection) propagates unchanged. Both are recorded as error.
- MCP calls carry no call id, so every
call_toolis a call of its own (attempt 0); a retry is a new decision. - There is no saved state: a call waiting for an approval does not survive the process.
- Servers the agent reaches without this session (another client, a hosted MCP tool of a model provider) are not seen.
- The server's name in
mcp:<server>/<tool>is the one the server gives. An mcp 1.x session doesn't keep it:instrument()takes it from the session'sinitialize()when that runs afterinstrument(); by hand, passTracekitSession(session, client, run, server="github"). Without a name the calls are recorded asmcp:unknown/<tool>, with a warning, and rules written for the server's name don't match them. - The LLM gateway's verified tool results don't check MCP calls: this integration decides each under an id of its own, not the model's tool call id (gateway).
Generated from docs/ at v1.4.1. Edit the docs in the repository, not here.
Get started
- Quickstart: the v2 signer
- Quickstarts
- Quickstart: Claude Agent SDK
- Quickstart: a custom agent
- Quickstart: LangChain and LangGraph
- Quickstart: MCP client
- Quickstart: OpenAI Agents SDK
- Coding agents other than Claude Code
- tracekit doctor
- Walkthrough: Tracekit end to end
How it works
- How Tracekit works
- Overview
- The life of a tool call
- The evidence format
- Verification and assurance
- Witnesses and monitoring
- Policy
- Approvals
- Detection and containment
- Capture and completeness
- Custody
- Provenance and tracekit why
- Deployment and isolation
- Storage, durability and performance
- Integrations
- Security model
- Architecture
- tracekit why: architecture
Integrations
- Integrations
- Adapters
- OpenTelemetry
- Remote clients
- Kubernetes agent-sandbox
- agentgateway
- agentsh and Tracekit
- Browser Use
- Claude Agent SDK
- Claude Code's sandbox
- Codex's sandbox
- CrewAI
- Docker MCP Gateway
- E2B
- Falco
- Gemini CLI's sandbox
- Google ADK
- Haystack
- LangChain v1
- LiteLLM
- LlamaIndex
- MCP client
- microsandbox
- Microsoft Agent Framework
- OpenAI Agents SDK
- NVIDIA OpenShell
- Pydantic AI
- sandbox-runtime's proxy on its own
- Strands Agents
- Tetragon
- Vercel AI SDK
- Wassette
Policy and approvals
- Policy reference
- Approvals
- Findings
- Reading the model's reasoning
- Incidents and containment
- Webhooks
Deploy and operate
- Deploying the signer
- The signer as a container
- The signer on Kubernetes
- The compose stack
- Identity
- Tool executor
- MCP gateway
- LLM gateway
- Egress observation
- Witnesses
- Log monitor
- Record-key issuer
- Signer observability
- Viewer
- tracekit why: causal investigation and replay
- Migrating
- Platforms
Verify the evidence
- Reading a v2 verify report
- Evidence format v2
- Auditor guide
- Sample evidence bundle
- Signing
- What Tracekit guarantees
Security and privacy
- Threat model: the v2 signer
- Threat model: the v1 laptop signer
- HTTP security checklist
- Threat-model review packet
- Privacy
- Known limits and trade-offs
- What's stable
Compliance
- Compliance mapping
- EU AI Act
- ISO/IEC 42001
- NIST AI RMF and the Generative AI Profile
- OWASP Top 10 lists for LLM and agentic applications
Evaluation
Demos
- Demos
- Agent approvers within bounds
- Completeness and tamper evidence
- Detection and containment
- Network coverage: an egress observer
- Guardrails: allow, deny, or ask a person
- MCP tools, gated and recorded
- Prompt injection held by provenance
- Why: which input caused the action
Help