mcpField
P
prompt-injection-scanner

prompt-injection-scanner

Local
github.com/GuardBeeSecurity1Updated 1d ago

About prompt-injection-scanner

prompt-injection-scanner is an MCP server for developers and teams checking RAG content, scraped pages, and documents for indirect prompt-injection patterns. It offers heuristic scans with findings that include risk explanations and recommendations.

Key features

  1. 01Detects five categories of injection patterns
  2. 02Scans text, files, and directories
  3. 03Includes risk explanations and recommendations
  4. 04Emits SARIF 2.1.0 results
  5. 05Supports guardbee.yml configuration

Use cases

  1. 01Check RAG documents before indexing
  2. 02Scan scraped pages before model retrieval
  3. 03Add content checks to a knowledge-base CI pipeline

MCP support

Provides MCP tools to scan text, files, and directories and list supported patterns. A CLI is also available for scanning content and producing SARIF output.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"4hmetuyar-prompt-injection-scanner": {
"command": "npx",
"args": [
"-y",
"@guardbee/mcp-prompt-injection-scanner"
]
}
}
}
Run commandnpx -y @guardbee/mcp-prompt-injection-scanner

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
npm@guardbee/mcp-prompt-injection-scanner0.2.2

Tools

4

Saved tool list · updated 2w ago

ParameterTypeRequiredDescription
labelstringNoOptional label shown in findings (e.g. source URL or filename)
contentstringYesThe text content to scan

Details

From the project README

@guardbee/mcp-prompt-injection-scanner

🇬🇧 English | 🇹🇷 Türkçe | 🇨🇳 中文 | 🇯🇵 日本語 | 🇰🇷 한국어 | 🇧🇷 Português | 🇪🇸 Español | 🇩🇪 Deutsch

npm version npm downloads License: MIT

An MCP (Model Context Protocol) server that scans content — a RAG chunk, a scraped web page, a document — for indirect prompt injection payloads.

ai-code-scanner and mcp-server-auditor scan code; this package scans data. In classic prompt injection, the attacker writes a malicious prompt themselves; in indirect prompt injection, the attacker never talks to the model at all — instead they embed instructions in a document, web page, or tool result the model will later read. The moment the model pulls this content into its context via a RAG retrieval or a web fetch, the embedded instruction appears to carry the same authority as the user's own instructions.

Telemetry is off by default. With GUARDBEE_TELEMETRY=1 it sends the server, tool, success, duration and short parameter values such as a file path; longer strings and fields like content, token or password are replaced with a placeholder. See @guardbee/mcp-telemetry.

Web page/RAG document ──► prompt-injection-scanner ──► LLM context
              │
              ├─ Instruction override   ("ignore all previous instructions", "önceki talimatları yok say")
              ├─ Role spoofing          ("System:", <|im_start|>, [INST], <system>)
              ├─ Hidden text            (zero-width, Unicode tag and bidi characters, display:none + instruction, HTML comment)
              ├─ Direct address         ("Dear AI, ...")
              └─ Exfiltration           (system prompt extraction request, data → URL instruction, templated img beacon)

Features

  • 17 patterns, 5 categories — instruction-override, role-spoofing, hidden-text, direct-address, exfiltration. English and Turkish phrasing
  • The rules live in @guardbee/guard-core, shared with @guardbee/mcp-security-proxy, so a phrase this scanner reports is the same phrase the proxy blocks at runtime
  • Every finding includes why it's risky and what to do about it (recommendation) — not just "found it"
  • SARIF 2.1.0 output — CI/CD integration (e.g. auto-scanning a knowledge-base repo on every PR)
  • Config file support via guardbee.yml
  • 45 unit tests — a positive and a negative (false-positive) scenario for every pattern; known false-positive sources like emoji ZWJ sequences and ordinary display:none modals are specifically tested

Quick Start

Claude Desktop / MCP Client
{
  "mcpServers": {
    "guardbee-prompt-injection-scanner": {
      "command": "npx",
      "args": ["-y", "@guardbee/mcp-prompt-injection-scanner"]
    }
  }
}
CLI (CI/CD — e.g. scan a RAG knowledge-base repo on every PR)
npx @guardbee/mcp-prompt-injection-scanner scan ./knowledge-base --fail-on=high --format=sarif > results.sarif

MCP Tools

ToolDescription
scan_textScans a given text/document snippet
scan_fileScans a single file
scan_directoryRecursively scans a directory (e.g. a RAG knowledge base) (node_modules, .git, dist skipped automatically)
list_patternsLists all supported patterns by category

Detected Patterns

CategoryPatternSeverityWhat it means
instruction-overrideinstruction_override_phrasehighA classic override phrase like "ignore/disregard/forget previous instructions"
instruction-overrideinstruction_override_trhighThe Turkish form: "önceki talimatları yok say / unut / görmezden gel"
instruction-overridedan_modehighAsks for the "DAN mode" jailbreak persona
instruction-overridebypass_safetyhighTells the model to bypass or disable its safety measures / guardrails
role-spoofingsystem_role_spoofmediumA fake "System:" role label at the start of a line in the content
role-spoofingchat_template_marker_injectionhighRaw chat-template control tokens (<|im_start|>, [INST]) in the content
role-spoofingsystem_taghighA <system> tag that tries to pass data off as a system message
hidden-texthidden_zero_width_charsmediumZero-width space/word-joiner (U+200B/U+2060) — text hidden from a human reviewer
hidden-textunicode_tag_smugglingcriticalInvisible Unicode tag characters (U+E0000–E007F) carrying hidden text; flag emoji such as 🏴󠁧󠁢󠁥󠁮󠁧󠁿 are excluded
hidden-textbidi_control_charsmediumBidi override/isolate characters that make text display in a different order than it is read
hidden-textcss_hidden_text_with_instructionhighA display:none/white-on-white element containing instruction-like language
hidden-texthtml_comment_instructionhighAn HTML comment containing instruction-like language
direct-addressdirect_address_to_aimediumThe content directly addresses "the AI"/"the assistant"
exfiltrationexfiltration_url_template_in_imagehighA markdown image URL with a {{...}}/${...} template — a data-exfil beacon
exfiltrationreveal_system_prompt_requesthighA sentence asking the model to reveal its system prompt
exfiltrationreveal_system_prompt_trhighThe Turkish form: "sistem istemini göster"
exfiltrationsend_data_to_url_instructioncriticalAn explicit instruction ordering the model to send data to an external URL

These are heuristic findings — a static text-pattern scan, not a semantic/intent analysis. Designed for a low false-positive rate (e.g. emoji ZWJ sequences and ordinary display:none modals are specifically excluded), but every finding should still be reviewed manually.


Configuration (guardbee.yml)

prompt-injection-scanner:
  fail-on: high       # any | critical | high | medium | low | none
  max-files: 5000
  exclude:
    - ".test.ts"
    - "fixtures/"

Development

npm run build
npm test             # 45 unit tests

License

MIT — GuardBee

Feedback

Questions, ideas, or a false positive? Start a thread in GitHub Discussions or open an issue. If GuardBee is useful to you, a ⭐ on the repository helps others find it.

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.