{"id":"6366b429-1299-4c91-b147-5a4b7c20699c","slug":"mcp-review","kind":"mcp","name":"mcp-review","summary":"CLI tool that provides AI-powered code review at the commit level. Works with local git history—no PRs required. Acts as an MCP host orchestrating tools to gather project context, enabling specific, p","owner":"ethanasm","repoUrl":"https://github.com/ethanasm/mcp-review","license":"MIT","licenseTier":"permissive","trust":"community","stars":3,"match":null,"fewStars":true,"format":"mcp","createdAt":"2026-02-05T04:08:06.000Z","addedAt":"2026-10-21T05:46:53.350Z","logoUrl":"https://avatars.githubusercontent.com/u/35380114?u=784f52fba496d50e7c43f6860ddf772cad894a14&v=4","linkOnly":false,"collection":null,"skillPath":null,"categories":["developer-tools","memory-knowledge"],"tags":["ai-code-review","cli","code-review","developer-tools","git"],"runtime":"node","local":true,"cloudCapable":false,"cloudCapability":"unknown","cloudReadyOnPlatform":false,"needsApiKey":false,"reviewed":false,"syncedAt":"2026-10-26T22:56:30.351Z","sample":false,"url":"https://conduits.dev/tools/mcp-review","language":"TypeScript","transports":["stdio"],"install":{"npm":"mcp-git-reviewer"},"requirements":{"env":[],"upstreamMayCharge":false},"tools":null,"readme":"# mcp-git-reviewer\n\nContext-aware, AI-powered code review at the commit level. Works with local git history — no PRs required.\n\nBuilt as an MCP Host that orchestrates tool servers to gather context from your codebase and feeds it to an LLM for intelligent, project-specific reviews.\n\n## Install\n\nPublished to npm as **`mcp-git-reviewer`**; the command it installs is **`mcp-review`**.\n\nRun it without installing anything:\n\n```bash\nnpx mcp-git-reviewer --staged\n```\n\nOr install it globally so `mcp-review` is on your PATH in every repo:\n\n```bash\nnpm install -g mcp-git-reviewer\nmcp-review --staged\n```\n\nRequires **Node.js 20+** and an API key for whichever provider you use. Export it\nin your shell, or put it in a `.env` file in the repo you are reviewing:\n\n```bash\nexport ANTHROPIC_API_KEY=sk-ant-...   # default provider\n```\n\n| Variable | Provider |\n|----------|----------|\n| `ANTHROPIC_API_KEY` | Anthropic (default) |\n| `OPENROUTER_API_KEY` | OpenRouter models (`qwen3-coder`, etc.) |\n| `DEEPSEEK_API_KEY` | DeepSeek |\n| `MOONSHOT_API_KEY` | Kimi / Moonshot |\n\nThen run it from inside any git repository — see [Usage](#usage).\n\n## What's in the box\n\n```\nsrc/\n  cli.ts                  CLI entry point (commander)\n  config.ts               YAML/JSON config loader (zod validated)\n  reviewer.ts             Review orchestration + watch mode\n  output.ts               Terminal rendering (chalk, boxen)\n  cache.ts                Hash-based review caching\n  usage.ts                Token usage tracking and cost estimation\n  errors.ts               Typed error hierarchy (ToolServerError, ApiError, etc.)\n  version.ts              Package version, read from package.json at runtime\n  git/\n    resolver.ts           Translates user input to git revision ranges\n    commands.ts           simple-git wrappers (diff, blame, log)\n  host/\n    mcp-host.ts           MCP host lifecycle — spawns tool servers\n    transport.ts          Stdio JSON-RPC transport\n    tool-registry.ts      Tool capability discovery and call routing\n    conversation.ts       LLM conversation loop with usage tracking\n  llm/\n    provider.ts           Shared LLMProvider interface and types\n    anthropic.ts          Anthropic SDK provider with rate-limit retry\n    openai.ts             OpenAI-compatible provider (OpenRouter, DeepSeek, Kimi, etc.)\n    index.ts              Provider factory + model alias resolution\n  tools/\n    git-diff/             Diff, stats, commit messages\n    file-context/         File reading with line numbers, directory listing\n    conventions/          Lint config scanning, pattern search, project conventions\n    related-files/        Import graph, exports, test file discovery, type references\n  prompts/\n    system.ts             System prompt with review instructions\n    templates.ts          Security and performance review templates\n```\n\n## Tech stack\n\n| Category | Tool |\n|----------|------|\n| Language | TypeScript 5 (strict) |\n| Runtime | Node.js 20+ / Bun |\n| Package manager | Bun |\n| AI | Anthropic SDK, OpenAI-compatible APIs, MCP SDK |\n| Git | simple-git |\n| CLI | commander, chalk, boxen |\n| Config | zod, yaml, dotenv |\n| Lint & format | Biome |\n| Test | Vitest |\n| CI | GitHub Actions, SonarCloud |\n\n## Local development setup\n\nTo work on the tool itself (to just *use* it, see [Install](#install) above):\n\n```bash\n# Install bun (if not already installed)\ncurl -fsSL https://bun.sh/install | bash\n\n# Install dependencies\nbun install\n\n# Build the project\nbun run build\n\n# Copy environment template and add your API key\ncp .env.example .env\n```\n\nRequired in `.env` (depending on provider):\n\n```\nANTHROPIC_API_KEY=sk-ant-...   # For Anthropic (default)\nOPENROUTER_API_KEY=sk-or-...   # For OpenRouter models (qwen3-coder, etc.)\nDEEPSEEK_API_KEY=sk-...        # For DeepSeek\nMOONSHOT_API_KEY=sk-...        # For Kimi / Moonshot\n```\n\n### Linking a local checkout\n\nLink your working copy so `mcp-review` runs your local build from any git repository:\n\n```bash\nnpm link\n```\n\n### Using in another project\n\nNavigate to any git repo and run `mcp-review` directly:\n\n```bash\ncd /path/to/your-project\nmcp-review --staged\n```\n\nOptionally, create a `.mcp-review.yml` in that project's root to customize review behavior:\n\n```yaml\nmodel: qwen3-coder\nfocus:\n  - security\n  - performance\nignore:\n  - \"*.test.ts\"\n  - dist\nconventions:\n  - \"Use named exports\"\n  - \"Error messages should be user-facing\"\n```\n\nSee [Configuration](#configuration) for all available options.\n\n## Development\n\n```bash\n# Run in dev mode\nbun run dev\n\n# Type check\nbun run typecheck\n\n# Lint and format\nbun run lint\nbun run format\n\n# Run tests\nbun run test\nbun run test:watch\nbun run test:coverage\n```\n\n## Verify\n\nRun the full CI pipeline locally:\n\n```bash\nbun run verify\n```\n\nThis runs lint, format check, typecheck, build, and tests — with a pass/fail summary at the end.\n\n## Publishing\n\n```bash\nnpm run verify        # lint, typecheck, build, unit tests\nnpm run test:pack     # packs, installs the tarball, runs the CLI as a consumer\nnpm version <patch|minor|major>\nnpm publish           # prepublishOnly rebuilds dist/\n```\n\n`test:pack` is the gate that matters before a release: the unit tests import the\ntool servers from `src/`, so they stay green even if the *published* package\ncannot spawn them. The smoke test installs the real tarball and asserts all four\nservers start under plain `node`.\n\n## Usage\n\n```bash\n# Review the last commit\nmcp-review HEAD~1..HEAD\n\n# Review staged changes (pre-commit)\nmcp-review --staged\n\n# Review a specific commit\nmcp-review abc123\n\n# Review last N commits\nmcp-review --last 3\n\n# Review everything since yesterday\nmcp-review --since yesterday\n\n# Focus on specific areas\nmcp-review --staged --focus security,performance\n\n# Watch mode — auto-review each new commit\nmcp-review --watch\n\n# Skip cache for a fresh review\nmcp-review HEAD~1..HEAD --no-cache\n\n# JSON output for CI pipelines (exit code 1 on critical findings)\nmcp-review HEAD~1..HEAD --output json\n\n# Verbose mode — show token usage and cost\nmcp-review HEAD~1..HEAD --verbose\n\n# Use a specific model\nmcp-review HEAD~1 --model qwen3-coder\n\n# Use a custom OpenAI-compatible endpoint\nmcp-review HEAD~1 --provider openai --base-url https://openrouter.ai/api/v1 --model qwen/qwen3-coder:free --api-key-env OPENROUTER_API_KEY\n```\n\n## Multi-provider support\n\nmcp-review supports multiple LLM providers through an abstract `LLMProvider` interface.\n\n### Model aliases\n\nShort names that auto-configure provider, base URL, and API key:\n\n| Alias | Model | Provider | API Key Env |\n|-------|-------|----------|-------------|\n| `qwen3-coder` | `qwen/qwen3-coder:free` via OpenRouter | openai | `OPENROUTER_API_KEY` |\n| `deepseek` | `deepseek-chat` via DeepSeek API | openai | `DEEPSEEK_API_KEY` |\n| `kimi` | `kimi-k2.5` via Moonshot API | openai | `MOONSHOT_API_KEY` |\n\nUse an alias with `--model` or in your config file:\n\n```bash\nmcp-review HEAD~1 --model qwen3-coder\n```\n\n### Providers\n\n- **Anthropic** (default) — Uses the Anthropic SDK. Models: `claude-sonnet-4-20250514`, `claude-opus-4-20250514`, `claude-haiku-3-5-20241022`\n- **OpenAI-compatible** — Works with any endpoint implementing the OpenAI chat completions API: OpenRouter, DeepSeek, Kimi/Moonshot, and others\n\n## Configuration\n\nCreate a `.mcp-review.yml` in your project root:\n\n```yaml\nmodel: qwen3-coder\nfocus:\n  - security\n  - performance\nignore:\n  - \"*.test.ts\"\n  - dist\nconventions:\n  - \"Use named exports\"\n  - \"Error messages should be user-facing\"\n```\n\nAll config fields:\n\n| Field | Type | Default | Description |\n|-------|------|---------|-------------|\n| `model` | string | `claude-sonnet-4-20250514` | Model name or alias |\n| `provider` | `anthropic` \\| `openai` | `anthropic` | LLM provider (auto-set by aliases) |\n| `base_url` | string | — | Base URL for OpenAI-compatible API |\n| `api_key_env` | string | — | Env var name for API key |\n| `focus` | string[] | `[]` | Focus areas: security, performance, consistency |\n| `ignore` | string[] | `[]` | Glob patterns for files to skip |\n| `conventions` | string[] | `[]` | Project conventions to enforce |\n| `max_files` | number | `20` | Max files to review |\n| `context_lines` | number | `5` | Lines of context around changes |\n| `no_cache` | boolean | `false` | Skip review cache |\n\n## CI Integration\n\nThe repo includes GitHub Actions workflows:\n\n- **`.github/workflows/ci.yml`** — Runs lint, typecheck, build, and tests on push/PR\n- **`.github/workflows/sonarqube.yml`** — Uploads coverage to SonarCloud\n\nExit codes for CI:\n- `0` — Review passed (no critical findings)\n- `1` — Critical findings detected\n- `2` — Runtime error\n\n## Architecture\n\nmcp-review is an **MCP Host** that spawns tool servers as child processes:\n\n```\nCLI → MCPHost.initialize()\n        ├── git-diff server      (diff, stats, commit messages)\n        ├── file-context server  (read files, list directories)\n        ├── conventions server   (lint configs, pattern search)\n        └── related-files server (imports, exports, test files, types)\n              ↓\n         LLMProvider (Anthropic or OpenAI-compatible)\n              ↓\n         Structured ReviewResult → terminal output\n```\n\nEach tool server is a standalone MCP server using stdio transport. The host discovers tools via `tools/list` and routes LLM tool calls to the correct server via `tools/call`.\n\nReviews are cached by content hash. Repeated reviews of the same diff skip the API call entirely.\n\n## License\n\nMIT — see [LICENSE](LICENSE).\n"}