Scans codebases for security risks in LLM integrations, including prompt injection, data privacy leaks, and unsafe output handling.
Also known as GuardBee/guardbee-mcp, ai-code-scanner-d0dbd7, @guardbee/mcp-ai-code-scanner
- Stars
- 2
- Tools
- 4
- Downloads, 30 days
- 1,842
- Latest version
- 0.5.1
- Last commit
- Nov 12, 2026
- License
- MIT
What is ai-code-scanner MCP?
ai-code-scanner scans codebases for security risks in LLM integrations, including prompt injection, data privacy leaks, and unsafe output handling. It exposes 4 tools, such as scan_text, scan_file, scan_directory.
Summary generated from the project's README
About ai-code-scanner MCP server
Developers building AI-integrated applications can use this tool to identify security vulnerabilities within their codebases. It focuses on risks specific to Large Language Model integrations, such as prompt injection, data privacy leaks, and unsafe handling of model outputs. Unlike standard secret scanners that only look for leaked API keys, this server analyzes patterns like how much trust is placed in model outputs or whether sensitive user data is being sent to third-party providers.
The server operates via the Model Context Protocol and can be connected to Claude Desktop or used through a CLI for CI/CD pipelines. It provides specific tools including scan_text for snippets, scan_file for individual files, and scan_directory for recursive codebase analysis. Users can configure the scanner using a guardbee.yml file to set severity thresholds or exclude specific directories. It also supports custom rule packs via JSON files to detect organization-specific data patterns.
Every identified risk includes a recommendation on how to fix the issue. The system outputs results in SARIF 2.1.0 format for integration with GitHub Code Scanning. While it uses heuristic text-pattern scanning rather than full AST analysis, it is designed to maintain a low false-positive rate.
What you can do with it
- 1Detecting prompt injection risksAsk the AI to check if raw user input is being unsafely mixed into system prompts.
- 2Preventing sensitive data leaksScan the codebase to ensure PII like email addresses or national IDs are not interpolated directly into LLM prompts.
- 3Auditing agent tool permissionsCheck if any tools granted to an AI agent provide excessive agency such as shell execution.
Written from the project's README. Every use case is checked against a quote from it.
How to install ai-code-scanner MCP
Formats verified 10 Nov 2026Add to CursorAdd to GooseInstall ai-code-scanner MCP in Claude Code
$ claude mcp add ai-code-scanner-d0dbd7 -- npx -y @guardbee/mcp-ai-code-scannerInstall ai-code-scanner MCP in Cursor
~/.cursor/mcp.json
{
"mcpServers": {
"ai-code-scanner-d0dbd7": {
"command": "npx",
"args": [
"-y",
"@guardbee/mcp-ai-code-scanner"
]
}
}
}Install ai-code-scanner MCP in VS Code
.vscode/mcp.json
{
"servers": {
"ai-code-scanner-d0dbd7": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@guardbee/mcp-ai-code-scanner"
]
}
}
}Install ai-code-scanner MCP in VS Code CLI
$ code --add-mcp '{"name":"ai-code-scanner-d0dbd7","type":"stdio","command":"npx","args":["-y","@guardbee/mcp-ai-code-scanner"]}'Install ai-code-scanner MCP in Claude Desktop
claude_desktop_config.json
{
"mcpServers": {
"ai-code-scanner-d0dbd7": {
"command": "npx",
"args": [
"-y",
"@guardbee/mcp-ai-code-scanner"
]
}
}
}Install ai-code-scanner MCP in Codex
$ codex mcp add ai-code-scanner-d0dbd7 -- npx -y @guardbee/mcp-ai-code-scannerInstall ai-code-scanner MCP in Codex config.toml
~/.codex/config.toml
[mcp_servers.ai-code-scanner-d0dbd7] command = "npx" args = ["-y", "@guardbee/mcp-ai-code-scanner"]
Install ai-code-scanner MCP in Gemini CLI
$ gemini mcp add -s user ai-code-scanner-d0dbd7 npx -- -y @guardbee/mcp-ai-code-scannerInstall ai-code-scanner MCP in Gemini settings.json
~/.gemini/settings.json
{
"mcpServers": {
"ai-code-scanner-d0dbd7": {
"command": "npx",
"args": [
"-y",
"@guardbee/mcp-ai-code-scanner"
]
}
}
}ai-code-scanner MCP tools 4
Detected from the READMEscan_textscan_filescan_directorylist_patterns
| scan_text | — | |
| scan_file | — | |
| scan_directory | — | |
| list_patterns | — |
Automated checks
Ran Nov 13, 2026Full report →Passed our automated checks. That is not a security audit: read the code and give the server the narrowest access it needs. How checks work
- Source repository linked and reachablePass
- Open source license (OSI)Pass
- Commit or release in the last yearPass
- Package name not close to a popular packagePass
- Remote endpoint uses HTTPSNot checked
- Destructive tools are labelledPass
- No hidden instructions to the modelPass
- No critical advisory in the package or its dependenciesPass
README
View on GitHub@guardbee/mcp-ai-code-scanner
🇬🇧 English | 🇹🇷 Türkçe | 🇨🇳 中文 | 🇯🇵 日本語 | 🇰🇷 한국어 | 🇧🇷 Português | 🇪🇸 Español | 🇩🇪 Deutsch
An MCP (Model Context Protocol) server that scans your codebase for security patterns commonly found in LLM/AI integrations.
While secret-scanner looks for leaked secrets/API keys, this package looks for patterns: how much a model's output is trusted, how privileged the tools it can call are, what data is sent to a third-party LLM — risks that a static credential scan can't catch.
Telemetry is off by default. With
GUARDBEE_TELEMETRY=1it sends the server, tool, success, duration and short parameter values such as a file path; longer strings and fields likecontent,tokenorpasswordare replaced with a placeholder. See@guardbee/mcp-telemetry.
Claude ──► ai-code-scanner ──► Your codebase
│
├─ Client-exposure (dangerouslyAllowBrowser: true)
├─ Output handling (eval(llmOutput), unvalidated JSON.parse)
├─ Excessive agency (an agent tool named execute_command)
├─ Data privacy (email/national ID interpolated directly into a prompt)
└─ Prompt injection (raw request data mixed into a system prompt)
Features
- 10 patterns, 5 categories — client-exposure, output-handling, excessive-agency, data-privacy, prompt-injection
- 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 (GitHub Code Scanning, etc.)
- Config file support via
guardbee.yml - Custom rule packs — extend detection with org-specific patterns (KVKK/GDPR field names, internal tool names) via JSON files, no fork required
- 36 unit tests — a positive and a negative (false-positive) scenario for every built-in pattern, plus custom-rule loading/validation
Quick Start
Claude Desktop / MCP Client
{
"mcpServers": {
"guardbee-ai-code-scanner": {
"command": "npx",
"args": ["-y", "@guardbee/mcp-ai-code-scanner"]
}
}
}
CLI (CI/CD)
npx @guardbee/mcp-ai-code-scanner scan ./src --fail-on=high --format=sarif > results.sarif
MCP Tools
| Tool | Description |
|---|---|
scan_text |
Scans a given text/code snippet |
scan_file |
Scans a single file |
scan_directory |
Recursively scans a directory (node_modules, .git, dist skipped automatically) |
list_patterns |
Lists all supported patterns by category |
Detected Patterns
| Category | Pattern | Severity | What it means |
|---|---|---|---|
| client-exposure | openai_dangerously_allow_browser |
critical | OpenAI key leaked to the browser |
| client-exposure | client_bundled_ai_api_key |
critical | An AI key enters the client bundle via NEXT_PUBLIC_/VITE_/REACT_APP_ |
| output-handling | eval_llm_output |
critical | Model output executed as code via eval()/Function() |
| output-handling | exec_llm_output |
critical | Model output passed to a shell command (command injection) |
| output-handling | llm_output_dangerously_set_inner_html |
high | Model output rendered as raw HTML (XSS) |
| output-handling | llm_json_no_validation |
medium | Model output JSON.parse'd without schema validation |
| excessive-agency | excessive_agency_tool_name |
high | A tool that grants an agent shell/code execution |
| excessive-agency | unbounded_agent_loop |
medium | An agent loop with no iteration bound (cost/DoS) |
| data-privacy | pii_field_in_llm_prompt |
high | Data like email/national ID/card number goes directly into a prompt |
| prompt-injection | unsanitized_input_in_system_prompt |
medium | Raw request/user data mixed into a system prompt |
These are heuristic findings — a static text-pattern scan, not a full AST analysis. Designed for a low false-positive rate, but every finding should still be reviewed manually.
Configuration (guardbee.yml)
ai-code-scanner:
fail-on: high # any | critical | high | medium | low | none
max-files: 5000
rules-dir: .guardbee/rules # custom rule packs, see below
exclude:
- ".test.ts"
- "fixtures/"
Custom rules
Built-in patterns cover common AI/LLM integration mistakes, but field names and
internal conventions (e.g. which prop names carry KVKK-regulated data) are
project-specific. Drop one or more JSON files into .guardbee/rules/
(configurable via rules-dir) and they're merged with the built-ins at scan
time — for both the CLI and the MCP server (list_patterns marks them (custom)).
A file holds a single rule object or an array of them:
{
"id": "kvkk_musteri_tc_no",
"name": "musteriTcNo interpolated into a prompt",
"category": "data-privacy",
"pattern": "musteriTcNo",
"flags": "gi",
"severity": "high",
"recommendation": "Mask the national ID before it enters the prompt."
}
category is one of client-exposure | output-handling | excessive-agency | data-privacy | prompt-injection | cost-control; severity is one of
critical | high | medium | low. pattern is a JS regex source string
(flags defaults to "g"). A rule id that collides with a built-in or
another custom rule is rejected — the scanner keeps running but reports the
problem on stderr and skips that entry.
Development
npm run build
npm test # 36 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.
ai-code-scanner MCP questions
How do I add ai-code-scanner MCP to Claude Code?
Run claude mcp add ai-code-scanner-d0dbd7 -- npx -y @guardbee/mcp-ai-code-scanner in your terminal. Add --scope user to make it available in every project.
How do I add ai-code-scanner MCP to Cursor?
Open ~/.cursor/mcp.json and add the server under mcpServers, using the Cursor config shown in the install section above.
What tools does ai-code-scanner MCP provide?
It exposes 4 tools, including scan_text, scan_file, scan_directory, list_patterns.
What kind of security risks does it detect?
It identifies patterns like client-side API key exposure, unsafe execution of model output, excessive agent agency, PII in prompts, and prompt injection vulnerabilities.
Can I add my own security rules?
Yes, you can extend detection with organization-specific patterns by adding JSON files to a configured rules directory.
Does the scanner send my private code to a server?
Telemetry is turned off by default. If enabled, it only sends metadata like tool success and duration, replacing sensitive content with placeholders.
Is this a full AST analysis?
No, the findings are heuristic-based static text-pattern scans designed for a low false-positive rate.