Skip to main content

AgentGate

A runtime security gateway for AI agents using MCP. It tracks data flow across tool calls, sends detections to your SIEM, and is measured on an open attack benchmark.

CI Python License

Status: v0.1.0 (pre-release). Everything in the project plan's core is built and measured: stdio and HTTP proxies, seven detectors, taint tracking, SIEM pack, benchmark. See Results and Roadmap.

AgentGate sits between an MCP client (Claude Desktop, VS Code, Cursor, a custom agent) and each MCP server. It inspects every JSON-RPC message, then allows it, denies it or asks a human. Every decision becomes a structured audit event that can go to Splunk.

MCP client ──stdio/HTTP──▶ agentgate wrap / serve ──stdio/HTTP──▶ real MCP server(s)
                              │ manifest guard (pinning, rug pull, shadowing)
                              │ poisoning heuristics · classifier · LLM judge (optional)
                              │ argument policy (paths, shell, SSRF) · secrets & PII
                              │ result scanner · taint tracker (cross-server data flow)
                              ▼
                  audit.jsonl ──▶ Splunk HEC ──▶ Sigma rules + dashboard

AgentGate Splunk dashboard: denied calls, blocked exfiltration flows, findings by OWASP MCP Top 10 category, and the attack chain by session

The Splunk dashboard after replaying the demo attack chain in the lab (lab/). 10 of 12 detections fire, including two correlation rules. See detections/README.md.

End-to-end demo with a real LLM (openai/gpt-oss-120b, transcripts): asked only "What's the weather in Delhi?", an agent with a poisoned weather tool leaked a canary SSH key to the attacker in 6 of 7 unprotected runs and 0 of 7 with AgentGate.

Quickstart

pip install -e .            # PyPI release as agentgate-mcp is coming with v0.1.0

On Windows, see docs/windows_quickstart.md.

Put every stdio server of a client behind AgentGate in one step (shows a diff first; --apply writes it and keeps a .bak):

agentgate install --client claude-desktop            # or cursor, windsurf, vscode, claude-code
agentgate install --client claude-desktop --apply

Or wrap a server by hand. In your client's MCP config, replace the server command:

// before
"filesystem": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-filesystem", "C:/Users/me/projects"] }
// after
"filesystem": { "command": "agentgate", "args": ["wrap", "--server", "filesystem", "--",
                "npx", "-y", "@modelcontextprotocol/server-filesystem", "C:/Users/me/projects"] }

For a remote (Streamable HTTP) server, run the gateway and point the client at it:

pip install -e ".[http]"
agentgate serve --server github --upstream https://mcp.example.com/mcp --port 8765
# client config: "url": "http://127.0.0.1:8765/"

As a central gateway in Docker (audit events go to docker logs for your log shipper):

docker build -t agentgate .
docker run -p 8765:8765 -e UPSTREAM=http://mcp-server:8000/mcp -e SERVER=github agentgate

Useful commands:

agentgate pins                       # pinned tool definitions and their status
agentgate approve weather            # review and approve new/changed tool definitions
agentgate logs --findings            # recent audit events that had findings
agentgate report -o report.md         # Markdown summary: decisions, top findings, blocked by session
agentgate scan-config --sarif r.sarif  # audit client MCP configs (Claude, Cursor, VS Code, ...)
agentgate check -s filesystem --input '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"read_file","arguments":{"path":"~/.ssh/id_rsa"}}}'
agentgate check -s weather --manifest tools.json   # scan a tools/list result (exit 1 if blocked)

Team allowlist (policy-as-code): agentgate pins-export -o pins.json writes every approved tool definition with its SHA-256; commit it, review changes in pull requests, and run agentgate pins-import pins.json on each machine. With defaults.first_seen_tool: deny, only reviewed definitions ever reach the model. Import re-hashes each definition and rejects a file whose definitions were edited without updating the hash; protecting the file itself is up to code review and signed commits.

To approve "ask" decisions from your phone, set defaults.approvals: telegram in the policy and export TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID; AgentGate sends Allow/Deny buttons and denies if nobody answers within two minutes.

State lives in ~/.agentgate/ (override with AGENTGATE_HOME). The policy comes from --policy, then AGENTGATE_POLICY, then the bundled policies/default.yaml.

Results (frozen run, 29 Nov 2026)

AgentGate-Bench: 60 attack cases in 10 categories and 112 benign cases (42 real MCP server manifests with 709 tools, plus real documentation text as tool results). Rules and thresholds were frozen (commit ba3c71f) before the test split was read. Full results · error analysis

Default (heuristics + taint) + classifier on results
Recall (60 attacks) 77% 82%
False-positive rate (112 benign cases) 5% 10%
Added latency, p95 per tool call 0.26 ms 66 ms
  • 100% on obvious poisoning, invisible Unicode, rug pulls, shadowing, secrets, command injection, SSRF.
  • Taint tracking lifts obfuscated exfiltration from 0% to 60%.
  • Subtle, keyword-free poisoning: 0% with every layer. That's the main open problem.
  • The classifier's gains were all on the dev split; on test it added nothing, so it stays opt-in.
  • Generalisation check (corpus v2): after adding 43 cases in new families and tuning on dev only, recall on the 20 new unseen test cases was 50% vs 77% on dev (results). Rules fit what you've seen; this is the honest number.
  • LLM-judge layer (post-freeze, gpt-oss-20b): subtle poisoning 57% → 86%, overall 92% → 96%, false positives 4% → 6% (results).
  • Caveat: the same person wrote the rules and the attacks; a held-out red-team set is next.

Compared with existing tools on the same cases (details):

AgentGate Cisco MCP Scanner (static, YARA) mcpwall 0.3.1 (runtime, defaults)
Tool-definition attacks (31) 23 6 n/a (not inspected)
Tool-call attacks (21) 19 n/a (static) 9
Real benign servers flagged (42) 1 11 n/a

Neither other tool's rules have seen these cases, while mine were written alongside them, so this favours AgentGate; read the fairness notes.

What it detects today

Detector Where OWASP MCP Top 10 (2025)
Manifest guard: SHA-256 pin per tool, rug-pull diff, cross-server shadowing tools/list MCP03
Poisoning heuristics: override/concealment phrases, fake <IMPORTANT> tags, sensitive paths, invisible Unicode (zero-width, bidi, tag block, decoded), base64 payloads tools/list MCP03
Argument policy: path allow/deny globs (with ~ and ../ normalised), shell metacharacters, traversal, egress allowlist, SSRF (private, link-local, metadata, decimal/hex IPs) tools/call MCP02, MCP05
Secrets/PII: AWS, GitHub, OpenAI, Groq, Slack, Google keys, private keys, JWTs, high-entropy strings, Aadhaar (Verhoeff-checked), PAN tools/call args and results MCP01
Taint tracker: data from sensitive tool results (or any result holding a secret) reappearing in a later call to any server, even URL- or base64-encoded tools/call MCP10
Server instructions & prompts: initialize instructions scanned (stripped if poisoned); prompts/list entries hidden if poisoned; prompts/get messages flagged initialize, prompts/* MCP03, MCP06
Result scanner: indirect prompt injection in tool output, flagged and annotated (never silently dropped) tools/call, resources/read MCP06

Tools that are flagged, or that changed since approval, are removed from tools/list, so the model never sees the poisoned description. Calls to them are denied with a JSON-RPC error. If a detector crashes, the message is denied (fail closed).

Non-goals

  • AgentGate does not replace sandboxing or least-privilege credentials. It is one layer of defence in depth.
  • Prompt-injection detection is probabilistic. False-negative rates will be reported honestly in the benchmark.
  • No enterprise features (SSO, multi-tenancy).

Roadmap

  • stdio relay and Streamable HTTP reverse proxy; fail-closed pipeline; JSONL audit log
  • YAML policy (allow / deny / ask); approvals on a terminal or via Telegram
  • Manifest pinning, rug-pull diff, shadowing; team allowlist via pins-export / pins-import
  • Poisoning heuristics (intent patterns, invisible Unicode, homoglyphs, suspicious defaults), applied to tools, server instructions and prompts
  • Argument policy, SSRF (incl. IPv4 shorthand), secrets and Indian PII, result scanning and redaction
  • Taint tracker: winnowed fingerprints, exact and key=value secrets, identifiers for paraphrased leaks, URL/base64/hex decoding, shared across servers
  • Optional ONNX classifier and LLM judge (with persistent verdict cache)
  • scan-config (SARIF), check, lethal-trifecta posture warning
  • Splunk pack (16 Sigma rules, dashboard, lab) and Wazuh rules, both verified on an attack chain
  • AgentGate-Bench: 110 attacks, 42 real benign servers, two freezes, comparison, CI gate
  • LLM-judge results with gpt-oss-20b (gpt-oss-120b run in progress, Groq free-tier quota)
  • Held-out red-team evaluation (needs an outside contributor)
  • PyPI release and demo video

Development

python -m venv .venv && . .venv/bin/activate   # Windows: .venv\Scripts\activate
pip install -e ".[dev]"
pytest -q && ruff check . && mypy

See docs/threat_model.md and docs/owasp_mapping.md.

Contributions welcome: see CONTRIBUTING.md. Licence: Apache-2.0. To report a vulnerability, see SECURITY.md.

Metadata

Release files for agentgate-mcp 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agentgate-mcp 0.1.0
File Size Uploaded Provenance Actions
agentgate_mcp-0.1.0.tar.gz 835.5 kB With provenance Details for agentgate_mcp-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for agentgate-mcp 0.1.0
File Interpreter ABI Platform Actions
agentgate_mcp-0.1.0-py3-none-any.whl Python 3 none any Details for agentgate_mcp-0.1.0-py3-none-any.whl

Total release size: 906.9 kB

Release files / agentgate_mcp-0.1.0.tar.gz

Download URL agentgate_mcp-0.1.0.tar.gz
Size 835.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ae0879b46cd814aca604270a6f03fd134d497e8d37a87f581745a556b3af3c00
BLAKE2b-256 checksum
How to use checksums
77aae5f59c6c7009f9dd5d4faa7dc09c86af6c0d507ba10a6bef4783f182cf01
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 2, 2026.

Transparency log

Release files / agentgate_mcp-0.1.0-py3-none-any.whl

Download URL agentgate_mcp-0.1.0-py3-none-any.whl
Size 71.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fdbdb894a374d57a81e5ffae5ecb9bbe2840a1aeb3600ebe3f236150b51a1c47
BLAKE2b-256 checksum
How to use checksums
6e8e831510a37595ad5775388835855b3730dc689ab6da40bcec33c34bd192d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 2, 2026.

Transparency log

Security for agentgate-mcp 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for agentgate_mcp-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 2, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page