mcp-code-sanitizer
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
> 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).
---
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
---
Installation
> **Prerequisite:** Get a free Groq API key at console.groq.com/keys — no credit card required.
Claude Code CLI
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 |
Cursor
Create .cursor/mcp.json in your project (or ~/.cursor/mcp.json globally):
VS Code
Requires VS Code 1.99+ with GitHub Copilot. Create .vscode/mcp.json in your project:
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:
Then point the client config to:
---
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.
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:
Or call tools explicitly:
---
Architecture
---
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