{"id":47464608,"url":"https://github.com/PolicyLayer/Intercept","last_synced_at":"2026-04-08T00:00:45.878Z","repository":{"id":341577996,"uuid":"1167836498","full_name":"PolicyLayer/Intercept","owner":"PolicyLayer","description":"The control layer for AI agents. Intercept enforces hard limits on every MCP tool call before execution. Rate limits, spend caps, access controls. Open source.","archived":false,"fork":false,"pushed_at":"2026-04-05T13:34:03.000Z","size":1889,"stargazers_count":24,"open_issues_count":0,"forks_count":4,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-05T15:22:18.416Z","etag":null,"topics":["agent-framework","agentic-ai","agentic-workflow","ai-agents","ai-governance","ai-safety","claude","control-plane","golang","guardrails","llm-tools","mcp","mcp-proxy","mcp-server","model-context-protocol","openai","policy-engine","proxy-server","rate-limiting"],"latest_commit_sha":null,"homepage":"https://policylayer.com","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PolicyLayer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-26T18:30:23.000Z","updated_at":"2026-04-05T13:34:06.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/PolicyLayer/Intercept","commit_stats":null,"previous_names":["policylayer/intercept"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/PolicyLayer/Intercept","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PolicyLayer%2FIntercept","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PolicyLayer%2FIntercept/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PolicyLayer%2FIntercept/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PolicyLayer%2FIntercept/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PolicyLayer","download_url":"https://codeload.github.com/PolicyLayer/Intercept/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PolicyLayer%2FIntercept/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31533824,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T16:28:08.000Z","status":"ssl_error","status_checked_at":"2026-04-07T16:28:06.951Z","response_time":105,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agent-framework","agentic-ai","agentic-workflow","ai-agents","ai-governance","ai-safety","claude","control-plane","golang","guardrails","llm-tools","mcp","mcp-proxy","mcp-server","model-context-protocol","openai","policy-engine","proxy-server","rate-limiting"],"created_at":"2026-03-24T15:00:23.573Z","updated_at":"2026-04-08T00:00:45.869Z","avatar_url":"https://github.com/PolicyLayer.png","language":"Go","readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\".github/assets/banner.svg\" alt=\"Intercept — The control layer for AI agents\" width=\"700\" /\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.npmjs.com/package/@policylayer/intercept\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/@policylayer/intercept.svg\" alt=\"npm version\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/PolicyLayer/Intercept/blob/main/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/badge/license-Apache%202.0-blue.svg\" alt=\"License\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/PolicyLayer/Intercept/commits/main\"\u003e\u003cimg src=\"https://img.shields.io/github/last-commit/PolicyLayer/Intercept.svg\" alt=\"GitHub last commit\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nIntercept is an open-source proxy between AI agents and MCP servers. It enforces YAML-defined policies on every tool call: rate limits, spend caps, access controls, argument validation, human-in-the-loop approval. The call passes, gets held for approval, or gets blocked.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\".github/assets/architecture.svg\" alt=\"How Intercept works\" width=\"700\" /\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"demo.gif\" alt=\"Intercept demo — scan, define policy, enforce\" width=\"700\" /\u003e\n\u003c/p\u003e\n\n## Try it in 30 seconds\n\nSee every tool your AI agent has access to, before adding any rules:\n\n```sh\nnpx -y @policylayer/intercept scan -- npx -y @modelcontextprotocol/server-github\n```\n\nConnects to the server, discovers all tools, and shows the full attack surface. Add a policy to lock it down.\n\n## Why Intercept, not system prompts?\n\n| | System prompt | Intercept |\n|---|---|---|\n| **Enforcement** | Probabilistic | Deterministic, blocked at transport layer |\n| **Bypassable** | Injection, reasoning, context overflow | Agent never sees the rules |\n| **Stateful** | No memory of previous calls | Counters, spend tracking, sliding windows |\n| **Auditable** | No structured log | Every decision logged (deny/approval includes reason) |\n| **Latency** | N/A | Sub-millisecond per evaluation (p95) |\n\nPrompts tell the agent what it should do. Intercept defines what it is allowed to do.\n\n## What it does\n\n- **Block tool calls.** Deny dangerous tools unconditionally (e.g. `delete_repository`)\n- **Validate arguments.** Enforce constraints on tool arguments (`amount \u003c= 500`, `currency in [usd, eur]`)\n- **Rate limit.** Cap calls per minute, hour, or day with `rate_limit: 5/hour` shorthand\n- **Track spend.** Stateful counters with dynamic increments (e.g. sum `args.amount` across calls)\n- **Enforce budgets on paid tools.** When an MCP server charges via MPP (-32042), Intercept reads the price, checks your spend policy, and blocks over-budget calls before any money moves\n- **Hide tools.** Strip tools from `tools/list` so the agent never sees them, saving context window tokens\n- **Require approval.** Hold tool calls for human approval via CLI or admin API (`--enable-admin-api`) before execution\n- **Idempotent enforcement.** Prevent duplicate actions from agent retries with `idempotency_window: 5m`\n- **Default deny.** Allowlist mode where only explicitly listed tools are permitted\n- **Hot reload.** Edit the policy file while running; changes apply immediately without restart\n- **Validate policies.** `intercept validate -c policy.yaml` catches errors before deployment\n\n## Real-world examples\n\n**It drained a $230,000 treasury in six minutes**\n\n```yaml\ncreate_refund:\n  rules:\n    - name: \"cap-refunds\"\n      rate_limit: \"10/day\"\n      on_deny: \"Daily refund limit reached\"\n```\n\n**It deleted a production config**\n\n```yaml\ndelete_file:\n  rules:\n    - name: \"block-delete\"\n      action: deny\n      on_deny: \"File deletion blocked by policy\"\n```\n\n**It provisioned infrastructure in a retry loop**\n\n```yaml\ncreate_resource:\n  rules:\n    - name: \"limit-resource-creation\"\n      rate_limit: \"10/hour\"\n      on_deny: \"Resource creation rate limit reached\"\n```\n\n**It issued a $4,200 refund without asking anyone**\n\n```yaml\ncreate_refund:\n  rules:\n    - name: \"large-refund-approval\"\n      action: require_approval\n      conditions:\n        - path: \"args.amount\"\n          op: \"gt\"\n          value: 100000\n      on_deny: \"Refunds over $1,000.00 require human approval\"\n      approval_timeout: \"30m\"\n```\n\n**It emailed 400,000 customers a test template**\n\n```yaml\nmessages_send:\n  rules:\n    - name: \"limit-sends\"\n      rate_limit: \"5/hour\"\n      on_deny: \"Email send rate limit reached\"\n```\n\n**It spent $800 on image generation overnight**\n\n```yaml\ngenerate_image:\n  rules:\n    - name: \"image-budget\"\n      spend:\n        per_call: 5.00\n        daily: 50.00\n```\n\n[349 ready-made policy templates](https://policylayer.com/policies)\n\n## Install\n\n```sh\nnpx -y @policylayer/intercept\n```\n\nOr install permanently:\n\n```sh\nnpm install -g @policylayer/intercept    # npm\ngo install github.com/policylayer/intercept@latest   # Go\n```\n\nPre-built binaries available on [GitHub Releases](https://github.com/policylayer/intercept/releases).\n\n## Quick start\n\n**1. Generate a policy scaffold from a running MCP server:**\n\n```sh\nintercept scan -o policy.yaml -- npx -y @modelcontextprotocol/server-stripe\n```\n\nConnects to the server, discovers all tools, and writes a commented YAML file listing each tool with its parameters.\n\n**2. Edit the policy to add rules:**\n\n```yaml\nversion: \"1\"\ndescription: \"Stripe MCP server policies\"\n\nhide:\n  - delete_customer\n  - delete_product\n  - delete_invoice\n\ntools:\n  create_charge:\n    rules:\n      - name: \"max single charge\"\n        conditions:\n          - path: \"args.amount\"\n            op: \"lte\"\n            value: 50000\n        on_deny: \"Single charge cannot exceed $500.00\"\n\n      - name: \"daily spend cap\"\n        conditions:\n          - path: \"state.create_charge.daily_spend\"\n            op: \"lte\"\n            value: 1000000\n        on_deny: \"Daily spending cap of $10,000.00 reached\"\n        state:\n          counter: \"daily_spend\"\n          window: \"day\"\n          increment_from: \"args.amount\"\n\n      - name: \"allowed currencies\"\n        conditions:\n          - path: \"args.currency\"\n            op: \"in\"\n            value: [\"usd\", \"eur\"]\n        on_deny: \"Only USD and EUR charges are permitted\"\n\n  create_refund:\n    rules:\n      - name: \"refund limit\"\n        rate_limit: 10/day\n        on_deny: \"Daily refund limit (10) reached\"\n\n  generate_report:\n    rules:\n      - name: \"report budget\"\n        spend:\n          per_call: 10.00\n          daily: 100.00\n```\n\n**3. Run the proxy:**\n\n```sh\nintercept -c policy.yaml --upstream https://mcp.stripe.com --header \"Authorization: Bearer sk_live_...\"\n```\n\nHidden tools are stripped from the agent's view. Everything else is evaluated against your policy.\n\n## Example policies\n\nThe `policies/` directory contains scaffolds for 349 MCP servers including GitHub, Stripe, AWS, Notion, and Slack. Each file lists every tool with its description, grouped by risk category.\n\nCopy one as a starting point:\n\n```sh\ncp policies/stripe.yaml policy.yaml\n# edit to add your rules, then:\nintercept -c policy.yaml --upstream https://mcp.stripe.com\n```\n\nBrowse all policies: [policies/](policies/)\n\n## MCP client integration\n\nTo use Intercept with Claude Code (or any MCP client that reads `.mcp.json`), point the server command at Intercept:\n\n```json\n{\n  \"mcpServers\": {\n    \"github\": {\n      \"command\": \"intercept\",\n      \"args\": [\n        \"-c\", \"/path/to/policy.yaml\",\n        \"--\",\n        \"npx\", \"-y\", \"@modelcontextprotocol/server-github\"\n      ],\n      \"env\": {\n        \"GITHUB_PERSONAL_ACCESS_TOKEN\": \"...\"\n      }\n    }\n  }\n}\n```\n\nFor remote HTTP servers, use `--upstream` instead of a command:\n\n```json\n{\n  \"mcpServers\": {\n    \"stripe\": {\n      \"command\": \"intercept\",\n      \"args\": [\n        \"-c\", \"/path/to/policy.yaml\",\n        \"--upstream\", \"https://mcp.stripe.com\",\n        \"--header\", \"Authorization: Bearer tok\"\n      ]\n    }\n  }\n}\n```\n\n## State backends\n\nRate limits, spend counters, and approval records persist across restarts. SQLite is the default (zero config). Redis is supported for multi-instance deployments:\n\n```sh\nintercept -c policy.yaml --state-dsn redis://localhost:6379 --upstream https://mcp.stripe.com\n```\n\n## Enforcement boundary\n\nIntercept governs tool calls that pass through the proxy. It does not govern:\n\n- Direct API calls or HTTP requests the agent makes outside the MCP path\n- Model reasoning, prompt content, or response generation\n- Actions taken by tools after they receive the forwarded call\n\nIf a tool call is routed through Intercept, enforcement is hard: the call is physically blocked before reaching upstream. If traffic bypasses the proxy, Intercept has no visibility.\n\n## Documentation\n\n- [CLI reference](USAGE.md): all commands, flags, transport modes, state backends, event logging\n- [Policy reference](POLICY.md): YAML format, conditions, operators, stateful counters, examples\n- [Example policies](policies/): ready-made scaffolds for 349 MCP servers\n\n## Contributing\n\nContributions welcome. Open an issue to discuss what you'd like to change.\n\n```sh\nmake build    # build binary -\u003e dist/\nmake test     # go test ./...\nmake lint     # golangci-lint (skips if not installed)\n```\n\nKey packages: `internal/engine/` (rule evaluation), `internal/proxy/` (request handler), `internal/state/` (counters and persistence), `internal/transport/` (stdio, SSE, HTTP), `internal/approvals/` (approval store and fingerprinting).\n\n## License\n\n[Apache 2.0](LICENSE)\n","funding_links":[],"categories":["Cloud Infrastructure"],"sub_categories":["🔒 Security"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPolicyLayer%2FIntercept","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FPolicyLayer%2FIntercept","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPolicyLayer%2FIntercept/lists"}