
TL;DR
Belay, Claude Code built-in guards, Codex CLI sandboxing, and MCP proxy patterns compared - how to protect your system from destructive commands, secret leaks, and prompt injection in AI coding agents.
Direct answer
Belay, Claude Code built-in guards, Codex CLI sandboxing, and MCP proxy patterns compared - how to protect your system from destructive commands, secret leaks, and prompt injection in AI coding agents.
Best for
Developers comparing real tool tradeoffs before choosing a stack.
Covers
Verdict, tradeoffs, pricing signals, workflow fit, and related alternatives.
Your AI coding agent has shell access, file system permissions, and MCP tool reach. One prompt injection in a GitHub issue, one hallucinated rm -rf, one MCP tool response with embedded instructions -- and your .env is in a stranger's webhook. As agents get more powerful, the safety layer between them and your system has become a first-class architectural decision.
There is no single tool that solves all agent safety. Different tools protect different boundaries. This comparison covers four approaches to coding agent containment, from purpose-built firewalls to built-in platform controls.
| Tool | Type | Official Resource | License |
|---|---|---|---|
| Belay | Agent firewall (tool-call gating) | belay.secblok.io | AGPL-3.0 (Community) / Commercial |
| Claude Code | Built-in hooks + allowlists | docs.anthropic.com/claude-code | Proprietary (included with Claude) |
| Codex CLI | Docker sandbox execution | developers.openai.com/codex | Proprietary |
| MCP Proxy Pattern | Tool-call interception | modelcontextprotocol.io | MIT (protocol) |
All verified July 28, 2026 against official docs and repos.
Before comparing tools, here is what they are defending against:
rm -rf /, dd if=/dev/zero of=/dev/sda, recursive chmod, compound chains, heredoc-exec patterns..env, API keys, SSH keys, database credentials read and sent to an external endpoint.Not every tool covers all of these. The table below maps coverage.
| Threat | Belay | Claude Code hooks | Codex CLI | MCP proxy |
|---|---|---|---|---|
| Destructive commands | Yes | Partial (allowlists) | Yes (container boundary) | No |
| Secret exfiltration | Yes | No | Partial (container boundary) | No |
| Prompt injection in tool responses | Yes (MCP proxy) | No | No | Partial (content scanning) |
| Supply-chain (skill swapping) | Yes (hash-gated trust) | No | No | No |
| MCP tool abuse | Yes (MCP proxy gating) | No | No | Yes (gate per tool) |
| Reverse shells | Yes (egress rules) | No | Yes (container boundary) | No |
Belay launched July 27, 2026 as an open-source, local-first security layer for AI coding agents. It sits at the agent's tool-call boundary and gates every command, file read, and MCP call deterministically in under 100ms -- no LLM in the decision path, no cloud round-trip.
The architecture is a daemon with native hooks for 11 agents (Claude Code, Codex, Cursor, Hermes, OpenClaw, Gemini CLI, Goose, Cline, Roo, Antigravity, opencode) and an MCP proxy for wrapping any MCP server. Rules are tagged against the OWASP Top 10 for Agentic Applications, OWASP LLM Top 10, and MITRE ATLAS frameworks.
Key differentiators:
evidence build / evidence verify.Belay is open-core: Community edition is AGPL-3.0 and fully local. Enterprise adds fleet management, SSO, and centralized policy.
Newsletter
Get the weekly deep dive
Tutorials on Claude Code, AI agents, and dev tools, delivered free every week.
From the archive
Jul 28, 2026 • 8 min read
Jul 28, 2026 • 7 min read
Jul 28, 2026 • 9 min read
Jul 27, 2026 • 8 min read
Claude Code ships with native guardrails that do not require an external tool:
postToolUse hook can inspect tool output and trigger quality gates.These guards are effective within the Claude Code runtime but do not extend to other agents or MCP servers. They also rely on the agent respecting the constraints -- a jailbroken or prompt-injected Claude Code session could bypass policy files.
Codex CLI runs generated code inside a Docker container by default, providing a hardware-level boundary between the agent and your host system. This is effective against destructive commands and reverse shells, because the container has limited filesystem and network access.
The tradeoff is granularity: Docker is an all-or-nothing boundary. You cannot selectively allow a specific file read while denying secret egress from the same container. Codex CLI's approach works well for stateless code generation tasks but less well for workflows where the agent needs selective access to host resources, environment variables, or mounted directories.
For a full comparison of code-execution sandbox providers (E2B, Daytona, Modal, Cloudflare, Vercel), see the AI agent code sandbox comparison.
The Model Context Protocol (MCP) proxy pattern intercepts tools/call requests before they reach the target MCP server. A proxy can validate parameters, redact sensitive content from responses, and deny calls that match risk patterns.
This pattern is protocol-level and agent-agnostic: any MCP-speaking agent is subject to the same gating. Belay ships a dedicated mcp-proxy that wraps any MCP server with this gating, including scanning tool responses for embedded injection markers.
The limitation is scope: an MCP proxy only protects MCP tool calls, not direct shell commands or file operations the agent performs outside MCP.
Use Belay when you run multiple coding agents and want a unified security layer across all of them, or when your threat model includes secret exfiltration, supply-chain skill attacks, and MCP tool abuse. Belay provides the broadest coverage in a single tool.
Use Claude Code hooks when you are Claude Code-only and want lightweight tool constraints without a separate daemon. The hook system is zero-install if you already use Claude Code, but it does not cover the threats that Belay's rule catalog addresses (secrets, supply-chain, MCP injection).
Use Codex CLI sandboxing when your primary concern is destructive commands during code generation and you do not need selective access control within the sandbox. Docker boundaries are strong but coarse.
Use MCP proxy when you are building custom MCP servers and want protocol-level protection for their tool calls. It composes well with Belay (Belay includes its own MCP proxy) or as a standalone pattern for teams building their own MCP infrastructure.
A pragmatic safety stack for teams running multiple agents:
This layered approach means a failure in one safety mechanism is caught by another -- defense in depth for the agent runtime.
Belay is an open-source, local-first security layer that gates every tool call an AI coding agent makes. It blocks destructive commands, secret leaks, and prompt injection at the tool-call boundary using deterministic rules -- no LLM in the decision path, no cloud dependency.
Yes. Claude Code ships with subagent tool allowlists and denylists, hook lifecycle events for pre/post tool validation, and CLAUDE.md policy files. These guards are effective within the Claude Code runtime but do not extend to other agents or MCP servers.
Codex CLI runs generated code inside a Docker container by default, providing a hardware-level boundary. This is effective against destructive commands but less flexible for workflows that need selective host resource access.
An MCP proxy intercepts tools/call requests before they reach the target MCP server, allowing parameter validation, content redaction, and risk-based denial. It is agent-agnostic and works with any MCP-speaking agent.
Yes. The most robust setups use a layered approach: Belay for broad coverage, Claude Code tool allowlists for an additional policy layer, and Docker sandboxing for code execution. This provides defense in depth across different threat surfaces.
Belay supports 11 agents natively: Claude Code, Codex, Cursor, Hermes, OpenClaw, Gemini CLI, Goose, Cline, Roo, Antigravity, and opencode. It also provides an MCP proxy for wrapping any MCP server.
The Community edition is AGPL-3.0, local-first, and fully free. Enterprise edition adds fleet management, SSO, and centralized policy for teams that need it.
An MCP proxy only protects MCP tool calls. It does not cover direct shell commands, file operations outside MCP, or network egress that bypasses MCP. For full coverage, pair it with a broader safety layer like Belay.
Read next
A builder's guide to picking a code-execution sandbox for AI agents - E2B, Daytona, Modal, Cloudflare Sandbox, and Vercel Sandbox compared on isolation, latency, state, and pricing model.
7 min readAnthropic's Claude containment writeup points to the next security layer for coding agents: deterministic capability ledgers, not another approval prompt.
9 min readBefore an AI agent gets tools, files, APIs, MCP servers, or deployment access, decide what it can read, write, call, log, and roll back.
8 min readTechnical content at the intersection of AI and development. Building with AI agents, Claude Code, and modern dev tools - then showing you exactly how it works.
Anthropic's agentic coding CLI. Runs in your terminal, edits files autonomously, spawns sub-agents, and maintains memory...
View ToolOpenAI's coding agent for terminal, cloud, IDE, GitHub, Slack, and Linear workflows. Reads repos, edits files, runs comm...
View ToolOpen-source terminal agent runtime with approval modes, rollback snapshots, MCP servers, LSP diagnostics, and a headless...
View ToolCodeium's AI-native IDE. Cascade agent mode handles multi-file edits autonomously. Free tier with generous limits. Stron...
View ToolCompare AI coding agents on reproducible tasks with scored, shareable runs.
View AppSpec out AI agents, run them overnight, wake up to a verified GitHub repo.
View AppEvery coding agent in one window. Stop alt-tabbing between Claude, Codex, and Cursor.
View AppDeep comparison of the top AI agent frameworks - LangGraph, CrewAI, Mastra, CopilotKit, AutoGen, and Claude Code.
AI AgentsConfigure Claude Code for maximum productivity -- CLAUDE.md, sub-agents, MCP servers, and autonomous workflows.
AI AgentsWhat MCP servers are, how they work, and how to build your own in 5 minutes.
AI Agents
Build Anything with Vercel, the Agentic Infrastructure Stack Check out Vercel: https://vercel.plug.dev/cwBLgfW The video shows a behind-the-scenes walkthrough of how the creator rapidly builds and d...

Check out Clerk here: https://go.clerk.com/Bil2F6F As we approach the end of 2025, this video explores the monumental changes in coding over the past couple of years. Join me for a snapshot...

In this episode, we explore the newly released GPT-5 Codex by OpenAI, a specialized version of GPT-5 designed for agentic coding tasks. Codex offers advanced features, including enhanced code...

A builder's guide to picking a code-execution sandbox for AI agents - E2B, Daytona, Modal, Cloudflare Sandbox, and Verce...

Anthropic's Claude containment writeup points to the next security layer for coding agents: deterministic capability led...

Before an AI agent gets tools, files, APIs, MCP servers, or deployment access, decide what it can read, write, call, log...

A practical comparison of the four authentication platforms developers reach for when connecting AI agents to third-part...

CISA added the first AI agent building platform to its Known Exploited Vulnerabilities catalog. What the Langflow IDOR v...

AI coding agents become safer when permissions, logs, and rollback are designed as one system. Here is the operating loo...

New tutorials, open-source projects, and deep dives on coding agents - delivered weekly.