# MCP Server for Propel

Submit git diffs for AI-powered code review directly from Claude using the [Propel](https://propelcode.ai) code review platform.

## Features

- Submit git diffs for async code review
- Automatically polls for results (reviews take 5-10 minutes)
- Retrieve detailed review comments with file paths, line numbers, and severity
- Quick status checks for in-progress reviews

## Installation

```bash
uv pip install mcp-server-propel
```

## Setup

1. Get your Propel API token from [propelcode.ai/settings/api](https://propelcode.ai/settings/api)
   - Your token needs `reviews:write` scope
   - **Note:** `reviews:write` automatically grants `reviews:read`, so a single scope is sufficient

2. Add to your Claude Desktop config:

**MacOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
**Windows:** `%APPDATA%\Claude\claude_desktop_config.json`

```json
{
  "mcpServers": {
    "propel": {
      "command": "mcp-server-propel",
      "env": {
        "PROPEL_API_TOKEN": "your-api-token-here"
      }
    }
  }
}
```

3. Restart Claude Desktop

## Tools

### submit_review

Submit a git diff for code review. Returns immediately with a review ID, then instructs Claude to call `get_review` to poll for results.

**Parameters:**
- `diff` (required): Unified git diff output
- `repository` (required): Repository identifier (name, full name, or URL)
- `base_commit` (optional): Base commit SHA for additional context

### get_review

Get review results. Polls the API automatically every 12 seconds until the review completes or fails (~12 min max).

**Parameters:**
- `review_id` (required): The review job identifier

### check_review_status

Quick, non-polling status check. Returns only status and timing info without waiting.

**Parameters:**
- `review_id` (required): The review job identifier

## Usage Examples

**Submit a diff for review:**
```
Review this diff on Propel for repository myorg/myrepo:
<paste git diff output>
```

**Check review status:**
```
Check the status of Propel review abc-123
```

**Get full review results:**
```
Get the results of Propel review abc-123
```

## Getting a Git Diff

```bash
# Uncommitted changes
git diff

# Between branches
git diff main..feature-branch

# Last commit
git diff HEAD~1 HEAD

# Staged changes
git diff --cached
```

## Local Development

```bash
# Install with dev dependencies
cd mcp-server-propel
uv sync --group dev

# Run tests
uv run pytest -v

# Test against local Propel API
export PROPEL_API_TOKEN="your-token"
export PROPEL_API_URL="http://localhost:6060"
uv run mcp-server-propel
```

For testing with MCP Inspector:
```bash
uv run mcp dev src/mcp_server_propel/server.py
```

For local Propel API, add to Claude Desktop config:
```json
{
  "mcpServers": {
    "propel": {
      "command": "mcp-server-propel",
      "env": {
        "PROPEL_API_TOKEN": "your-token",
        "PROPEL_API_URL": "http://localhost:6060"
      }
    }
  }
}
```

## Troubleshooting

**"PROPEL_API_TOKEN environment variable is required"**
- Add the token to your Claude Desktop config `env` section
- Restart Claude Desktop after updating the config

**"Invalid authorization token" / "Authorization token has expired"**
- Generate a new token at [propelcode.ai/settings/api](https://propelcode.ai/settings/api)
- Ensure it has `reviews:write` scope (`reviews:write` automatically includes `reviews:read` — you don't need both)

**"Diff too large"**
- Your diff exceeds the 1 MB size limit
- Try reviewing a smaller changeset (fewer files or commits)

**"Repository not found"**
- The repository must be connected to your Propel workspace
- Check the repository name matches what's configured in Propel

## Support

- Documentation: https://docs.propelcode.ai
- Issues: https://github.com/propel/mcp-server-propel/issues
