Get the FREE Ultimate OpenClaw Setup Guide →

code-review

MCP Server for GitHub/GitLab code review - enables AI assistants to review pull requests and merge requests

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio oldjii-code-review-mcp uvx code-review-mcp \
  --env GITLAB_HOST="GitLab host (optional; e.g., gitlab.example.com for self-hosted)" \
  --env GITHUB_TOKEN="GitHub token (optional; used when reviewing GitHub PRs)" \
  --env GITLAB_TOKEN="GitLab token (optional; used when reviewing GitLab MRs)"

How to use

This MCP server provides automated code review capabilities for GitHub and GitLab pull requests and merge requests. It exposes a set of tools for retrieving PR/MR information, computing changes, and adding comments. You can interact with it through the MCP clients/inspectors and use the built-in Cursor rules to tailor code review checks to your project. The server supports multiple transports (stdio, SSE, and WebSocket) and can be run directly via UVX or Docker for deployment.

Recommended workflow: run the server using uvx code-review-mcp, then use the MCP inspector or your client to call tools such as get_pr_info, get_pr_changes, extract_related_prs, and the commenting tools add_inline_comment, add_pr_comment, and batch_add_comments. For remote deployments, you can configure SSE or WebSocket endpoints and point your clients to the appropriate URL, e.g., http://server:8000/sse or ws://server:8000/ws.

How to install

Prerequisites:

  • Python 3.10+ (for source or pip install) or a system with uvx installed
  • Network access to install dependencies

Option A: Run via uvx (recommended)

  1. Ensure uvx is installed. If not, install the uvx runner (per your environment).
  2. Run the MCP server directly:

uvx code-review-mcp

Option B: Install via pip (from PyPI)

  1. Ensure Python and pip are installed (Python 3.10+ recommended).
  2. Install the package:

pip install code-review-mcp

  1. Run the server:

code-review-mcp

Option C: From source (development)

  1. Clone the repository:
git clone https://github.com/OldJii/code-review-mcp.git
cd code-review-mcp
  1. Install dev dependencies:
pip install -e ".[dev]"
  1. Run tests (optional):
pytest
  1. Run the server (development):
code-review-mcp

Prerequisites summary: Python 3.10+, pip, and network access for package installation. If using Docker, see the Docker deployment section in the repository README for container-based setup.

Additional notes

Environment variables GITHUB_TOKEN and GITLAB_TOKEN are recommended when connecting to respective services. For self-hosted GitLab, set GITLAB_HOST to your instance (e.g., gitlab.yourcompany.com). The server does not persist data by default; tokens provide read/write access to PR/MR data as configured by the hosting platform. When deploying with Docker or remote transports (SSE/WebSocket), expose the appropriate ports and supply tokens via environment variables. If you encounter token-related authentication issues, verify token scopes (e.g., repo scope for GitHub, api scope for GitLab) and ensure the tokens are correctly exported in the environment used by the MCP server.

For debugging, you can inspect available tools with the MCP Inspector and test individual tools like get_pr_info or add_inline_comment to validate responses before integrating into automated workflows.

Related MCP Servers

Sponsor this space

Reach thousands of developers