Open source · static analysis · zero network

MCPGuard — A Security Scanner for MCP Manifests and Agent Tool Configs

MCPGuard is an open-source static scanner for MCP manifests and agent tool configs. Point it at a manifest and it flags prompt injection in descriptions, tool poisoning, over-permissioned commands, exposed secrets, excessive scope, unauthenticated dangerous tools and tool-name shadowing, each with a severity and a fix. It uses no network and no LLM, grades the manifest A to F, and exits non-zero on critical or high findings so it can gate CI.

Try it live ↓View on GitHub

Scan an MCP manifest

Paste a manifest as JSON, or load the malicious sample. The scan runs with no network call and no model, and returns the exact text that tripped each rule.

MCPGuard · live scannerdeterministic · no API key · runs on this site

What MCPGuard scans for

Attacks that live in a tool's description and config, where network and SAST tools do not look.

Instructions hidden in a tool

  • Prompt injection — “ignore previous instructions”, hidden system directives, zero-width characters and base64 payloads in descriptions
  • Tool poisoning — exfiltration URLs, data-send directives and “before using any tool…” cross-tool hijacks
  • Tool shadowing — duplicate tool names, and zero-width, homoglyph or non-ASCII characters used to impersonate a trusted tool

Too much access

  • Over-permissioned commands — bash, curl piped to bash, rm -rf, shell and exec permissions, broad access claims
  • Secret exposure — OpenAI keys, GitHub PATs, AWS access keys, JWTs, private key blocks and Stripe keys
  • Excessive scope — wildcard paths, ** globs and “*” permission scopes
  • Unauthenticated dangerous tools — exec, shell or send-email tools with no auth field or token parameter

How does MCPGuard work? Load → check → grade → report

A rules engine over the manifest text. The same input always produces the same findings.

1 · Load

parse + normalise

The manifest JSON is parsed and normalised into a list of tools, so different manifest shapes go through the same checks.

2 · Check

deterministic rules

Each check family runs over every tool's name, description, command and permissions. The Python core has seven families; the in-browser scan on this page is a TypeScript port of six of them.

3 · Grade

severity counts

Findings are counted by severity and rolled into a grade from A to F.

4 · Report

JSON + Markdown

The CLI writes a JSON report and a Markdown report, and exits non-zero on critical or high findings. An optional LLM second opinion exists and is off by default.

Eval results on the golden dataset

  • 11 labelled fixtures — 8 vulnerable manifests, one per check class plus one multi-vector case, and 3 clean ones.
  • 100% critical/high recall — and 100% recall on finding IDs across the suite.
  • 0% false-positive rate — for critical or high findings on the clean fixtures.
  • Regression gate — the eval suite exits non-zero if any of these numbers drops.

Limits, stated plainly

  • MCPGuard is a static scan of a manifest. It is not runtime protection and does not watch what a tool does once it is running.
  • It reads what a tool declares. A server whose code misbehaves while its manifest looks clean will pass.
  • The checks are pattern rules. A novel injection phrased unlike any rule can be missed.
  • The eval numbers come from an 11-fixture dataset written for this project, not from a public benchmark.
  • The in-browser scan covers six check families; tool shadowing is in the Python CLI only.

Frequently Asked Questions

What is MCPGuard?

MCPGuard is an open-source static scanner for MCP manifests and agent tool configs. Point it at a manifest and it flags prompt injection in descriptions, tool poisoning, over-permissioned commands, exposed secrets, excessive scope, unauthenticated dangerous tools and tool-name shadowing, each with a severity and a fix. It uses no network and no LLM, grades the manifest A to F, and exits non-zero on critical or high findings so it can gate CI.

Why scan an MCP manifest at all?

An agent reads each tool's description as part of its context. A third-party tool can therefore carry instructions, such as telling the agent to send data elsewhere before using any other tool. Nothing on the network looks wrong, because the attack is text in a description field.

Does MCPGuard send my manifest anywhere?

No. The checks run with zero network calls and no LLM. The optional LLM second opinion in the Python version is off unless you turn it on.

How do I run MCPGuard in CI?

Run `python -m mcpguard.scan <target.json>` in your pipeline. It exits with a non-zero code when it finds a critical or high issue, which fails the job.

Can an agent call MCPGuard itself?

Yes. `python -m mcpguard.mcp_server` exposes a scan_manifest tool over stdio, so an MCP client can scan a manifest before loading it.