{"slug": "read-here-act-there-one-command-to-stop-it-on-any-mcp-server", "title": "Read here, act there: one command to stop it on any MCP server", "summary": "A developer built CleiMesh, an open-source wrapper that enforces cross-server taint tracking for MCP agents, refusing write tools once an agent has read untrusted content from a different server. In a containerized test with the official fetch and filesystem servers, a scripted agent that fetched a page carrying a hidden instruction was blocked from writing the leaked secret, with the refusal logged as a verifiable receipt. The developer also fixed trust-boundary flaws found in review — token reuse across servers, an allowance cap reset on client restart, and IPv6 forms bypassing private-address checks — and credited a reader for spotting a redirect hole in URL allowlisting.", "body_md": "The attacks on AI agents this year share one shape. The agent **reads** something an attacker wrote — a mail, a web page, a document — and then **acts**: sends, writes, fetches a URL with your data in it. I wrote about that pattern [last week](https://dev.to/cleiton_augusto_/stop-the-action-not-the-injection-14jo): you won't win the injection fight, so put the control on the action, outside the model.\n\nWith MCP, the read and the act usually happen in *different servers*. The agent fetches a page through a fetch server and writes through a filesystem server. Each server sees one harmless call. No single server can stop the second step, because none of them saw the first.\n\n[CleiMesh](https://github.com/cleitonaugusto/cleimesh) now does this in one command per server.\n\n```\ncleimesh mcp add fetch --taints fetch -- uvx mcp-server-fetch\ncleimesh mcp add fs --clean-only write_file --clean-only edit_file \\\n  -- npx -y @modelcontextprotocol/server-filesystem ~/work\n```\n\nEach `mcp add` creates the keys if they're missing, asks the server which tools it has, issues a signed token for exactly those, and registers the result with Claude Code for every project (`--print` gives you the JSON for Cursor and other clients). Every server you add runs behind **one** `cleimesh-mcp` entry: one enforcement point, one receipt log, and one view of what the agent has read.\n\nBefore it grants anything, it shows what each tool tells the model, and it refuses a definition hiding invisible characters (zero-width, Unicode tag characters) that the person approving can't see. It also pins each tool's definition. If a server later changes a tool you approved (a \"rug pull\": a new description that instructs the model, a wider schema), the wrapper stops offering it until you run `mcp add` again.\n\n`--taints fetch` says: whatever comes back from this tool is untrusted, and the agent that received it is now tainted. `--clean-only write_file` says: this tool acts on the world, so refuse it while the agent is tainted, until a human clears it.\n\nHere it is with the official fetch and filesystem servers, unmodified, in a container. A scripted agent (no model; it does what an injected one would) fetches release notes carrying a hidden instruction, reads a secret, and tries to write it where the instruction says:\n\n``` php\n1. write_file notes.txt (clean)    -> ok\n2. fetch the release-notes page    -> ok   (the page carries the injection)\n3. read_text_file secrets.txt      -> ok\n4. write_file leak.txt (injected)  -> REFUSED: holder ... received untrusted content\n```\n\nThe filesystem server never saw the page; the wrapper in front of both servers did, and refused the write. `cleimesh taint list` names the receipt that tainted the agent; `cleimesh audit verify` checks all seven receipts. The [Dockerfile and full transcript](https://github.com/cleitonaugusto/cleimesh/tree/main/examples/mcp-add) are in the repo.\n\nStep 3 is allowed on purpose: taint stops the *action* that would leak the secret, not the read. Reading is what agents are for.\n\nI found the cross-server case by running exactly this test before writing this post. My first version gave each wrapped server its own log, so the taint stayed in the fetch server and the write went through. A control you haven't attacked yourself is a hope.\n\nSo before shipping I also reviewed the trust boundaries, and fixed what that turned up: a hand-edited server list could call one server under another server's looser token, the spending cap of an allowance reset whenever the MCP client restarted it, and a few IPv6 forms that embed a private address passed as public. The [threat model](https://github.com/cleitonaugusto/cleimesh/blob/main/docs/threat-model.md) records them. That review was mine; an outside one is still to come.\n\nA reader, [komopdf](https://dev.to/komopdf/comment/3lfec), pointed out a hole in the earlier version: an allowlist that checks the URL argument passes a granted host that answers `302` to the attacker. They were right. Now a tool reaches the network only through the host, which follows every redirect itself, re-checks every hop against the signed grant, pins the socket to the address it resolved (no DNS rebinding), and refuses private and link-local answers unless the grant says otherwise:\n\n``` bash\n$ cleimesh token issue <agent> --tool fetch_url --host 127.0.0.1:34185 --allow-private\n  agent> fetch_url http://127.0.0.1:34185/share?doc=q3\n         (granted API, answers 302 to the attacker with the key in the query)\n         ->  REFUSED: address 127.0.0.1:34531 is not a granted host\n  agent> fetch_url http://169.254.169.254/latest/meta-data/iam/\n         (cloud credentials)\n         ->  REFUSED: address 169.254.169.254:80 is not a granted host\n\nThe attacker's server saw 0 connections. 4 receipts record each hop, refused or not.\n```\n\nThat is `cleimesh demo redirect`, abridged; it runs from the binary, with both servers on localhost.\n\nThe token is an [Attenuating Agent Token](https://datatracker.ietf.org/doc/draft-niyikiza-oauth-attenuating-agent-tokens/): each delegation, human to agent to subagent, can only narrow it. CleiMesh is an independent implementation of draft -02 and reaches the expected verdict on **all 229 vectors** of the draft's conformance suite (54 permit, 175 deny). The receipts reproduce the test vectors of [draft-sahu-agent-action-receipts](https://datatracker.ietf.org/doc/draft-sahu-agent-action-receipts/) byte for byte, and the receipt log is an RFC 6962 Merkle tree: proving one receipt among a million takes 640 bytes and about 13 µs ([BENCHMARKS.md](https://github.com/cleitonaugusto/cleimesh/blob/main/BENCHMARKS.md)).\n\nFor tools that run in its WebAssembly sandbox, the token *is* the sandbox configuration, and each receipt carries the frozen clock and seeded randomness of the run: an auditor re-executes the call and checks the output byte for byte. Don't trust the receipt, replay it.\n\n`mcp add` without `--taints` or `--clean-only` grants every tool the server lists and marks none of them. Decide which tools bring content in (a file read can carry an injection as well as a web page) and which act.\n\n```\ncurl -fsSL https://github.com/cleitonaugusto/cleimesh/releases/latest/download/install.sh | sh\ncleimesh demo redirect\ncleimesh mcp add fetch --taints fetch -- uvx mcp-server-fetch\n```\n\nThen restart Claude Code and look at what the agent can call, and what it can't.\n\nWhat your agent reads can't decide what it does. Which MCP server would you put behind a token first? That decides what I test next.\n\n*Cleiton Augusto — [GitHub](https://github.com/cleitonaugusto/cleimesh)*", "url": "https://wpnews.pro/news/read-here-act-there-one-command-to-stop-it-on-any-mcp-server", "canonical_source": "https://dev.to/cleiton_augusto_/read-here-act-there-one-command-to-stop-it-on-any-mcp-server-43a6", "published_at": "2026-11-24 23:32:46+00:00", "updated_at": "2026-11-24 23:44:20.886163+00:00", "lang": "en", "topics": ["ai-agents", "ai-safety", "agent-protocols", "ai-tools"], "entities": ["CleiMesh", "Model Context Protocol", "Claude Code", "Cursor", "komopdf"], "also_reported_by": [], "takeaway": "Wrapping every MCP server behind one enforcement point lets a taint from a fetch server block write tools on a separate filesystem server, so an injected page cannot trigger a leak the individual servers never see.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/read-here-act-there-one-command-to-stop-it-on-any-mcp-server", "markdown": "https://wpnews.pro/news/read-here-act-there-one-command-to-stop-it-on-any-mcp-server.md", "text": "https://wpnews.pro/news/read-here-act-there-one-command-to-stop-it-on-any-mcp-server.txt", "jsonld": "https://wpnews.pro/news/read-here-act-there-one-command-to-stop-it-on-any-mcp-server.jsonld"}}