Skip to content

MCP pinning and the MCP proxy

OpenMoat pins each MCP server's definition, and with openmoat mcp wrap each tool's description and schemas too: a new or changed server or tool waits until you accept it in your own terminal.

When you need it

Try it

openmoat mcp wrap github
OpenMoat did not start MCP server `github`: MCP server `github` in ~/.claude.json changed
    command: "npx" → "sh"; OpenMoat starts it only once a person has reviewed it: run
    `openmoat mcp accept github` in a terminal

What the agent's MCP list shows when a wrapped server's definition changed. Run openmoat mcp accept github, then restart the agent's session.

Change it

openmoat mcp accept <server> after reading each tool; openmoat mcp unwrap <server> puts the configuration back; an mcp rule allows tools by name.

What it does not stop

Prompts, resources and tool results are not pinned. Remote (HTTP) servers, Claude Code plugin servers and managed MCP settings do not go through the proxy. All its limits

Protects against an MCP server nobody reviewed (one a cloned repository’s .mcp.json adds, or a definition a git pull changes), a tool whose description changes after you accepted it, and MCP calls that read secrets or reach unlisted hosts.

An MCP server runs outside every sandbox, with your permissions, whatever its definition says. A postinstall script, a git pull or a cloned repository can change a definition or add one, and a server you accepted can later change what a tool’s description tells the model. OpenMoat checks every MCP tool call against your policy, and also holds back servers and tools that nobody has reviewed.

MCP calls are checked by tool name and by what their arguments name: mcp__filesystem__read_file {path: ~/.aws/credentials} is denied by secrets-paths although safe-mcp allows the tool, and a url argument is checked like any host.

A cloned repository’s .mcp.json adds a server. Its tool calls are denied, and the reason ends with what to run:

Terminal window
moat: deny [mcp-server-changed] — …; a person must review it: run `openmoat mcp accept <server>` in a terminal

openmoat doctor shows the same: mcp servers ✗ …; `openmoat mcp accept` shows it and asks.

openmoat init pins each MCP server definition the agents read:

Agent Your file The project’s file
Claude Code ~/.claude.json .mcp.json
Codex config.toml .codex/config.toml
Cursor mcp.json .cursor/mcp.json
OpenClaw mcp.servers in openclaw.json
GitHub Copilot CLI ~/.copilot/mcp-config.json .mcp.json, .github/mcp.json
pi ~/.pi/agent/mcp.json .pi/mcp.json
Gemini CLI mcpServers in settings.json .gemini/settings.json

When a definition changes, or a server is added since (a cloned repository’s .mcp.json included), the tool calls of that server are denied with rule mcp-server-changed. The reason names what changed. Other servers and tools keep working, and openmoat doctor and openmoat status report it.

openmoat init pins what it finds the first time. Run again without a terminal (from a script), it pins nothing new: changed and new servers are listed and left for openmoat mcp accept.

  1. Review the change, in your own terminal

    Terminal window
    openmoat mcp accept <server>

    It shows the change key by key, never the value of an env or header entry, and asks [y/N]. Escape sequences and invisible characters in what a server sends are shown as ?, so a tool description cannot redraw what you are asked to accept.

  2. Ask the agent to try again

    The server’s tools work again once you accept.

A removed server holds nothing back. A settings file that no longer parses holds back every MCP call of that agent, since it hides which servers it starts.

The agent’s own writes to these files need review first (runs-later), since the agent starts what they name in its next session.

Pinning a definition does not see a server that changes a tool’s description later. For that, run a stdio server through openmoat mcp proxy (openmoat mcp wrap <server>, or openmoat init --mcp-proxy for every server): it pins each tool and holds a changed or new one until you run openmoat mcp accept <server>. openmoat mcp wrap <server> --sandbox also runs the server under openmoat run, and openmoat mcp unwrap <server> undoes it. Every step: Tool pinning and the MCP proxy.

From 0.12.0 the same openmoat mcp proxy is a gateway: a wrapped server receives a call only when the policy does not deny it as the server receives it and the agent’s hook decided exactly that call, the same tool and arguments, within the hour. A call nobody checked, from a script or an agent without its hook, is refused with error -32001 and rule mcp-unattributed, and a server can no longer answer a call the proxy refused. Every step: The MCP gateway.

A browser MCP call that only opens a page (Playwright browser_navigate, Chrome DevTools navigate_page, Puppeteer, Claude in Chrome, Browserbase) is checked like WebFetch from 0.12.0: it goes to your agent’s own prompt instead of being denied for every unlisted host, a file: URL is a read of the file, and a long encoded value in a URL after the session read a secret is denied. Every verdict: Browser page opens.

openmoat mcp accept, openmoat mcp wrap and openmoat mcp unwrap are denied to agents (kernel-self), terminal wrappers included, and refuse to run when an agent started them.

  • First sight is not trusted. openmoat mcp proxy holds back a new server’s tools until you accept them. To pin what a server lists the first time instead, set mcp: { trust_first_sight: true } in the policy; openmoat policy lint warns about it.
  • Not pinned: prompts, resources and tool results.
  • Upgrading to 0.9.0 pins more fields of each tool, so every tool a wrapped server listed is held once after the upgrade, even unchanged. Run openmoat mcp accept once.
  • Not covered by the proxy: remote (HTTP) servers, Claude Code plugin servers and managed MCP settings.
  • A wrapped server answers agents only from 0.12.0: a script that used it directly gets mcp-unattributed (The MCP gateway).
  • One name, every project. A changed server in one project of ~/.claude.json also holds back a server with the same name in another project, until you accept it.
Command What it does Example
openmoat mcp accept [<server>] Show a changed or new server, or the tools the proxy holds, key by key, and ask. Terminal only openmoat mcp accept github
openmoat mcp wrap [<server>…] [--sandbox] [--dry-run] Run stdio servers through openmoat mcp proxy, which pins each tool. Terminal only openmoat mcp wrap github --dry-run
openmoat mcp unwrap [<server>…] Point them back at their own command. Terminal only openmoat mcp unwrap github
openmoat init --mcp-proxy Wrap every stdio server at setup openmoat init --mcp-proxy
openmoat policy check "<tool>" --kind mcp The verdict for an MCP tool name openmoat policy check "mcp__github__create_issue" --kind mcp
openmoat mcp proxy --server <name> [--sandbox] -- <command> The wrapper openmoat mcp wrap writes; the agent starts it, you do not. From 0.12.0 it is also the gateway: it passes only calls the hook decided
allow:
- id: my-mcp-reads
mcp: ["mcp__docs__search*"] # tool names, as mcp__<server>__<tool>
mcp:
trust_first_sight: false # default: the proxy holds a new server's tools until you accept them
  • A changed server still starts, when the agent starts its session; only its tool calls are refused.
  • Not pinned: prompts, resources and tool results. Not covered by the proxy: remote (HTTP) servers, Claude Code plugin servers and managed MCP settings.
  • An MCP server runs outside every sandbox unless you wrap it with --sandbox or run the agent under openmoat run.

More in Limits. The design and its limits: ADR-026, ADR-045.