islgl/gitlab-mcp-server
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.
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/mcpendpoint, 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
-
post_mr_review_comment - Post AI-generated review comments
- Analyze code changes
- Generate comprehensive review reports
- Support different review focuses (general/security/performance/style)
-
post_mr_comment - Post custom comments
- Add specific feedback or questions to MR
-
get_mr_info - Get MR detailed information
- Title, description, author, status, etc.
-
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 APIread_api- Read API datawrite_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
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
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