Open source · MCP security
The leak is a path.
Close it.
LethalPath maps your AI agent’s tools as a graph, finds the routes from untrusted input to public output, and computes a minimum cut — the exact permissions to revoke.
One unedited run. A public issue taints the agent context, and a private folder leaves through git.push. Revoking git.push closes the route. See the exact queries.
The problem
Three permissions you would approve. One path you would not.
No tool misbehaves. The bug is in the arrangement: one agent, one context, and three abilities that add up to exfiltration.
Fine alone
Read a public issue. Read a private folder. Publish. Every grant is reasonable on its own.
Dangerous together
A stranger’s sentence rides into the agent’s context. Your files leave with it.
The minimum cut
Revoke one grant. The route closes; the other declared work keeps running.
Replayed against published incidents from GitHub MCP, Supabase, WhatsApp and Postmark. See the evidence.
It also happens with no attacker: in a controlled study, depending on the model, 11.5–41.3% of agent runs passed credentials across MCP servers when the task allowed redacting them (MCPHunt). Meta’s Agents Rule of Two and OWASP LLM06 recommend the same remedy: don’t give one agent all three abilities.
How it works
From config to a verified cut.
Three deterministic steps. There is no model in the runtime; the graph decides, and the CLI prints the receipt.
Read the config
Point scan at an MCP config. LethalPath labels every tool by what it reads and writes, redacts secrets before anything reaches the graph, and names tools it cannot classify.
Find the path
One Cypher traversal anchors on the shared context and returns the routes from untrusted input to a public sink, with every tool on the path named.
Cut and verify
algo.maxFlow computes the flow. LethalPath walks the residual graph, compares both canonical cuts, then re-runs the traversal with the revoked grants excluded.
$ node packages/cli/dist/index.js scan
config fs-git · public issue → private folder → public repo
graph scan_fs-git · 11 nodes · 9 edges · ready
LEAK PATHS
1 4 hops project folder → filesystem.read → context → git.push → public repo
$ node packages/cli/dist/index.js fix
max-flow 2
cut write side · git.push → public repo
revoke git.push
verified 0 of 1 routes remain
tasks 3 of 4 keep working
output copied from docs/live-evidence/
Evidence
Every number has a file behind it.
Forty seeded configs, one public config, and the committed transcripts. Read the evidence.
The 40 cases are synthetic and generated by us; the 567-route config is built from the official MCP server READMEs. What this proves is that the engine is consistent with its spec. Read the limits.
Demo
The whole run, in three minutes.
Scan finds the route. Fix computes the minimum cut, revokes it, and re-runs the query. Then a real 567-route config, the runtime guard, and the evidence. 3:20 · captions on.
The fix
It doesn’t stop at the risk. It computes the permissions to remove.
algo.maxFlow returns flows, not a cut. LethalPath walks the residual graph, compares both canonical cuts, and picks the one that costs fewer grants and keeps more declared tasks.
MATCH (p:Resource {sensitivity:'private'}) WHERE p.visibility IS NULL OR p.visibility <> 'public' WITH collect(p) AS src MATCH (s:Resource {visibility:'public'}) WHERE s.sensitivity IS NULL OR s.sensitivity <> 'private' WITH src, collect(s) AS dst CALL algo.maxFlow({ sourceNodes: src, targetNodes: dst, relationshipTypes: ['FLOWS'], capacityProperty: 'capacity' }) YIELD maxFlow, edges, edgeFlows RETURN maxFlow, edges, edgeFlows
The second query re-runs the traversal without the revoked grant. Zero is the receipt. See the exact queries.
Built on FalkorDB
The leak is a reachability question, so it runs on a graph.
The leak is a reachability question: can an untrusted input reach a public sink through this agent’s context? A vector index can rank tools; it cannot answer that. The fix is a flow problem on the same graph.
- Path query. One anchored traversal, bounded at five hops per segment, with the tools named on the path.
- Fix query. CALL algo.maxFlow on one capacity relationship type, then a residual cut in code.
- Read-only boundary. Every read uses GRAPH.RO_QUERY, with a 3 s timeout, a write-keyword guard and a LIMIT cap.
- One graph per scan. scan_<name> isolates every config on one instance.
Install
Run it locally.
The repo is the distribution. Clone it, start a pinned FalkorDB, build once, then scan.
- Docker for FalkorDB 6.0.2
- Node 20 or newer
- pnpm 9
- No account, no telemetry, no config uploaded
# clone and start FalkorDB 6.0.2 git clone https://github.com/bhanu-dev82/lethalpath cd lethalpath docker compose up -d pnpm install && pnpm build # find the routes, then compute the cut node packages/cli/dist/index.js scan node packages/cli/dist/index.js fix