Enables comprehensive management of GitLab projects, allowing AI agents to list and manage merge requests, analyze CI/CD pipeline failures with suggested fixes, view job logs, and search repository code.
Supports the generation and management of Architecture Decision Records (ADR) formatted specifically in Markdown for documentation and architectural tracking.
Click on "Install 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 Serveranalyze why the latest pipeline failed and suggest a fix"
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
An MCP (Model Context Protocol) server for integrating GitLab with AI assistants like Cursor, ChatGPT, and any polymcp-compatible client. Manage merge requests, analyze CI/CD pipelines, create ADR documents, and more.
What it does
This project exposes GitLab APIs through the MCP protocol, allowing AI assistants to:
List and manage merge requests
Analyze failed pipeline jobs with fix suggestions
Create ADR (Architecture Decision Records) documents in markdown
View CI/CD job logs
Trigger pipelines and retry failed jobs
Deploy to AWS, Azure, and GCP
Requirements
Python 3.8 or higher
PolyMCP (for AI agent integration)
FastAPI and uvicorn (for HTTP server)
Installation
Contents of requirements.txt:
Configuration
Create a .env file in the project root:
Usage with PolyMCP
This server is fully compatible with the polymcp library. Here is how to use it:
1. Start the server
2. Connect with polymcp
Create a file gitlab_chat.py:
3. Run it
Example session:
Usage with Cursor
Method 1 - Direct import
Copy cursor_tools.py to your project and use it directly:
Method 2 - MCP Configuration
Add to .cursor/mcp_config.json:
Usage with ChatGPT
Start the server and expose it publicly (with ngrok or similar):
Create a Custom GPT with Actions pointing to the ngrok URL
Or use Code Interpreter by uploading
gitlab_assistant.py
Safety Features
The server includes built-in protections:
Feature | Default | What it does |
Safe Mode |
| Blocks write operations until you're ready |
Dry Run |
| Test operations without executing them |
Project Allowlist |
| Use |
Rate Limiting | 60/min | Prevents API abuse |
π‘ Start with
SAFE_MODE=trueto explore safely, then disable when needed.
Available Tools
Merge Request Management
Tool | Description |
| List merge requests with filters (state, author, assignee) |
| Get MR details including changes and discussions |
| Create a new merge request |
| Approve a merge request |
| Merge a merge request into target branch |
| Rebase a merge request onto target branch |
Code Search
Tool | Description |
| Search for code across project files |
Pipeline & CI/CD
Tool | Description |
| List all jobs in a pipeline with status |
| Get the log output of a specific job |
| Analyze failures and suggest fixes |
| Trigger a new pipeline run |
| Retry all failed jobs in a pipeline |
| Cancel a running pipeline |
| Retry a specific failed job |
ADR (Architecture Decision Records)
Tool | Description |
| Create an ADR document in Markdown format |
| Commit ADR to repository with optional MR |
Cloud Deployment
Tool | Description |
| Deploy to AWS, Azure, or GCP via pipeline |
Security
To use the server safely with Cursor or other AI assistants:
Create a GitLab token with minimal permissions (only
read_apiandread_repository)Enable
SAFE_MODE=truein the .env file to disable destructive operationsUse
DRY_RUN=trueto simulate operations without executing themLimit accessible projects by configuring
ALLOWED_PROJECTS
The server tracks all operations and provides usage statistics.
Project Structure
Troubleshooting
Error | Solution |
| Create |
| Set |
| Check token permissions or |
| Increase |
Contributing
Contributions are welcome. Open an issue to discuss significant changes before proceeding with a pull request.
License
MIT License - see LICENSE file for details.
Useful Links
GitLab API Documentation: https://docs.gitlab.com/ee/api/
Model Context Protocol: https://modelcontextprotocol.io/
PolyMCP: https://github.com/poly-mcp/polymcp