Comparison

MCP Guard vs Prompt Guard and other prompt-injection classifiers

Prompt-injection classifiers such as Meta's Llama Prompt Guard 2 look at text and ask whether it contains an attack. MCP Guard looks at the action an agent is about to take and asks whether it should run. They sit at different points in the loop, and they catch different things.

3 min readLast updated

Checks run on our GPUs in Switzerland. Request payloads are not stored.Security

In 30 seconds

  • Prompt Guard classifies input text as benign or malicious (jailbreak and injection attempts).
  • MCP Guard judges a proposed tool call in context: is it safe, destructive, exfiltrating, injected, grounded?
  • A text scanner can clean tool outputs before the model reads them; the guard checks what the model then decides to do.
  • Use both: they fail in different ways.

Code and dense tables are folded away. Open any of them on demand.

At a glance: MCP Guard vs Prompt Guard and other prompt-injection classifiers

MCP Guard compared with Prompt Guard and other prompt-injection classifiers, feature by feature
 MCP GuardPrompt Guard and other prompt-injection classifiers
What it inspectsA proposed tool call plus contextA piece of text
Question answeredShould this action run?Is this text an attack?
Where it sitsBetween the model and the toolBefore text reaches the model
Catches harmful actions with no attack textYes (mistakes, drift, hallucinated arguments)No
Catches attacks that never cause an actionNoYes
Injection signalYes: the injected head, from the action and its triggerYes: from the text itself
Model size184M86M and 22M variants (Prompt Guard 2)
DeploymentHosted API and MCP serverOpen weights, run locally

The verdict

They answer different questions: scan untrusted text with a prompt-injection classifier if you like, and check every consequential action with a guard either way.

Two different questions

Meta's Llama Prompt Guard 2 is a family of small classifiers (86M and 22M parameters, per its model card) that label a piece of text as benign or malicious, aimed at jailbreak and prompt-injection attempts. Other vendors offer similar text classifiers. You run them on user input, and ideally on anything the agent reads from outside: web pages, emails, documents, tool results.

MCP Guard does not ask whether text is an attack. It asks whether a specific tool call, with its arguments, should run given what the user asked. One of its nine outputs, injected, estimates whether the action is being driven by instructions from a tool result or document rather than the user, which is the effect of a successful indirect prompt injection. The others cover harm that has nothing to do with injection.

What a text classifier misses

Many harmful agent actions involve no attack text at all:

  • The model misreads the task and runs DROP TABLE on the wrong database.
  • It invents an order id or refund amount the user never gave (hallucinated arguments).
  • It drifts from the goal and starts changing infrastructure it was only asked to inspect.

And injections that do happen can be paraphrased, split across documents, or written to look like ordinary content. A text classifier that misses them has no second chance; the action-level check still sees the send_email to an unknown address that follows.

What an action guard misses

The guard only sees actions. An injection that makes the model produce a misleading answer, without calling any tool, never reaches it. Neither does a jailbreak aimed at getting harmful text out of a chat model. A text classifier is the right tool for those.

The guard also sees only what you send it. If the injected instruction is not in the context you pass, it has to judge from the action alone, which is still useful (an email to a never-seen address carrying a secret looks suspicious either way) but less informed.

Using them together

A reasonable layout for an agent that reads untrusted content:

  1. Scan inbound text (user input, retrieved documents, tool results) with a prompt-injection classifier. Strip or quarantine what it flags.
  2. Let the model plan.
  3. Check each proposed tool call with MCP Guard, passing trigger: "tool_result" when the action followed a tool output, plus the user's intent and any constraints.
  4. Keep deterministic controls: least-privilege credentials and allowlists for outbound destinations.

This follows the idea behind Simon Willison's "lethal trifecta": when an agent combines private data, untrusted content and a way to send data out, you want several independent barriers, because each one alone will sometimes fail. See prompt injection through tool results.

When a text classifier alone is enough

If your application is a chat assistant with no tools, or with only read-only tools that cannot send data anywhere, the risk is in the text, and a prompt-injection classifier (plus a content-safety model) is the better fit. An action guard earns its place once the agent can write, delete, spend or send.

Frequently asked questions

Does MCP Guard detect prompt injection?
It detects the likely effect of one: its injected score estimates whether an action is driven by instructions from a tool result or document rather than the user. It does not scan arbitrary text for attacks.
Which is more accurate?
They are not measured on the same task, so a direct accuracy comparison would be misleading. Evaluate each on the job it does.

Sources

Last updated . MCP Guard reduces the risk of harmful agent actions; it does not guarantee safety. Keep deterministic controls in place alongside it. Third-party names are used only to describe their products; we are not affiliated with them.