2026-11-27 16:21 UTC

MCPgraphy launches an evidence-learning proxy for MCP tool calls

state: expiredheat: mediumuncertainty: mediumrelevance: mediummcp tool-reliability agent-safetyHemanth

What is this?

MCPgraphy is an MIT-licensed, installable proxy by developer Hemanth (GitHub account hemanth1999k) for MCP servers. Announced in a Show HN post dated Nov. 3, 2026, it observes an agent’s tool calls and resource states, then builds an evidence-linked graph of which calls worked or failed in observed states. It can offer that information, warn while passing calls through, or block calls judged unsupported by prior observations; unknown cases remain unknown. The project page says learning is passive in normal use, stores its graph and audit log in SQLite, and supports stdio and Streamable HTTP downstream connections. Its creator reports results from simulated benchmarks and a GPT-5.4-mini evaluation; these are project-reported findings, not independent validation.

Why it matters

This is a practical attempt to address a common agent failure mode: tools may be available but unusable in the resource’s current state. A lightweight proxy that learns from ordinary calls could reduce wasted retries and make tool use more reliable without requiring server resets or extra probes. The reported gains are encouraging, but the evidence is limited to the creator’s controlled tasks and one model evaluation; real-world performance, coverage across MCP servers, and the risks of blocking calls based on incomplete observations remain open questions.

Current assessment

New: MCPgraphy is presented as available now via pip and GitHub, with an MIT license and an example for wrapping the filesystem MCP server. It learns from calls the agent already makes, reads resources before and after calls, and records evidence in a behavior graph. Its modes range from observe-only to warning and blocking; the author stresses that untested behavior stays UNKNOWN and that authorization is not inferred from success. The project also describes approval gates, audit records, schema fingerprints, and retesting after changes. The author reports that on 200 tasks across two simulated stateful servers, passive MCPgraphy completed all tasks and reduced invalid calls per task from 2.19 with raw tools to 0.71. In a separate creator-run evaluation using GPT-5.4-mini on 200 jobs, the project reports completion of achievable jobs rising from 74% to 99%, false success claims falling from 10 to zero, and tokens per completed job falling from 5,154 to 4,799; tokens per attempted job increased from 2,474 to 3,095. These results are attributed claims, not independent benchmarks, and the tasks, scripted setup, and limited server coverage constrain generalization. The linked Google results do not provide independent reporting or validation of MCPgraphy. The idea could add a state-aware reliability layer to MCP integrations and potentially save calls or prevent predictable failures, but observed success is not a safety guarantee: unseen states, server drift, or incorrect resource observations could leave gaps or lead to mistaken blocks. Track external replication, broader adapters, and production adoption before drawing stronger conclusions.

Measured heat

no measured readings yet — the hourly heat pass fills this in

How the heat travelled

10-31 13:00⭐ origin echo-reconstructedThe repository is the original source: its author presents MCPgraphy as “a proxy for any MCP server that learns, from the agent's own calls,
Hemanth Dhanasekaran (@hemanth1999k) on github (echo) · attributed from hn.story.50348315
—
11-03 05:07first on hacker news · published · +64.1hShow HN: MCPgraphy – a proxy that learns when your agent's MCP tools work
hemanth2k
—
11-03 05:07amplified on hacker news 👑hn.story.50348315
hemanth2k
peak 1 · 0 comments · 104% of case engagement
11-03 05:21our radar first saw it · +64.4hdiscovery anchor: hn.story.50348315—

Evidence (2) — ⭐ canonical anchor

sourceobjectauthorscorecomments
🟧 hnShow HN: MCPgraphy – a proxy that learns when your agent's MCP tools work
Retrieved article excerpt

Open article · Retrieved 2026-11-03T05:22:38.531549+00:00

# MCPgraphy

**Your agent's tools, mapped before it acts.**  
A proxy for any MCP server that learns, from the agent's own calls, which tools work in which state,  
and warns or blocks before the next bad call.

[PyPI](https://pypi.org/project/mcpgraphy/)
[CI](https://github.com/hemanth1999k/mcpgraphy/actions/workflows/ci.yml)
[Python](https://pypi.org/project/mcpgraphy/)
[MIT](https://github.com/hemanth1999k/mcpgraphy/blob/main/LICENSE)

```
pip install mcpgraphy
mcpgraphy wrap --adapter adapter.json --policy warn -- npx -y @modelcontextprotocol/server-filesystem ~/work
```

Point your MCP host at that command instead of the server. Same tools, same arguments, no keys, nothing leaves your machine.

[mcpgraphy in front of the official filesystem MCP server: a naive agent edits and moves files that are not there, mcpgraphy learns from those calls, then blocks the same mistakes before the server sees them](https://raw.githubusercontent.com/hemanth1999k/mcpgraphy/main/docs/demo.gif)

explainer-voiced.mp4

[
](https://private-user-images.githubusercontent.com/63975676/691627941-3caac91a-2829-4539-b04e-5bd1d9b30ee3.mp4?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3OTM2ODM2NTcsIm5iZiI6MTc5MzY4MzM1NywicGF0aCI6Ii82Mzk3NTY3Ni82OTE2Mjc5NDEtM2NhYWM5MWEtMjgyOS00NTM5LWIwNGUtNWJkMWQ5YjMwZWUzLm1wND9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjExMDMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYxMTAzVDA1MjIzN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTU4NGViMjhmMjJjNWVkMzhmMzE1N2U2OWUzZjY5NmZkNjZjNzQzNzE5YzUxNDBkOWJjZDQ0YjNlYmJlNTZlMWMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JnJlc3BvbnNlLWNvbnRlbnQtdHlwZT12aWRlbyUyRm1wNCJ9.fj6qEexIIMKUNa86yOOLRNGsGpEpHNgMZEzvklx9kAk)

*MCPgraphy in 1:48, narrated: what tool calling gets wrong, how the proxy maps your tools from the calls your agent already makes, and what changed when a real GPT agent ran behind it. Every number in it comes from the benchmark below.*

## The problem

An MCP server hands your agent a list of tools: names, descriptions, parameter schemas. It never says *when* a tool works. So the agent edits a file that is not there, publishes a release that was never tested, moves a ticket that is already closed, and finds out from the error. Then it retries. Sometimes the retry is the one that does damage.

Every agent framework rediscovers this the same way: by burning calls. The server already knows the answer, it just does not say it up front, and nothing in the protocol asks.

## What MCPgraphy does

MCPgraphy sits between the agent and the server. The tools pass through unchanged. Around every call it reads the touched resource back, before and after, and keeps that as evidence. From the evidence it builds a **behavior graph**: nodes are the states it actually observed, edges are what happened from each state, how many times, and whether later calls agreed.

Then it uses the graph three ways:

- **Offers.** Ask about a resource and get, for its *current* state, which tools are candidates, which need approval, which failed every time from here, and which were never tried. Unknown is reported as unknown, never as safe.
- **Warn.** Pass every call through, and attach a note when the evidence says this call failed from this state before.
- **Block.** Refuse calls the evidence says will fail here, and destructive or approval-gated tools unless pre-approved, before the server ever sees them. Every refusal says why and points at the observations.

It never probes your server, never resets anything, never adds a call the agent did not make. The learning is passive. That was a measured choice, not a limitation; see the numbers.

## Real numbers

200 stateful tasks on two simulated servers (a release pipeline and a ticket tracker, with hidden state, drift, stale snapshots and distractor ids), one scripted agent, five sources of guidance. The oracle judges every call before it is made. Same seed, same bytes, every run.

| guidance | tasks completed | invalid calls per task | vs raw tools [95% CI] |
| --- | --- | --- | --- |
| raw MCP tools | 0.85 | 2.19 |  |
| AALpy L\* automaton, same budget | 1.00 | 1.17 | -1.02 [-1.20, -0.85] |
| **mcpgraphy, passive (the proxy)** | **1.00** | **0.71** | **-1.47 [-1.66, -1.28]** |
| mcpgraphy, active probing | 1.00 | 0.67 | -1.52 [-1.74, -1.32] |
| oracle (knows the hidden state) | 1.00 | 0.00 |  |

Three things in that table decided the design:

- **Passive gets 97% of the benefit.** Learning from the agent's own calls, with zero extra requests, lands within 0.04 calls per task of a learner that gets to probe and reset. So the proxy only watches.
- **Precision 1.00.** Across 255 held-out checks on fresh resources, no edge the graph marked as supported was wrong. Coverage is honest the other way: what the agent never tried stays `UNKNOWN`.
- **Drift is caught, not hidden.** When the server changes behavior under a learned graph, suppressed-but-valid calls show up in the audit, and 30 retest calls clear them. No learned graph suppressed a valid call on a server it had actually seen.

Full tables, the ablations, and the method are in [docs/BENCHMARK.md](https://github.com/hemanth1999k/mcpgraphy/blob/main/docs/BENCHMARK.md). Rerun it yourself in about 20 seconds: `mcpgraphy benchmark run --suite stateful-v1 --seed 42`.

### With a real LLM agent

Same 200 jobs, same oracle, GPT-5.4-mini making the tool calls itself. Raw tools, versus the same tools behind the proxy as it ships: the block gate plus one line from the graph on every read, every action result and every refusal.

[GPT-5.4-mini on 200 jobs, raw tools vs behind MCPgraphy: jobs finished 74% vs 99%, false success claims 10 vs 0, rejected calls per job 1.03 vs 0.43, tokens per job done 5,154 vs 4,799](https://raw.githubusercontent.com/hemanth1999k/mcpgraphy/main/docs/img/results.png)

**How a job is counted.** The agent gets a goal ("make this release PUBLISHED") and the server's tools. Each time it decides what to do next, that is one *model turn*, and the whole conversation so far is sent to the model again, which is where the tokens go. Each tool it invokes is a *tool call*; the oracle judges every mutating call before it runs, so a *rejected call* is one the server would refuse, and a *refused call* is one the proxy stopped first. A job ends when the agent says the goal is reached (checked against the server; a wrong claim is a *false success*), says it is unreachable, or runs out of steps. Everything below is per job, averaged over the 200.

| per job | raw tools | behind MCPgraphy |
| --- | --- | --- |
| jobs finished (of the achievable ones) | 74% | **99%** |
| unreachable jobs correctly declared unreachable | 86% | **100%** |
| false success claims (of 200) | 10 | **0** |
| tool calls | 3.46 | 3.08 |
| model turns | 4.46 | 4.22 |
| rejected calls (server would refuse) | 1.03 | **0.43** |
| refused calls (proxy stopped them) | 0 | 0.15 |
| valid calls wrongly blocked | 0 | 0 |
| tokens per job done | 5,154 | **4,799** |
| tokens per job attempted | 2,474 | 3,095 |
| cost per job done, list price | $0.0046 | **$0.0041** |

Measured start of job to end of job, the proxy finishes 129 jobs against 96 on the same kind of budget, so each finished job costs 7% fewer tokens, in fewer tool calls and fewer model turns. The one column raw wins is tokens per job *attempted*, and it wins it partly by quitting: on the unreachable jobs it archived a release it had been asked to make editable, then reported success.

[Where the tokens go per job attempted: raw tools spend 573 of 2,474 tokens on rejected calls; behind MCPgraphy 314 rejected, 104 refused, and the productive share doubles](https://raw.githubusercontent.com/hemanth1999k/mcpgraphy/main/docs/img/tokens.png)

Almost a quarter of raw's tokens go to turns that end in a call the server rejects. Behind MCPgraphy the agent spends its tokens on the work instead, and each turn carries about 60 more tokens for the graph line.

Every configuration we tried, on the same axes. Up is more jobs finished, left is cheaper per job attempted:

[Scatter of six configurations, tokens per job attempted against jobs finished: raw tools 2,474 tokens and 74%; block only 2,362 and 47%; block with a hint on refusal 3,206 and 95%; hint on reads only 4,513 and 97%; affordances as a separate tool 6,654 and 94%; shipped configuration 3,095 and 99%](https://raw.githubusercontent.com/hemanth1999k/mcpgraphy/main/docs/img/configurations.png)

Refusing calls without saying what else is possible is the cheapest point and the worst one; a separate affordances tool is the most expensive; the shipped configuration sits at the top of the cluster. The per-category breakdown, which shows exactly where a visible-state graph cannot help (hidden state, stale snapshots, a nondeterministic flag), is in [docs/BENCHMARK.md](https://github.com/hemanth1999k/mcpgraphy/blob/main/docs/BENCHMARK.md). Rerun with `OPENAI_API_KEY=... mcpgraphy benchmark llm` for about a dollar.

## What you get

The agent sees the downstream tools plus four of mcpgraphy's own:

| tool | what it answers |
| --- | --- |
| `mcpgraphy_affordances(resource_ref, goal?)` | for this resource, right now: which tools are candidates, need approval, are not supported from this state, or are untested |
| `mcpgraphy_explain(offer_id)` | the guard, the observations for and against, the counterexamples, what was never tried |
| `mcpgraphy_graph(format)` | the whole learned graph as JSON (authoritative) or Mermaid |
| `mcpgraphy_status()` | calls recorded, warnings, blocks, current model version |

Every read of a resource, and the result of every action on it, comes back with one line from the graph, so the agent learns the state's affordances and the routes out of it without an extra turn:

```
mcpgraphy [status=DRAFT, tests_passed=False] ok: run_tests -> tests_passed becomes true | no: archive_release; publish_release | to tests_passed=True: run_tests
```

Refusals carry the same line, and every blocked or warned call carries its reason, for example `observed to fail from state [exists=False] (2 observations)`. Turn the hints off with `--no-hints`. The log, the graph and every decision persist in a SQLite file, so a restarted proxy keeps what it learned and you can audit what it did.

## Usage

### 1. Describe how to observe a resource

One JSON file per server. It names the read-only tool that reads a resource back and the parameter that identifies the resource. Everything else is optional.

```
{
  "server_id": "filesystem",
  "resource_class": "file",
  "observation_tool": "get_file_info",
  "id_param": "path",
  "id_param_aliases": ["source"],
  "observation_format": "kv_text",
  "features": ["isFile", "isDirectory"],
  "effect_classes": {"edit_file": "MUTATING", "create_directory": "MUTATING"},
  "approval_required": ["write_file", "move_file"]
}
```

| field | meaning |
| --- | --- |
| `observation_tool`, `id_param` | how to read a resource back and which argument names it |
| `id_param_aliases` | other argument names that carry the id (`source` for `move_file`) |
| `observation_format` | `fields` for structured results (default), `kv_text` for `key: value` text |
| `features` | which fields count as state; omitted, booleans and enum-like strings are detected |
| `effect_classes` | `READ_ONLY`, `MUTATING` or `DESTRUCTIVE` per tool; destructive tools need approval in `block` mode |
| `approval_required` | tools that need `--approve` in `block` mode regardless of evidence |

Ready-made adapters: [filesystem](https://github.com/hemanth1999k/mcpgraphy/blob/main/examples/adapters/filesystem.json), plus the two bundled simulators.

### 2. Run the proxy

```
# stdio downstream
mcpgraphy wrap --adapter adapter.json --policy warn -- <server command and args>

# Streamable HTTP downstream
mcpgraphy wrap --adapter adapter.json 
hemanth2k10
🟧 echo.github ⭐The repository is the original source: its author presents MCPgraphy as “a proxy for any MCP server that learns, from the agent's own calls,Hemanth Dhanasekaran (@hemanth1999k)——

Interpretation history

Decision trace