Answer
Test MCP for Code Review
Yes — you can build an MCP server that automates code review using linters, type checkers, and static analysis tools.
Code Review MCP Server
pythonfrom mcp.server import Server from mcp.server.stdio import stdio_server import mcp.types as types import subprocess, json app = Server("code-review-mcp") @app.list_tools() async def list_tools(): return [ types.Tool( name="lint_python", description="Run ruff linter on a Python file and return issues", inputSchema={ "type": "object", "properties": {"file_path": {"type": "string"}}, "required": ["file_path"] } ), types.Tool( name="type_check", description="Run mypy type checker on a Python file", inputSchema={ "type": "object", "properties": {"file_path": {"type": "string"}}, "required": ["file_path"] } ), types.Tool( name="run_tests", description="Run pytest for a specific module", inputSchema={ "type": "object", "properties": {"module": {"type": "string"}}, "required": ["module"] } ) ] @app.call_tool() async def call_tool(name: str, arguments: dict): if name == "lint_python": result = subprocess.run( ["ruff", "check", arguments["file_path"], "--output-format=json"], capture_output=True, text=True ) issues = json.loads(result.stdout) if result.stdout.strip() else [] msg = f"{len(issues)} issues found" if issues else "Clean — no issues" return [types.TextContent(type="text", text=msg)] if name == "type_check": result = subprocess.run( ["mypy", arguments["file_path"]], capture_output=True, text=True ) return [types.TextContent(type="text", text=result.stdout or "Type check passed")] if name == "run_tests": result = subprocess.run( ["pytest", f"tests/test_{arguments['module']}.py", "-v", "--tb=short"], capture_output=True, text=True ) return [types.TextContent(type="text", text=result.stdout)]
Register in Claude Config
json{ "mcpServers": { "code-review": { "command": "python3", "args": ["/path/to/code_review_server.py"] } } }
Workflow: Claude + Code Review MCP
textUser: "Review src/auth.py for quality issues" Claude automatically: 1. Calls lint_python("src/auth.py") → "3 issues found" 2. Calls type_check("src/auth.py") → "2 type errors" 3. Reads file via filesystem MCP 4. Synthesizes: "Found 5 issues. Here's how to fix each..."
Real Code Review Tools to Wrap
| Tool | Language | What It Checks |
|---|---|---|
| ruff | Python | Style, imports, bugs |
| mypy / pyright | Python | Type errors |
| eslint | JS/TS | Style, best practices |
| semgrep | Multi | Security patterns |
| bandit | Python | Security vulnerabilities |
| pytest --cov | Python | Test coverage |
Key Insight
The MCP server handles tool execution — Claude synthesizes results and provides actionable recommendations. This is far more powerful than copying code into a browser chat.