Repository navigation
Description
The gap
Pre-tool-use blocking covers two agents today (Claude Code, Cursor). Most of the remaining eleven cannot be hooked natively -- but many of them speak MCP. Their MCP tool calls can route through a local, Chock-governed proxy that evaluates each call against the repo's compiled gates before forwarding it.
This is also the enforcement vehicle for the Agent Plugins open standard: that format packages only skills and MCP servers, so today our agent-plugins tree is advisory-only. A gateway shipped as the package's MCP server upgrades the open format to carry deterministic enforcement -- agent-agnostically, without waiting for the spec to grow a hook API.
Naming: mcp-gateway, not gateway
Surface.GATEWAY already exists in compile/surfaces.py, reserved in docs/enforcement-surfaces.md for budget/egress backstop controls. This surface is a different thing: call it mcp-gateway. (Alternative: merge the two reservations -- decide before P3b, not after.)
Honest scope -- what actually rises
The gateway governs MCP-routed tool calls only. The agent's native tools (Copilot's shell, Gemini's file edits) never cross it. Consequences:
- Shell-text guards (block-destructive-commands, block-no-verify, protect-agent-config) do NOT rise for agents without native hooks. Claiming otherwise fails the do-not-claim list.
- What rises: policies expressible as MCP-call predicates -- file writes through MCP filesystem servers, network egress through fetch-type servers, tool-scope restriction, parameter inspection on MCP-backed databases/APIs.
- First deliverable is therefore a gate-kind x surface mapping: which compiled gate kinds can honestly bind at
mcp-gateway. No emitter work before that table exists. - Per-package claim vocabulary: enforced for MCP tool traffic, advisory for native tools -- stated in every emitted description, same convention as the Cursor caveat.
Two shapes, only one is enforcement
- A policy packaged as an MCP tool the agent may call (
verify_compliance) is advisory-plus: the agent can decline to call it. Not this issue. - A gateway: the client's MCP config lists the proxy as its server; the proxy wraps the real downstream servers (aggregator -- one proxy, many upstreams) and vetoes calls against compiled gates. That is the surface.
Witness rule (coverage honesty)
enforced requires BOTH: the gateway verifiably installed AND the committed MCP client config routes through it exclusively -- a config listing other servers alongside the gateway has an ungoverned route and stays advisory. User-level config outside the repo can still add direct servers; that boundary is stated, same as the git-hooks arm-on-clone boundary.
Fail posture
A stdio proxy spawned by the client fails closed by nature: proxy dead means MCP calls error. First surface where fail-closed comes free -- document it as such, plus the availability consequence.
Implementation notes (P3b)
- Stdlib-only Python, vendored like the gate runner; reuses the compiled gate evaluators -- no fresh string matching (position-blind token parsing is exactly catalog#11's bug class).
- JSON-RPC interception over stdin/stdout; line buffering (
bufsize=1) + explicit flush, or the pipe deadlocks. - Aggregator from day one: the exclusivity witness requires wrapping multiple downstream servers.
Phasing
- P3a (spec, no code): settle the name; audit which of the 13 agents are MCP-capable with project-scoped MCP config (the witnessable slice); write the gate-kind mapping.
- P3b: stdio proxy MVP governing 2-3 honest gate kinds, evals included.
- P3c: per-agent config emitters + witnesses; tiers rise agent-by-agent. Agent-plugins packages gain an
mcpServersgateway entry; marketplace descriptions carry the split claim.
Distribution follow-on
Once shipped, submit Chock to the MCP ecosystem registries/directories as governance middleware -- a channel the launch plan does not yet cover.
Activity
jothimani-rajendran commentedon Aug 23, 2026
Status update (2026-08-23): P3b shipped, P3c open for contribution
P3b landed in #54: the stdio proxy (
chock gateway run --repo . -- <server command>), theegress_allowlistgate kind, the emitter (opt-in viatool_useinon), fail-closed throughout, and the trust-model + best-effort-scope docs. The surface works end-to-end today if you wire your MCP client config at it by hand.Deliberately dormant until adopted: no existing policy opts in, no coverage is credited (the surface is absent from
SURFACE_AGENTSby design), and nothing changes for any user who does not explicitly configure it.Maintainer focus is elsewhere for now — the demand evidence (documented agent data-loss incidents all flow through native tools, never MCP; MCP gateways are an enterprise category already served by mcp-firewall / Enkrypt / Docker) points at native pre-tool-use hooks (#48) as the higher-value next build for this project's users. The gateway stays shipped and supported.
P3c is the contributor entry point. Scope, in order of value:
chock syncwrites/patches the client's MCP config to route declared servers through the gateway. Paths per client (from the P3a capability audit) — claude project config, cursor project config, copilot (trust-gated), codex config.toml (trust-gated), grok config.toml, gemini settings (+ repo-settable allow list), tabnine project config, vscode workspace config.Start from
src/chock/gateway/(+ the gateway emitter undercompile/emitters/); the honesty rules that shaped P3b are in the module docstrings anddocs/enforcement-surfaces.md. Comment here to claim it (CONTRIBUTING.md: we assign so no one double-works).Merge pull request #54 from open-coder-ai/feat/mcp-gateway