MCP Code Sanitizer
MCP Code Sanitizer is an AI-powered code review and analysis server that integrates with Claude, Cursor, VS Code, and GitHub Actions to find bugs, vulnerabilities, and security issues in your code.
analyze_code— Strictly review a code fragment for bugs, security vulnerabilities, and code quality issues, returning a score (0–100) with categorized issues, warnings, and suggestions.compare_code— Compare two versions of code to detect regressions, improvements, or neutral changes, with a merge/request_changes recommendation.explain_code— Generate a step-by-step explanation of code, tailored to a junior, middle, or senior audience.generate_tests— Automatically create unit tests (pytest, jest, go test, etc.) covering happy paths, edge cases, and security scenarios.analyze_file— Analyze an entire file from disk, with automatic language detection by extension and parallel chunking for large files.generate_report— Convert any analysis result into a formatted HTML report, optionally saved to a specified path.cache_info— View cache statistics (hit rate, entry count, etc.) or clear the cache entirely.
mcp-code-sanitizer
Strict AI-powered code reviewer for Claude Desktop, Cursor, VS Code, and Claude Code CLI. Finds bugs, vulnerabilities, and security issues — powered by Groq (free API).
Claude / Cursor / VS Code ──MCP──► code-sanitizer ──REST──► Groq API
(server.py) (llama-3.3-70b)Features
Tool | What it does |
| Strict review — bugs, security issues, score 0–100 |
| Compares two versions, detects regressions, recommends merge/request_changes |
| Step-by-step explanation for junior / middle / senior audience |
| Generates pytest / jest / go test — happy path, edge cases, security |
| Analyzes a whole file from disk with parallel chunking |
| Builds an HTML report from any analysis result |
| Cache statistics and clearing |
Example output
{
"summary": "Critical SQL injection and secret exposed in logs",
"score": 23,
"issues": [
{
"severity": "critical",
"line": 2,
"title": "SQL Injection",
"description": "f-string directly interpolates user_id into query",
"fix": "cursor.execute('SELECT * FROM users WHERE id = %s', (user_id,))"
}
],
"warnings": [{"title": "No exception handling", "description": "..."}],
"suggestions": ["Consider using an ORM instead of raw SQL"]
}Related MCP server: Claude Code Review MCP
Installation
Prerequisite: Get a free Groq API key at console.groq.com/keys — no credit card required.
Claude Code CLI
claude mcp add code-sanitizer -e GROQ_API_KEY=gsk_your_key -- uvx mcp-code-sanitizerClaude Desktop
OS | Config file |
macOS |
|
Windows |
|
Linux |
|
{
"mcpServers": {
"code-sanitizer": {
"command": "uvx",
"args": ["mcp-code-sanitizer"],
"env": {
"GROQ_API_KEY": "gsk_your_key_here"
}
}
}
}Cursor
Create .cursor/mcp.json in your project (or ~/.cursor/mcp.json globally):
{
"mcpServers": {
"code-sanitizer": {
"command": "uvx",
"args": ["mcp-code-sanitizer"],
"env": {
"GROQ_API_KEY": "gsk_your_key_here"
}
}
}
}VS Code
Requires VS Code 1.99+ with GitHub Copilot. Create .vscode/mcp.json in your project:
{
"servers": {
"code-sanitizer": {
"command": "uvx",
"args": ["mcp-code-sanitizer"],
"env": {
"GROQ_API_KEY": "gsk_your_key_here"
}
}
}
}Or add globally via Ctrl+Shift+P → "MCP: Add Server".
Don't have
uvx? Install it withpip install uv, then use the commands above.
Manual install (alternative)
If you prefer cloning the repo:
git clone https://github.com/notasandy/mcp-code-sanitizer
cd mcp-code-sanitizer
pip install -r requirements.txt
cp .env.example .env # add your GROQ_API_KEY
python server.pyThen point the client config to:
{
"command": "python",
"args": ["/full/path/to/server.py"],
"env": { "GROQ_API_KEY": "gsk_your_key_here" }
}GitHub Action — automatic PR review
Add AI code review to any repository in 5 lines. The action posts a structured comment on every PR with score, issues, and fix suggestions.
# .github/workflows/ai-review.yml
name: AI Code Review
on:
pull_request:
types: [opened, synchronize]
permissions:
contents: read
pull-requests: write
jobs:
review:
runs-on: ubuntu-latest
steps:
- uses: notasandy/mcp-code-sanitizer@v1
with:
groq_api_key: ${{ secrets.GROQ_API_KEY }}Add GROQ_API_KEY to your repository secrets → Settings → Secrets → Actions.
The action automatically:
Reviews only changed files (up to 10 per PR)
Posts a score and structured issue list as a PR comment
Fails the check if critical issues are found
Usage in chat
After connecting, just write naturally:
Review this code for vulnerabilities:
def get_user(user_id):
query = f"SELECT * FROM users WHERE id = {user_id}"
return db.execute(query)Or call tools explicitly:
analyze_file /path/to/my_script.py
generate_tests for this function: ...
compare_code — before vs after refactor, did it get better?
generate_report and save to /tmp/report.htmlArchitecture
mcp-code-sanitizer/
├── server.py # FastMCP entry point
├── config.py # Constants — keys, limits, extension map
├── groq_client.py # Async Groq client with auto-retry on 429
├── cache.py # In-memory LRU cache with TTL
├── prompts.py # System prompts for all tools
└── tools/
├── analyze.py # analyze_code
├── compare.py # compare_code
├── explain.py # explain_code
├── tests.py # generate_tests
├── file_tool.py # analyze_file — chunking + parallel analysis
├── cache_tool.py # cache_info
└── report.py # generate_report — HTML outputConfiguration
All settings via .env or environment variables:
Variable | Default | Description |
| — | Required. Get at console.groq.com |
|
| Groq model to use |
|
| Cache TTL in seconds |
|
| Max cached entries |
Available Groq models
Model | Speed | Quality |
| Fast | Best (default) |
| Fastest | Good |
| Fast | Great |
Contributing
PRs and Issues are welcome. Most wanted:
Support for other LLM providers (OpenAI, Anthropic)
New tools: dependency audit, complexity score, docstring generator
Prompt improvements and new language support
License
MIT — do whatever you want. A star would be appreciated.
Links
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Flicense-qualityDmaintenanceA server that enables interaction with PostgreSQL, MySQL, MariaDB, or SQLite databases through Claude Desktop using natural language queries.Last updated1
- AlicenseAqualityFmaintenanceAn MCP server that provides code review functionality using OpenAI, Google, and Anthropic models, serving as a "second opinion" tool that works with any MCP client.Last updated12633MIT
- AlicenseAqualityDmaintenanceEnables comprehensive security scanning of code projects, detecting vulnerabilities in dependencies, code patterns (XSS, eval, etc.), and exposed secrets, with detailed reports in Spanish prioritized by severity.Last updated416MIT
- FlicenseAqualityBmaintenanceAI-powered code review tool that detects AI-generated code defects invisible to traditional linters — hallucinated packages, deprecated APIs, cross-file contradictions, hidden security anti-patterns, and over-engineering. Works as a standalone CLI, GitHub Action, or MCP server. Supports TypeScript, Python, Java, Go, and Kotlin. Free for individuals, no API key required.Last updated432
Related MCP Connectors
Zero-config MCP security scanner for AI-generated apps. 25K+ vulnerability patterns.
Enterprise code intelligence for M&A, security audits, and tech debt. Hosted server with 200k free.
Lints + auto-fixes how AI coding agents discover any new product. 24 rules, 6 tools, score 0-100.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/notasandy/mcp-code-sanitizer'
If you have feedback or need assistance with the MCP directory API, please join our Discord server