The MCP GitLab Server enables LLMs to comprehensively interact with GitLab repositories through API integration, providing project management, repository operations, and advanced automation features.
Project Management: List, search, and retrieve detailed information about GitLab projects, including auto-detection from local Git repositories
Issues: List, read, search, comment on, and generate AI-optimized summaries of project issues
Merge Requests: List, read, update (title, description, labels, assignees), approve, merge, rebase, close, manage discussions, and generate AI-friendly summaries
Repository Operations: Browse file structure, read content, create commits with multiple file changes (create, update, delete, move), view commit details and diffs, compare refs, cherry-pick commits, and manage branches/tags
CI/CD Pipelines: View pipeline status, history, and generate AI-optimized summaries
Advanced Operations: Execute atomic batch operations with rollback support, generate structured diffs with intelligent chunking (
gitlab_smart_diff
), and safely preview commits (gitlab_safe_preview_commit
)Search: Search projects globally and within repositories across issues, merge requests, commits, and other scopes
User & Project Information: List project members, user events, releases, and webhooks
AI Tools: Generate summaries and structured data optimized for efficient LLM context usage across issues, MRs, and pipelines
Provides comprehensive GitLab API integration enabling management of projects, issues, merge requests, repository files, branches, CI/CD pipelines, and discussions. Includes advanced features like batch operations, AI-optimized summaries, and smart diffs.
MCP GitLab Server
A Model Context Protocol (MCP) server that provides comprehensive GitLab API integration. This server enables LLMs to interact with GitLab repositories, manage merge requests, issues, and perform various Git operations.
Features
Core Features
- 🔐 Authentication & Users - Get current user info and lookup user profiles
- 🔍 Project Management - List, search, and get details about GitLab projects
- 📝 Issues - List, read, search, and comment on issues
- 🔀 Merge Requests - List, read, update, approve, and merge MRs
- 📁 Repository Files - Browse, read, and commit changes to files
- 🌳 Branches & Tags - List and manage branches and tags
- 🔧 CI/CD Pipelines - View pipeline status, jobs, and artifacts
- 💬 Discussions - Read and resolve merge request discussions
- 🎯 Smart Operations - Batch operations, AI summaries, and smart diffs
Advanced Features
- Batch Operations - Execute multiple GitLab operations atomically with rollback support
- AI-Optimized Summaries - Generate concise summaries of MRs, issues, and pipelines
- Smart Diffs - Get structured diffs with configurable context and size limits
- Safe Preview - Preview file changes before committing
- Cross-Reference Support - Reference results from previous operations in batch mode
Installation
Using uvx (recommended - no installation needed)
From source
Configuration
Environment Variables
Set one of the following authentication tokens:
Getting a GitLab Token
- Go to your GitLab profile settings
- Navigate to "Access Tokens"
- Create a new token with the following scopes:
api
- Full API accessread_repository
- Read repository contentwrite_repository
- Write repository content (for commits)
Usage
With Claude Desktop
Add to your Claude Desktop configuration:
Using uvx (recommended - no installation needed):
Using uv (if you've cloned the repository):
Replace /path/to/mcp-gitlab
with the full path to where you cloned the repository.
Running with uvx
The easiest way to run the MCP GitLab server is using uvx
:
Standalone Usage
Available Tools
Authentication & User Info
gitlab_get_current_user
Get the currently authenticated user's profile information.
Returns comprehensive information including:
- Basic info: ID, username, name, email
- Profile details: bio, organization, job title
- Account status: state, creation date, admin status
- Permissions: can_create_group, can_create_project
- Security: two_factor_enabled, external status
gitlab_get_user
Get details for a specific user by ID or username.
or
Returns user information including:
- Basic info: ID, username, name
- Profile: avatar_url, web_url, bio
- Organization details: company, job title
- Account status and creation date
Project Management
gitlab_list_projects
List accessible GitLab projects with pagination and search.
gitlab_get_project
Get detailed information about a specific project.
gitlab_get_current_project
Get the GitLab project information from the current git repository.
Issues
gitlab_list_issues
List project issues with state filtering.
gitlab_get_issue
Get a single issue with full details.
gitlab_add_issue_comment
Add a comment to an issue.
Merge Requests
gitlab_list_merge_requests
List merge requests with filtering options.
gitlab_get_merge_request
Get detailed merge request information.
gitlab_update_merge_request
Update merge request fields.
gitlab_merge_merge_request
Merge a merge request with options.
gitlab_approve_merge_request
Approve a merge request.
Repository Operations
gitlab_get_file_content
Read file content from the repository.
gitlab_create_commit
Create a commit with multiple file changes.
gitlab_compare_refs
Compare two branches, tags, or commits.
CI/CD Jobs and Artifacts
gitlab_list_pipeline_jobs
List jobs in a specific CI/CD pipeline.
gitlab_list_project_jobs
List jobs for a project with optional scope filtering.
gitlab_download_job_artifact
Get information about job artifacts (security note: content not downloaded).
Advanced Tools
gitlab_batch_operations
Execute multiple operations atomically with rollback support.
gitlab_summarize_merge_request
Generate an AI-friendly summary of a merge request.
gitlab_smart_diff
Get a structured diff with context and size limits.
User & Profile Management
gitlab_search_user
Search for GitLab users by name, username, or email.
gitlab_get_user_details
Get comprehensive user profile and metadata.
gitlab_get_my_profile
Get the current authenticated user's complete profile.
gitlab_get_user_contributions_summary
Summarize user's recent contributions across issues, MRs, and commits.
gitlab_get_user_activity_feed
Retrieve user's complete activity/events timeline.
User's Issues & Merge Requests
gitlab_get_user_open_mrs
Get all open merge requests authored by a user.
gitlab_get_user_review_requests
Get MRs where user is assigned as reviewer with pending action.
gitlab_get_user_open_issues
Get open issues assigned to a user, prioritized by severity/SLA.
gitlab_get_user_reported_issues
Get issues reported/created by a user.
gitlab_get_user_resolved_issues
Get issues closed/resolved by a user.
User's Code & Commits
gitlab_get_user_commits
Get commits authored by a user within date range or branch.
Complete Tool List
- Projects:
gitlab_list_projects
,gitlab_get_project
,gitlab_get_current_project
,gitlab_search_projects
- Issues:
gitlab_list_issues
,gitlab_get_issue
,gitlab_add_issue_comment
,gitlab_summarize_issue
- Merge Requests:
gitlab_list_merge_requests
,gitlab_get_merge_request
,gitlab_update_merge_request
,gitlab_close_merge_request
,gitlab_merge_merge_request
,gitlab_add_merge_request_comment
,gitlab_get_merge_request_notes
,gitlab_approve_merge_request
,gitlab_get_merge_request_approvals
,gitlab_get_merge_request_discussions
,gitlab_resolve_discussion
,gitlab_get_merge_request_changes
,gitlab_rebase_merge_request
- Repository:
gitlab_get_file_content
,gitlab_list_repository_tree
,gitlab_list_commits
,gitlab_get_commit
,gitlab_get_commit_diff
,gitlab_create_commit
,gitlab_cherry_pick_commit
,gitlab_compare_refs
,gitlab_list_tags
- Branches:
gitlab_list_branches
- Pipelines & Jobs:
gitlab_list_pipelines
,gitlab_list_pipeline_jobs
,gitlab_list_project_jobs
,gitlab_download_job_artifact
,gitlab_summarize_pipeline
- Search:
gitlab_search_projects
,gitlab_search_in_project
- Users:
gitlab_get_current_user
,gitlab_get_user
,gitlab_list_user_events
,gitlab_list_project_members
- User & Profile:
gitlab_search_user
,gitlab_get_user_details
,gitlab_get_my_profile
,gitlab_get_user_contributions_summary
,gitlab_get_user_activity_feed
- User's Issues & MRs:
gitlab_get_user_open_mrs
,gitlab_get_user_review_requests
,gitlab_get_user_open_issues
,gitlab_get_user_reported_issues
,gitlab_get_user_resolved_issues
- User's Code & Commits:
gitlab_get_user_commits
- Releases:
gitlab_list_releases
- Webhooks:
gitlab_list_project_hooks
- AI Tools:
gitlab_summarize_merge_request
,gitlab_summarize_issue
,gitlab_summarize_pipeline
- Advanced:
gitlab_batch_operations
,gitlab_smart_diff
,gitlab_safe_preview_commit
Examples
Auto-detect and List Issues
Create a Fix with Batch Operations
Development
Quick Start
CI/CD Pipeline
This project uses GitHub Actions for continuous integration and deployment:
- CI Pipeline: Runs on every push and PR
- Linting (Ruff, Black, isort, MyPy)
- Testing (pytest with coverage)
- Security scanning (Bandit, Safety, pip-audit)
- Multi-version Python testing (3.10, 3.11, 3.12)
- Code Quality:
- SonarCloud analysis
- CodeQL security analysis
- Complexity metrics (Radon, Xenon)
- Release Pipeline: Automated releases on version tags
- PyPI package publishing
- Docker image building and publishing
- GitHub release creation
Running Tests
Code Style
The project uses:
- Black for code formatting
- isort for import sorting
- flake8 for linting
- mypy for type checking
Troubleshooting
Authentication Issues
- Ensure your token has the required scopes (
api
,read_repository
,write_repository
) - Check token expiration date
- Verify GitLab URL if using self-hosted instance
Rate Limiting
GitLab API has rate limits. The server handles rate limit errors gracefully and returns appropriate error messages.
Large Responses
Responses are automatically truncated if they exceed size limits. Use pagination parameters to retrieve data in chunks.
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Acknowledgments
- Built on the Model Context Protocol
- Uses python-gitlab for GitLab API interaction
- Inspired by the need for better LLM-GitLab integration
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Tools
Enables comprehensive GitLab integration allowing LLMs to manage projects, issues, merge requests, repository files, CI/CD pipelines, and perform batch operations. Supports advanced features like AI-optimized summaries, smart diffs, and atomic operations with rollback support.
Related MCP Servers
- -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 -1
- -securityFlicense-qualityProvides GitLab integration for AI assistants using Model Context Protocol, enabling repository operations, file management, issue tracking, merge requests, and branch/tag administration through natural language.Last updated -2
- -securityFlicense-qualityConnects AI assistants to GitLab, allowing users to manage merge requests, view reviews, and interact with discussions through natural language queries.Last updated -8
- -securityAlicense-qualityEnables interaction with GitLab repositories through secure OAuth 2.0 authentication. Supports comprehensive GitLab operations including merge requests, issues, file management, commits, and branch operations through natural language.Last updated -479MIT License