mcp-session-audit
Audit a recorded MCP session for protocol hygiene failures. Offline, deterministic, zero dependencies.
MCP sessions fail in ways that never surface as crashes — they surface as the model quietly doing the wrong thing:
- a failed parallel tool call leaves a dangling tool_call_id that poisons every later request (opencode #44852)
isError:truegets swallowed and the error text is read as ordinary output (zeroclaw #7122, claude-agent-sdk #717)- an execution failure is delivered as a JSON-RPC error, so the model never learns why its call failed (memoria #258)
- a validator clobbers isError back to success, inflating success rates (IBM mcp-context-forge #4202)
All of these are visible in a recorded transcript. This tool looks.
What it detects
| Severity | Finding |
|---|---|
| CRITICAL | dangling tool call (request never answered) |
| CRITICAL | duplicate response for the same id |
| CRITICAL | response with both result and error |
| CRITICAL | tools/call for a name absent from the session's tools/list |
| CRITICAL | malformed JSON-RPC error object |
| WARNING | orphan response (no matching request) |
| WARNING | isError:true with no error text (model can't self-correct) |
| WARNING | success-shaped result whose text reads as a failure |
| WARNING | execution failures delivered as JSON-RPC errors |
| WARNING | unparseable / shapeless lines |
Input format
JSONL, one recorded message per line:
{"direction":"request","id":1,"method":"tools/call","params":{"name":"search","arguments":{"q":"x"}}}
{"direction":"response","id":1,"result":{"content":[{"type":"text","text":"found it"}]}}
direction defaults to response when a line has a result/error and no
method — raw JSON-RPC client/server logs are tolerated.
Usage
python3 mcp_session_audit.py session.jsonl
Exit codes (CI-friendly): 0 clean · 1 warnings · 2 any CRITICAL.
Why offline replay?
Live probes (mcp-replay, MCP Inspector) need the server running. Most MCP session failures are already sitting in a recorded transcript — a CI log, a debug dump, a user-reported session file. Audit them where they are, with zero dependencies.
MIT License.
Metadata
Release files for mcp-session-audit 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mcp_session_audit-0.1.0.tar.gz | 5.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mcp_session_audit-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.0 kB
Release files / mcp_session_audit-0.1.0.tar.gz
| Download URL | mcp_session_audit-0.1.0.tar.gz |
|---|---|
| Size | 5.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f30a6b5cea3b16cd4d95634ae3418c95fa851b121667d8bfd3e689ec2fdeb3d5
|
|
BLAKE2b-256 checksum How to use checksums |
829d48bd8ebd2c39a6b0c0f63c78b5246caeedc3632a14ad6ef75e44b8ace70b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.18 {"installer":{"name":"uv","version":"0.12.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / mcp_session_audit-0.1.0-py3-none-any.whl
| Download URL | mcp_session_audit-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1d7bed06a03986f430c49afe232d7dcc0c3072a2a7744b142df00eca27f0c67d
|
|
BLAKE2b-256 checksum How to use checksums |
f4d46ac8a53cebca4387018f037f19e4d2c095ad4c9b4cfcf5de4366e8fda6d2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.18 {"installer":{"name":"uv","version":"0.12.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|