Enables interaction with GitLab repositories to manage merge requests, including listing open MRs, viewing MR details, accessing reviews and discussions, finding MRs for specific branches, replying to review comments, creating new discussion threads, and resolving discussions.
GitLab MCP Server
Connect your AI assistant to GitLab. Ask questions like "List open merge requests", "Show me reviews for MR #123", or "Find merge requests for the feature branch" directly in your chat.
Table of Contents
- Quick Setup
- What You Can Do
- Configuration Options
- Troubleshooting
- Tool Reference
- Development
- Security Notes
- Support
Quick Setup
- Install the server:
- Get your GitLab token:
- Go to GitLab → Settings → Access Tokens
- Create token with
read_api
scope - Copy the token
- Configure your project:
In your project directory, create
gitlab-mcp.env
: - Connect to Cursor:
Create
.cursor/mcp.json
in your project: - Restart Cursor and start asking GitLab questions!
What You Can Do
Once connected, try these commands in your chat:
- "List open merge requests"
- "Show me details for merge request 456"
- "Get reviews and discussions for MR #123"
- "Find merge requests for the feature/auth-improvements branch"
- "Show me closed merge requests targeting main"
- "Reply to discussion abc123 in MR #456 with 'Thanks for the feedback!'"
- "Create a new review comment in MR #789 asking about the error handling"
- "Resolve discussion def456 in MR #123"
Working with Review Comments
The enhanced review tools allow you to interact with merge request discussions:
- First, get the reviews to see discussion IDs:
- Reply to specific discussions using the discussion ID:
- Create new discussion threads to start conversations:
- Resolve discussions when issues are addressed:
Note: The get_merge_request_reviews
tool now displays discussion IDs and note IDs in the output, making it easy to reference specific discussions when replying or resolving.
Configuration Options
Project-Level (Recommended)
Each project gets its own gitlab-mcp.env
file with its own GitLab configuration. Keep tokens out of version control.
Global Configuration
Set environment variables system-wide instead of per-project:
Find Your Project ID
- Go to your GitLab project → Settings → General → Project ID
- Or check the URL:
https://gitlab.com/username/project
(use the numeric ID)
Troubleshooting
Authentication Error: Verify your token has read_api
permissions and is not expired.
Project Not Found: Double-check your project ID is correct (it's a number, not the project name).
Connection Issues: Make sure your GitLab URL is accessible and correct.
Script Not Found: Ensure the path in your MCP config points to the actual server location and the script is executable.
Tool Reference
Tool | Description | Parameters |
---|---|---|
list_merge_requests | List merge requests | state , target_branch , limit |
get_merge_request_details | Get MR details | merge_request_iid |
get_merge_request_reviews | Get reviews/discussions | merge_request_iid |
get_branch_merge_requests | Find MRs for branch | branch_name |
reply_to_review_comment | Reply to existing discussion | merge_request_iid , discussion_id , body |
create_review_comment | Create new discussion thread | merge_request_iid , body |
resolve_review_discussion | Resolve/unresolve discussion | merge_request_iid , discussion_id , resolved |
Development
Project Structure
Adding Tools
- Create new file in
tools/
- Add to
list_tools()
inmain.py
- Add handler to
call_tool()
inmain.py
Testing
Security Notes
- Add
gitlab-mcp.env
to your.gitignore
- Never commit access tokens
- Use project-specific tokens with minimal permissions
- Rotate tokens regularly
Support
- Check GitLab API documentation
- Open issues at github.com/amirsina-mandegari/gitlab-mcp-server
License
MIT License - see LICENSE file for details.
This server cannot be installed
Connects AI assistants to GitLab, allowing users to manage merge requests, view reviews, and interact with discussions through natural language queries.
Related MCP Servers
- AsecurityAlicenseAqualityEnables AI assistants to interact with GitHub through the PyGithub library, providing tools for managing issues, repositories, pull requests, and other GitHub operations with intelligent parameter handling and error management.Last updated -191PythonMIT License
- -securityFlicense-qualityA custom server implementation that allows AI assistants to interact with GitLab repositories, providing capabilities for searching, fetching files, creating/updating content, and managing issues and merge requests.Last updated -JavaScript
- -securityFlicense-qualityA set of tools allowing AI assistants to interact directly with GitHub, enabling automation of tasks like fetching user profiles, creating repositories, and managing pull requests.Last updated -Python
- AsecurityAlicenseAqualityProvides comprehensive Git operations as tools for AI assistants and applications. This server enables AI systems to interact with Git repositories, allowing to initialize, fetch, commit, log, status, etc..Last updated -105TypeScriptMIT License