GitLab MCP Server
Provides tools for interacting with GitLab merge requests and repository files, including retrieving MR details and changes, listing MRs, updating descriptions, fetching file content, analyzing changes for code review, and pushing line-level review comments.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@GitLab MCP Server review MR #123 in company/awesome-project and post line-level comments"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
GitLab MCP Server
A Model Context Protocol (MCP) server for GitLab integration, enabling AI assistants to interact with GitLab merge requests, files, and perform intelligent code reviews.
Documentation • User Guide (中文) • API Reference
Features
🔄 MCP Protocol - Full compliance with the official MCP TypeScript SDK
📡 stdio Transport - Compatible with Cursor, Claude Desktop, and other MCP clients
🛠️ Complete MR Toolkit - Get MR details, changes, file contents, and more
🤖 AI Code Review - Intelligent code analysis with inline comments
📝 Line-level Comments - Push precise code review feedback to GitLab
🔍 Change Analysis - Deep diff analysis for comprehensive reviews
📋 Review Rules Engine - Smart rules based on file types and paths
🔒 Enterprise Ready - Supports private GitLab instances with retry mechanisms
Related MCP server: GitLab MCP Code Review
Quick Start
Prerequisites
Node.js >= 18.0.0
pnpm (recommended) or npm
GitLab Personal Access Token
Installation
# Clone the repository
git clone https://github.com/LynnCen/gitlab-mcp
cd gitlab-mcp
# Install dependencies
pnpm install
# Build the project
pnpm buildConfiguration
Set your GitLab credentials:
export GITLAB_HOST="https://gitlab.com"
export GITLAB_TOKEN="glpat-xxxxxxxxxxxxx"Cursor Integration
Add to your Cursor MCP settings:
{
"mcpServers": {
"gitlab-mcp": {
"type": "stdio",
"command": "node",
"args": ["/path/to/gitlab-mcp/dist/src/index.js"],
"env": {
"GITLAB_HOST": "https://gitlab.com",
"GITLAB_TOKEN": "your-token"
}
}
}
}Available Tools
Tool | Description |
| Get merge request details |
| Get MR file changes with diffs |
| List project merge requests |
| Update MR description |
| Get file content from repository |
| Analyze MR changes for code review |
| Push review comments to GitLab |
| Get code review rules for file types |
Usage Examples
# Get MR information
Get the details of MR #123 in project company/awesome-project
# Perform code review
Analyze all changes in MR #123 of project company/awesome-project
and perform a comprehensive code review, then push comments to GitLab
# Update MR description
Update the description of MR #123 with the changes summaryGitLab Token Setup
Go to GitLab → Settings → Access Tokens
Create a new token with these scopes:
api- Full API accessread_user- Read user inforead_repository- Read repository contentwrite_repository- Write repository (for comments)
Documentation
Documentation Center - Complete documentation index
User Guide (中文) - Detailed usage guide in Chinese
API Reference - Full API documentation
Configuration Guide - Environment and setup guide
Development Guide - For contributors
Development
# Development mode
pnpm dev
# Build
pnpm build
# Run tests
pnpm test
# Start server
pnpm startRoadmap
AI-powered code review with inline comments
Multi-severity issue classification (critical/warning/suggestion)
Smart review rules engine
Batch MR review support
Detailed quality reports
Performance optimizations with caching
Project-level configuration files
Contributing
Contributions are welcome! Please read our contributing guidelines before submitting PRs.
Fork the project
Create your feature branch:
git checkout -b feature/amazing-featureCommit your changes:
git commit -m 'feat: add amazing feature'Push to the branch:
git push origin feature/amazing-featureOpen a Pull Request
License
This project is licensed under the MIT License.
Acknowledgements
Model Context Protocol - MCP protocol and SDK
@gitbeaker/rest - GitLab API client
Zod - TypeScript schema validation
If this project helps you, please give it a ⭐
Made with ❤️ by the GitLab MCP Team
Available Tools
8 toolsanalyze_mr_changesB
分析合并请求的文件变更和差异信息,为代码审查提供基础数据
Inputs: projectPath (required), mergeRequestIid (required), focusFiles.
get_file_code_review_rulesC
根据文件类型和路径获取相应的代码审查规则
Inputs: filePath (required), fileExtension.
get_file_contentC
获取指定项目的文件内容
Inputs: filePath (required), projectPath (required), ref.
get_merge_requestC
获取指定项目的合并请求信息
Inputs: projectPath (required), mergeRequestIid (required).
get_merge_request_changesC
获取合并请求的文件变更列表
Inputs: projectPath (required), mergeRequestIid (required), focusFiles, includeContent.
list_merge_requestsC
列出项目的合并请求
Inputs: projectPath (required), page, state, perPage.
push_code_review_commentsB
将代码审查评论推送到GitLab MR,支持行内评论和文件级评论
Inputs: projectPath (required), reviewComments (required), mergeRequestIid (required), commentStyle, +1 more.
update_merge_request_descriptionC
更新指定合并请求的描述信息,支持Markdown格式
Inputs: description (required), projectPath (required), mergeRequestIid (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
analyze_mr_changes and get_merge_request_changes overlap significantly — both deal with an MR's changed files/diff, and an agent must read carefully to know one lists changes while the other produces review-oriented analysis. get_file_code_review_rules vs analyze_mr_changes also border on related review-prep concerns, though descriptions do help separate them.
All names are snake_case verb_noun (get_*, list_*, update_*, push_*, analyze_*), following a single predictable convention. There are no stylistic deviations or mixed casing.
Eight tools is well-scoped for a focused MR code-review assistant. Each tool maps to a distinct step in the review workflow (list, fetch, analyze, get rules, push comments).
The surface covers the read-and-comment review loop but lacks any way to read existing discussions/comments on an MR (risking duplicate comments) and has no MR create/approve/state-change operations. For a review-focused server these are notable gaps, though the core flow is usable.
Maintenance
Related MCP Connectors
Read projects, issues, merge requests and pipelines; create issues and comments in GitLab.
1Connect AI assistants to GitHub - manage repos, issues, PRs, and workflows through natural language.
Operate GitHub from your AI assistant: repos, PRs, issues, Actions. Previews and read-only mode.
AI code governance and code review for Claude Code, Copilot and Cursor. Checks rules and security.
Related MCP Servers
- AlicenseAqualityDmaintenanceConnects AI assistants to GitLab, allowing users to manage merge requests, view reviews, and interact with discussions through natural language queries.1225MIT
- AlicenseAqualityDmaintenanceEnables AI assistants to review GitLab merge requests by fetching changes, analyzing diffs, adding comments, and managing approvals through the GitLab API. Supports complete merge request analysis, file-specific reviews, and version comparisons.124MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to review GitLab merge requests by fetching diffs, analyzing code changes, adding comments, and managing approvals through the GitLab API. Supports comprehensive merge request analysis and version comparison for automated code review workflows.3MIT
- FlicenseAqualityCmaintenanceConnects AI assistants to GitLab to interact with merge requests, reviews, discussions, pipelines, and test results through natural language queries. Supports viewing MR details, responding to comments, checking test summaries, and analyzing job logs.122-