Featured

Deploy OpenClaw in 60 seconds β€” 20% off logoDeploy OpenClaw in 60 seconds β€” 20% off

Launch OpenClaw on Hostinger in about 60 seconds and keep your agent live 24/7. Our referral link gives you 20% off, no coupon code needed.

Launch on Hostinger β†’
Run your Hermes agent on Hostinger, fully managed logoRun your Hermes agent on Hostinger, fully managed

Launch Hermes on Hostinger in one click, fully managed, no VPS knowledge needed. Use code ZACAARON10 for 10% off.

Launch on Hostinger β†’
Crawl and scrape any site into clean data, 10% off logoCrawl and scrape any site into clean data, 10% off

Firecrawl crawls and scrapes any site into clean markdown for your agent. Get 1,000 free credits, and new users get 10% off their first purchase.

Try Firecrawl free β†’
Your own AI agent, running 24/7 with QwikClaw logoYour own AI agent, running 24/7 with QwikClaw

QwikClaw sets up and runs an always-on OpenClaw agent for you. One click, no config files, no server setup.

Deploy now β†’
One API to scrape, enrich, and extract the internet. logoOne API to scrape, enrich, and extract the internet.

Context.dev gives your agents a single API to scrape, enrich, and extract live web data β€” no proxies, no parsers, no maintenance.

Start building free β†’
SetupClaw: done-for-you OpenClaw for founders & exec teams logoSetupClaw: done-for-you OpenClaw for founders & exec teams

White-glove OpenClaw for founders and exec teams (4–50+ employees): we install, harden, integrate your tools, and maintain it β€” secured from day one.

Get it set up for you β†’
SEO data APIs for your agent, $1 free credit logoSEO data APIs for your agent, $1 free credit

DataForSEO gives your agent live access to SERP results, keyword data, backlinks, and on-page SEO data through one API. New accounts get a $1 credit, good for up to 20,000 keyword or backlink lookups.

Try DataForSEO free β†’
Reach 47,000+ AI builders

A flat monthly placement in front of developers actively installing AI tools. No lock-in, cancel anytime.

Advertise here β†’

Works with

Claude CodeClaude DesktopCursorVS CodeClineCodex CLIOpenClaw+ any MCP client

Install to Claude Code

This server doesn't publish a one-line install command. Follow the setup in the source repository.

Summary

mcp-code-sanitizer MCP server](https://glama.ai/mcp/servers/notasandy/mcp-code-sanitizer/badges/score.svg)](https://glama.ai/mcp/servers/notasandy/mcp-code-sanitizer) 🐍 🏠 🍎 πŸͺŸ 🐧 - Strict AI code reviewer powered by Groq.

README.md

<!-- mcp-name: io.github.notasandy/mcp-code-sanitizer -->

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).

!Python !PyPI !FastMCP !Groq !License

Claude / Cursor / VS Code  ──MCP──►  code-sanitizer  ──REST──►  Groq API
                                        (server.py)              (llama-3.3-70b)

!demo

---

Features

| Tool | What it does | |---|---| | analyze_code | Strict review β€” bugs, security issues, score 0–100 | | compare_code | Compares two versions, detects regressions, recommends merge/request_changes | | explain_code | Step-by-step explanation for junior / middle / senior audience | | generate_tests | Generates pytest / jest / go test β€” happy path, edge cases, security | | analyze_file | Analyzes a whole file from disk with parallel chunking | | generate_report | Builds an HTML report from any analysis result | | cache_info | 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"]
}

---

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

Claude Desktop

| OS | Config file | |---|---| | macOS | ~/Library/Application Support/Claude/claude_desktop_config.json | | Windows | %APPDATA%\Claude\claude_desktop_config.json | | Linux | ~/.config/Claude/claude_desktop_config.json |

{
  "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 with pip 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.py

Then point the client config to: ``json { "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.html

---

Architecture

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 output

---

Configuration

All settings via .env or environment variables:

| Variable | Default | Description | |---|---|---| | GROQ_API_KEY | β€” | Required. Get at console.groq.com | | GROQ_MODEL | llama-3.3-70b-versatile | Groq model to use | | CACHE_TTL | 3600 | Cache TTL in seconds | | CACHE_MAX | 200 | Max cached entries |

Available Groq models

| Model | Speed | Quality | |---|---|---| | llama-3.3-70b-versatile | Fast | Best (default) | | llama-3.1-8b-instant | Fastest | Good | | mixtral-8x7b-32768 | 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

See related servers & alternatives β†’

Related MCP servers

Browse all β†’

Related guides

Hand-picked reading to help you choose and use Databases servers.