# prompt-protection

> prompt-protection is an open-source MCP server for ai models and llm tooling. Scan prompts, tool definitions and model output for injection, and guard tool calls. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** CLI, self-hosted, Web
- **Website:** https://mughalhere.github.io/prompt-protection/
- **Repository:** https://github.com/mughalhere/prompt-protection
- **MCP Registry name:** io.github.mughalhere/prompt-protection
- **Categories:** AI models and LLM tooling, security
- **Listing updated:** 2026-11-14

## About

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.

## Features

- **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

## Install

### Claude Code (Terminal)

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

### Claude Desktop (claude_desktop_config.json)

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

### Cursor (~/.cursor/mcp.json)

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

### VS Code (.vscode/mcp.json)

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

### Windsurf (~/.codeium/windsurf/mcp_config.json)

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

### Other clients (your client's MCP settings (most use this shape))

```json
{
  "mcpServers": {
    "prompt-protection": {
      "command": "npx",
      "args": [
        "-y",
        "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

- [REA](https://ai-powered.com/mcp/rea): REA is an open-source MCP server for developer tools.
- [Claude Code Ultimate Guide](https://ai-powered.com/mcp/claude-code-ultimate-guide): Claude Code Ultimate Guide is an open-source MCP server for ai models and llm tooling.
- [Agent Roast](https://ai-powered.com/mcp/agent-roast): Agent Roast is an open-source MCP server for developer tools.
- [Midplane](https://ai-powered.com/mcp/midplane): Midplane is an open-source MCP server for databases.
- [Leash](https://ai-powered.com/mcp/leash): Leash is a free MCP server for security.
- [Tinplate Edge AI Safety, Security & EU Compliance](https://ai-powered.com/mcp/tinplate-edge-ai-safety-security-and-eu-compliance): Tinplate Edge AI Safety, Security & EU Compliance is a freemium MCP server for security.
- [SecureCloud](https://ai-powered.com/mcp/securecloud): SecureCloud is a free MCP server for security.
- [Eikino](https://ai-powered.com/mcp/eikino): Eikino is a freemium MCP server for security.

---
Source: https://ai-powered.com/mcp/prompt-protection
