@iflow-mcp/lynncen-gitlab-mcp-server
v2.0.0
Published
GitLab MCP Server - 提供 GitLab 集成的 MCP 服务,支持 MR 管理、文件操作和代码审查
Readme
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
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 | Get merge request details |
| get_merge_request_changes | Get MR file changes with diffs |
| list_merge_requests | List project merge requests |
| update_merge_request_description | Update MR description |
| get_file_content | Get file content from repository |
| analyze_mr_changes | Analyze MR changes for code review |
| push_code_review_comments | Push review comments to GitLab |
| get_file_code_review_rules | 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
- [x] AI-powered code review with inline comments
- [x] Multi-severity issue classification (critical/warning/suggestion)
- [x] 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-feature - Commit your changes:
git commit -m 'feat: add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open 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
