Skip to content
MCP server

prompt-protection

Scan prompts, tool definitions and model output for injection, and guard tool calls

Runs locallyStatus and history
Install
Pricing
Open source
Platforms
CLI, self-hosted, Web
Runs
Locally
Version
4.4.0
Listing updated
3 days ago

About prompt-protection

prompt-protection is an open-source MCP server for ai models and llm tooling. It runs locally on your machine and is started by your AI client.

It started as a text scanner, but the current README leads with a different idea: tool results are marked as untrusted, destinations the user names are trusted, and every tool call the model proposes is checked before it runs. Untrusted data is not allowed to reach a network, email, exec, file or payment sink. The README credits Google DeepMind's CaMeL paper as the model, ported to a JavaScript tool-calling loop without a custom interpreter.

The text scanner normalises input first, covering Unicode folding, zero-width characters, homoglyphs and repeated base64 or URL decoding. It then scores against 106 weighted rules in eight threat categories, plus 20 rules for model output such as leaked system prompts, credentials, relayed injections and PII. Verdicts are allow, flag or block.

It runs in process with zero runtime dependencies and sends nothing over the network. The author states plainly that it is pattern-based, not a complete defence, and not an isolation boundary, and recommends least-privilege tools and a human in the loop for consequential actions.

Install

Run in a terminal

claude mcp add prompt-protection -- npx -y prompt-protection

Add to claude_desktop_config.json

{
  "mcpServers": {
    "prompt-protection": {
      "command": "npx",
      "args": [
        "-y",
        "prompt-protection"
      ]
    }
  }
}
Install in CursorOpens Cursor, which asks you to confirm. Or add it by hand:

Add to ~/.cursor/mcp.json

{
  "mcpServers": {
    "prompt-protection": {
      "command": "npx",
      "args": [
        "-y",
        "prompt-protection"
      ]
    }
  }
}
Install in VS CodeOpens VS Code, which asks you to confirm. Or add it by hand:

Add to .vscode/mcp.json

{
  "servers": {
    "prompt-protection": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "prompt-protection"
      ]
    }
  }
}

Add to ~/.codeium/windsurf/mcp_config.json

{
  "mcpServers": {
    "prompt-protection": {
      "command": "npx",
      "args": [
        "-y",
        "prompt-protection"
      ]
    }
  }
}

Add to your client's MCP settings (most use this shape)

{
  "mcpServers": {
    "prompt-protection": {
      "command": "npx",
      "args": [
        "-y",
        "prompt-protection"
      ]
    }
  }
}

What it does

Tool-call guard
Checks each proposed tool call and blocks untrusted data reaching exfiltration or exec sinks.
Provenance tracking
Labels tool results as untrusted and tracks trusted destinations the user named.
Input normalisation
Folds Unicode, strips hidden characters and decodes base64 and URL encoding before matching.
Output scanning
20 rules check responses for leaked prompts, credentials, relayed injections and PII.
Three-way verdicts
Returns allow, flag or block so medium-confidence hits can be logged.
Framework wrappers
Includes an Express middleware, a Next.js App Router wrapper and a React hook.
Local and dependency-free
Runs in process with no API call and zero runtime dependencies.

Good for

  • Block an email-borne URL from reaching an outbound request
  • Scan user input for jailbreaks before it reaches a model
  • Check model output for leaked system prompts or API keys
  • Add a tool-approval step to a Vercel AI SDK agent
  • Log medium-confidence injection hits for review

Pricing

Open source

Free open-source npm package

Prices change. Check mughalhere.github.io before you buy.

prompt-protection FAQ

Does it send my prompts anywhere?

No. It runs in process, and the demo runs in your browser with nothing sent.

Is it a complete defence against injection?

No. The author says it is pattern-based and a novel phrasing can pass, so it should be one layer among several.

How many rules does it use?

106 weighted input rules across eight threat categories and 20 output rules, per the site.

How is it installed?

With npm install prompt-protection; the registry entry runs it over stdio.

Does it need other packages?

No. It ships with zero runtime dependencies.

Is prompt-protection free?

Yes. prompt-protection is open source, so you can use and self-host it for free.

How do I add prompt-protection to Claude Code?

Run this command in your terminal: claude mcp add prompt-protection -- npx -y prompt-protection

What are the best alternatives to prompt-protection?

The closest alternatives to prompt-protection are REA, Claude Code Ultimate Guide, Agent Roast, Midplane and Leash.

Alternatives to prompt-protection

  1. REA

    MCP server

    CLI and MCP server that lets coding agents reverse engineer apps and binaries

    Runs locally
    • Open source
    • 464K GitHub stars
    • Developer tools
  2. MCP server for searching the Claude Code Ultimate Guide from any MCP client

    Runs locally
    • Open source
    • 6.5K GitHub stars
    • AI models and LLM tooling
  3. Agent Roast

    MCP server

    Offline review that flags agent changes which weaken tests, assertions or CI

    Runs locally
    • Open source
    • 4 Hacker News points
    • Developer tools
  4. Midplane

    MCP server

    Postgres gateway for AI agents with table grants, column masking and approval for writes

    Runs locally
    • Open source
    • 5 GitHub stars
    • Databases
  5. Leash

    MCP server

    Review what your AI touched, approve risky actions and undo supported changes

    • 1 tool
    • Remote
    • Free
    • 1 GitHub star
    • Security