gitlab-mcp-server

islgl/gitlab-mcp-server

3.2

If you are the rightful owner of gitlab-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

A GitLab server based on Model Context Protocol (MCP) that supports AI-generated Merge Request comments and other GitLab operations.

Tools
4
Resources
0
Prompts
0

GitLab MCP Server

Python Version ≥ 3.11 MCP Server Docker Pulls Docker Version CI/CD

|


Introduction

A GitLab server based on Model Context Protocol (MCP) that supports AI automatic generation of Merge Request comments and other GitLab operations.

[!note]

Differences from Official Version

The official version of MCP Server relies on the /api/v4/mcp endpoint, but private GitLab instances may not have this feature deployed. This project deploys the MCP Server locally and implements all functionality through the standard GitLab API.


Features

🤖 AI Code Review

  • Automatic Comment Generation: Uses AI to analyze code changes and automatically generate insightful Merge Request comments
  • Multiple Review Perspectives: Supports four review modes: general, security, performance, and code style
  • Intelligent Analysis: Automatically detects code patterns, potential issues, and improvement suggestions

🛠️ Available Tools

  1. post_mr_review_comment - Post AI-generated review comments

    • Analyze code changes
    • Generate comprehensive review reports
    • Support different review focuses (general/security/performance/style)
  2. post_mr_comment - Post custom comments

    • Add specific feedback or questions to MR
  3. get_mr_info - Get MR detailed information

    • Title, description, author, status, etc.
  4. get_mr_changes - Get MR code changes

    • View modified file list and diff information

🔍 Review Modes

General

Comprehensive code review, including:

  • Change statistics and file analysis
  • Potential issue identification
  • Best practice recommendations
Security

Focus on security issues:

  • Hardcoded credential detection
  • SQL injection risks
  • Insecure function usage
  • Configuration security
Performance

Performance optimization suggestions:

  • Algorithm complexity analysis
  • Database query optimization
  • Caching strategies
  • Asynchronous operations
Style

Code style and maintainability:

  • Code standard checks
  • Documentation completeness
  • Naming conventions
  • Code cleanliness

Installation

Example uses Cursor as MCP Client.

Prerequisites:

  • GitLab Personal Access Token (PAT)
  • uv (required for source installation)

[!important] GitLab PAT needs the following permissions:

  • api - Access API
  • read_api - Read API data
  • write_repository - Write comments

🐳 Using Docker (Recommended 🌟)

1. Pull Image

Use pre-built Docker image, supports amd64 and arm64 architectures:

# Pull latest image
docker pull islgl/gitlab-mcp-server:latest
2. Install to Cursor

Install MCP Server

Or you can manually add the following configuration to mcp.json:

{
  "mcpServers": {
    "gitlab-mcp-server": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e", "GITLAB_URL",
        "-e", "GITLAB_TOKEN",
        "islgl/gitlab-mcp-server:latest"
      ],
      "env": {
        "GITLAB_URL": "https://gitlab.com",
        "GITLAB_TOKEN": "your-gitlab-token"
      }
    }
  }
}

🔧 Install from Source

1. Clone Repository:
git clone https://github.com/islgl/gitlab-mcp-server.git
cd gitlab-mcp-server
2. Install Dependencies
# Sync dependencies and install
uv sync
3. Install to Cursor

Install MCP Server

Or you can manually add the following configuration to mcp.json:

{
  "mcpServers": {
    "gitlab-mcp-server": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/gitlab-mcp-server",
        "run",
        "gitlab-mcp-server"
      ],
      "env": {
        "GITLAB_URL": "https://gitlab.com",
        "GITLAB_TOKEN": "your-gitlab-token"
      }
    }
  }
}

License

This project is open source under Apache 2.0 License, see for details