Skip to main content
Glama
README.md
# Review Multi MCP

A Model Context Protocol (MCP) server that performs code reviews using multiple LLMs via OpenRouter. Get consensus-based code review feedback by querying several AI models in parallel and aggregating their findings.

## Features

- **Multi-model review**: Query 5+ models simultaneously for diverse perspectives
- **Consensus detection**: Issues found by 2+ models are flagged as high-confidence
- **Configurable**: Choose your models via config file or environment variables
- **Severity classification**: Issues categorized as CRITICAL, HIGH, MEDIUM, LOW
- **AC validation**: Specifically checks Acceptance Criteria compliance (great for story-based workflows)
- **Cost-effective**: Default models balance quality and cost (~$0.01-0.05 per review)

## Requirements

- Python 3.10+
- [OpenRouter API key](https://openrouter.ai/keys)

## Installation

### With uv (recommended)

```bash
git clone https://github.com/ziltosh/review-multi-mcp.git
cd review-multi-mcp
uv sync
```

### With pip

```bash
git clone https://github.com/ziltosh/review-multi-mcp.git
cd review-multi-mcp
pip install -r requirements.txt
```

## Configuration

### API Key (required)

You have 3 options for setting your OpenRouter API key:

**Option 1: `.env` file (recommended for standalone use)**

```bash
cp .env.example .env
# Edit .env and add your key
```

**Option 2: Claude Code MCP settings**

In `~/.claude.json`, the `env` section automatically injects variables (see [Usage with Claude Code](#usage-with-claude-code) for full example).

**Option 3: System environment variable**

```bash
# Linux/macOS
export OPENROUTER_API_KEY="sk-or-..."

# Windows (PowerShell)
$env:OPENROUTER_API_KEY="sk-or-..."
```

Priority: System env vars > `.env` file (`.env` won't override existing vars)

### Models and options (optional)

Create a `config.json` file in the server directory:

```bash
cp config.example.json config.json
```

Edit `config.json`:

```json
{
  "models": [
    "deepseek/deepseek-chat",
    "mistralai/codestral-2508",
    "qwen/qwen3-coder",
    "openai/gpt-4o-mini",
    "google/gemini-2.5-flash"
  ],
  "timeout": 60,
  "max_tokens": 4000,
  "temperature": 0.3,
  "debug": false
}
```

#### Available options

| Option | Description | Default |
|--------|-------------|---------|
| `models` | List of OpenRouter model IDs | See default list below |
| `timeout` | Request timeout in seconds | `60` |
| `max_tokens` | Max tokens for model responses | `4000` |
| `temperature` | Model temperature (0-1) | `0.3` |
| `debug` | Enable debug logging | `false` |

### Environment variables

All options can also be set via environment variables:

| Variable | Description |
|----------|-------------|
| `OPENROUTER_API_KEY` | Your OpenRouter API key (required) |
| `REVIEW_MULTI_MODELS` | Comma-separated list of model IDs |
| `REVIEW_MULTI_TIMEOUT` | Request timeout in seconds |
| `REVIEW_MULTI_MAX_TOKENS` | Max tokens for responses |
| `REVIEW_MULTI_TEMPERATURE` | Model temperature |
| `REVIEW_MULTI_DEBUG` | Set to `1` to enable debug logging |

Environment variables override `config.json` values.

## Default models

The default model selection balances quality, speed, and cost:

| Model | Why included |
|-------|--------------|
| `deepseek/deepseek-chat` | Best value, excellent reasoning |
| `mistralai/codestral-2508` | Code-specialized, fast |
| `qwen/qwen3-coder` | Strong code benchmarks |
| `openai/gpt-4o-mini` | Reliable baseline |
| `google/gemini-2.5-flash` | Fast, capable, good value |

Browse available models at [OpenRouter Models](https://openrouter.ai/models).

## Usage with Claude Code

Add to `~/.claude.json` under the `mcpServers` key:

### With uv (recommended)

```json
{
  "mcpServers": {
    "review-multi": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/review-multi-mcp", "python", "server.py"],
      "env": {
        "OPENROUTER_API_KEY": "sk-or-..."
      }
    }
  }
}
```

### With pip/venv

```json
{
  "mcpServers": {
    "review-multi": {
      "command": "/path/to/review-multi-mcp/.venv/bin/python",
      "args": ["/path/to/review-multi-mcp/server.py"],
      "env": {
        "OPENROUTER_API_KEY": "sk-or-..."
      }
    }
  }
}
```

> **Note**: On Windows, use `.venv/Scripts/python.exe` instead of `.venv/bin/python`.

After adding the configuration, restart Claude Code. Verify with `/mcp` command.

### Tool parameters

| Parameter | Description |
|-----------|-------------|
| `code` | Code to review (inline) |
| `code_file` | Path to file containing code (alternative to inline - recommended for large diffs) |
| `focus` | Context string describing what to validate (see format below) |
| `models` | Override default models for this review |

## What the tool validates

The review prompt is designed for **adversarial code review**. Models are instructed to find real problems, not praise the code. They specifically check:

1. **Acceptance Criteria (AC) validation**: Are the ACs actually implemented?
2. **Task audit**: If tasks are marked done, are they really done?
3. **Code quality**: Security, performance, error handling, maintainability
4. **Test quality**: Real tests vs placeholders

### Severity levels

| Severity | Meaning |
|----------|---------|
| **CRITICAL** | AC not implemented, security vulnerability, task marked done but isn't |
| **HIGH** | Must fix before merge - bugs, missing validation, poor error handling |
| **MEDIUM** | Should fix - performance issues, code smells, incomplete tests |
| **LOW** | Nice to fix - style, documentation, minor improvements |

## The `focus` parameter

The `focus` parameter provides context to the models. For best results, include:

- Story title/description
- Acceptance Criteria to validate
- Relevant architecture constraints
- Specific concerns to check

### Example focus string

```
Story 4.1: Trade Context Capture

Acceptance Criteria:
- AC1: BeginTradeContext() available when CCustomReporter initialized
- AC2: AddCoreIndicator() and AddStrategyIndicator() work during capture
- AC3: FinalizeTradeContext(ticket) associates context with trade
- AC4: Warning logged if FinalizeTradeContext called with 0 indicators

Architecture: CustomReporter.mqh generates JSON with trades[] array containing decision_context

Review for: AC compliance, MQL5 best practices, JSON format correctness, test coverage
```

### Simple usage

For quick reviews without story context:

```
focus: "Security review - check for SQL injection, XSS, authentication bypass"
```

```
focus: "Performance review - look for N+1 queries, unnecessary allocations, blocking calls"
```

## Integration with BMAD workflow

This tool works well with story-based development workflows like [BMAD Method](https://github.com/bmad-code-org/BMAD-METHOD).

See [examples/bmad-integration.md](examples/bmad-integration.md) for a complete custom command example.

## Output format

The tool returns a structured review with:

- **Consensus verdict**: PASS, CONCERNS, or FAIL
- **Individual model verdicts**: Each model's assessment
- **Issues by severity**: CRITICAL, HIGH, MEDIUM, LOW
- **High-confidence markers**: Issues found by 2+ models
- **Model summaries**: Each model's summary assessment

## Cost estimation

With the default 5 models and typical code review (~5K input tokens, ~2K output per model):

- **Per review**: ~$0.01-0.05
- **Daily (20 reviews)**: ~$0.20-1.00

Costs vary by model. Check [OpenRouter pricing](https://openrouter.ai/models) for current rates.

## Troubleshooting

### "OPENROUTER_API_KEY environment variable not set"

Ensure the API key is set in the MCP server configuration or system environment.

### Timeouts

Increase the timeout in `config.json` or via `REVIEW_MULTI_TIMEOUT`.

### Debug mode

Enable debug logging to see what's happening:

```json
{
  "debug": true
}
```

Or: `REVIEW_MULTI_DEBUG=1`

Check `server.log` in the server directory.

## License

MIT License - see LICENSE file.

## Contributing

Contributions welcome! Please open an issue or PR.

---

*Built for use with [Claude Code](https://claude.ai/code)*

TDQS

B3.2/5.0

Scored across 1 tool

Disambiguation5/5

There is only one tool, so there is no possibility of selecting the wrong tool or confusing overlapping purposes. The tool's purpose is clearly stated as multi-LLM code review with consensus analysis.

Naming Consistency5/5

With a single tool named multi_review, the naming is internally consistent and follows a clear snake_case convention. There are no competing conventions to create confusion.

Tool Count3/5

The server is narrowly focused, so one tool can be justified, but a single-tool surface is thin and limits configurability or follow-up operations. It sits at the borderline of being under-scoped rather than clearly well-scoped.

Completeness3/5

The core operation of performing a multi-LLM code review is covered, but the surface lacks obvious supporting operations such as model selection, review configuration, or retrieval/history. These gaps are notable but not fatal for a minimal review workflow.

Maintenance

ActivityInactive
ResponsivenessNo recent community issues