The firewall for AI agents. Open-source policy enforcement for MCP. Website: policylayer.com Intercept is a deterministic enforcement proxy for the Model Context Protocol (MCP). It sits between an AI agent and an MCP server, evaluating every tools/call request against YAML-defined policies. Violating calls are blocked at the transport layer before reaching the upstream server. MCP gives AI agents
Add this skill
npx mdskills install policylayer/interceptComprehensive policy enforcement proxy with excellent documentation and practical examples
1# Intercept23[](https://www.npmjs.com/package/@policylayer/intercept) [](https://github.com/PolicyLayer/Intercept/blob/main/LICENSE) [](https://github.com/PolicyLayer/Intercept/commits/main) [](https://nodejs.org/)45**The firewall for AI agents. Open-source policy enforcement for MCP.**67Website: [policylayer.com](https://policylayer.com)89Intercept is a deterministic enforcement proxy for the Model Context Protocol (MCP). It sits between an AI agent and an MCP server, evaluating every `tools/call` request against YAML-defined policies. Violating calls are blocked at the transport layer before reaching the upstream server.1011```12┌──────────┐ ┌───────────┐ ┌────────────┐13│ LLM/AI │──────>│ Intercept │──────>│ MCP Server │14│ Client │<──────│ (proxy) │<──────│ (upstream) │15└──────────┘ └───────────┘ └────────────┘16 │17 ┌────┴────┐18 │ Policy │19 │ Engine │20 └────┬────┘21 ┌────┴────┐22 │ State │23 │ Store │24 └─────────┘25```2627## Why2829MCP gives AI agents access to every tool on a server with no access control. There are no rate limits, no spending caps, and no audit trail out of the box. Prompt-based guardrails live inside the model context and can be bypassed — the agent can rewrite, ignore, or reason around them. Intercept enforces policy at the transport layer, below the model. The agent never sees the rules and cannot circumvent them.3031## What it does3233- **Block tool calls** — deny dangerous tools unconditionally (e.g. `delete_repository`)34- **Validate arguments** — enforce constraints on tool arguments (`amount <= 500`, `currency in [usd, eur]`)35- **Rate limit** — cap calls per minute, hour, or day with `rate_limit: 5/hour` shorthand36- **Track spend** — stateful counters with dynamic increments (e.g. sum `args.amount` across calls)37- **Hide tools** — strip tools from `tools/list` so the agent never sees them, saving context window tokens38- **Default deny** — allowlist mode where only explicitly listed tools are permitted39- **Hot reload** — edit the policy file while running; changes apply immediately without restart40- **Validate policies** — `intercept validate -c policy.yaml` catches errors before deployment4142## Install4344**npx:**4546```sh47npx -y @policylayer/intercept -c policy.yaml --upstream https://mcp.stripe.com --header "Authorization: Bearer sk_live_..."48```4950**npm:**5152```sh53npm install -g @policylayer/intercept54```5556**Go:**5758```sh59go install github.com/policylayer/intercept@latest60```6162**Pre-built binaries:**6364Download from [GitHub Releases](https://github.com/policylayer/intercept/releases) and place the binary on your PATH.6566## Quick start6768**1. Generate a policy scaffold from a running MCP server:**6970```sh71intercept scan -o policy.yaml -- npx -y @modelcontextprotocol/server-stripe72```7374This connects to the server, discovers all available tools, and writes a commented YAML file listing each tool with its parameters.7576**2. Edit the policy to add rules:**7778```yaml79version: "1"80description: "Stripe MCP server policies"8182hide:83 - delete_customer84 - delete_product85 - delete_invoice8687tools:88 create_charge:89 rules:90 - name: "max single charge"91 conditions:92 - path: "args.amount"93 op: "lte"94 value: 5000095 on_deny: "Single charge cannot exceed $500.00"9697 - name: "daily spend cap"98 conditions:99 - path: "state.create_charge.daily_spend"100 op: "lte"101 value: 1000000102 on_deny: "Daily spending cap of $10,000.00 reached"103 state:104 counter: "daily_spend"105 window: "day"106 increment_from: "args.amount"107108 - name: "allowed currencies"109 conditions:110 - path: "args.currency"111 op: "in"112 value: ["usd", "eur"]113 on_deny: "Only USD and EUR charges are permitted"114115 create_refund:116 rules:117 - name: "refund limit"118 rate_limit: 10/day119 on_deny: "Daily refund limit (10) reached"120```121122**3. Run the proxy:**123124```sh125intercept -c policy.yaml --upstream https://mcp.stripe.com --header "Authorization: Bearer sk_live_..."126```127128Intercept proxies all MCP traffic and enforces your policy on every tool call. Hidden tools are stripped from the agent's view entirely.129130## Example policies131132The `policies/` directory contains ready-made policy scaffolds for 43 popular MCP servers including GitHub, Stripe, AWS, Notion, Slack, and more. Each file lists every tool with its description, grouped by category (Read, Write, Execute, Financial, Destructive).133134Copy one as a starting point:135136```sh137cp policies/stripe.yaml policy.yaml138# edit to add your rules, then:139intercept -c policy.yaml --upstream https://mcp.stripe.com140```141142Browse all policies → [policies/](policies/)143144## MCP client integration145146To use Intercept with Claude Code (or any MCP client that reads `.mcp.json`), point the server command at Intercept:147148```json149{150 "mcpServers": {151 "github": {152 "command": "intercept",153 "args": [154 "-c", "/path/to/policy.yaml",155 "--",156 "npx", "-y", "@modelcontextprotocol/server-github"157 ],158 "env": {159 "GITHUB_PERSONAL_ACCESS_TOKEN": "..."160 }161 }162 }163}164```165166For remote HTTP servers, use `--upstream` instead of a command:167168```json169{170 "mcpServers": {171 "stripe": {172 "command": "intercept",173 "args": [174 "-c", "/path/to/policy.yaml",175 "--upstream", "https://mcp.stripe.com",176 "--header", "Authorization: Bearer tok"177 ]178 }179 }180}181```182183## State backends184185Rate limits and counters persist across restarts. SQLite is the default (zero config). Redis is supported for multi-instance deployments:186187```sh188intercept -c policy.yaml --state-dsn redis://localhost:6379 --upstream https://mcp.stripe.com189```190191## Documentation192193- [CLI reference](USAGE.md): all commands, flags, transport modes, state backends, event logging194- [Policy reference](POLICY.md): YAML format, conditions, operators, stateful counters, examples195- [Example policies](policies/): ready-made scaffolds for 43 MCP servers196197## Contributing198199Contributions welcome — open an issue to discuss what you'd like to change.200201## License202203[Apache 2.0](LICENSE)204
Full transparency — inspect the skill content before installing.