Provides comprehensive GitLab API integration with OAuth 2.0 PKCE authentication, enabling management of repositories, merge requests, issues, commits, branches, and files. Supports operations like creating merge requests, updating issues, pushing files, and searching repositories with automatic token refresh and persistence.
GitLab MCP Server
@anupsahu/gitlab-mcp
Production-ready MCP (Model Context Protocol) server for GitLab API with OAuth 2.0 PKCE authentication.
Features
- 🔐 OAuth 2.0 PKCE Authentication - Secure authentication with token persistence
- 🔄 Automatic Token Refresh - Seamless token renewal with retry logic
- 📁 Complete GitLab API Coverage - Merge requests, issues, files, commits, and more
- 💾 Token Persistence - Sessions survive server restarts
- 🛡️ Production Ready - Clean codebase with comprehensive error handling
- 🔧 Easy Configuration - Simple setup with environment variables
Installation
Quick Start
1. OAuth Authentication (Recommended)
2. Personal Access Token (Alternative)
OAuth Authentication
The server supports OAuth 2.0 PKCE authentication for secure access to GitLab:
- Start the server with
USE_OAUTH=true
- Authenticate using the
oauth_login_pkce
tool - Tokens are automatically saved and persist across restarts
- Automatic token refresh handles expiration seamlessly
OAuth Tools
oauth_login_pkce
- Initiate OAuth authenticationoauth_status
- Check authentication statusoauth_logout
- Logout and clear tokens
Configuration
Environment Variables
Variable | Description | Default |
---|---|---|
USE_OAUTH | Enable OAuth 2.0 authentication | false |
GITLAB_API_URL | GitLab API URL | https://gitlab.com/api/v4 |
GITLAB_PERSONAL_ACCESS_TOKEN | Personal access token (if not using OAuth) | - |
GITLAB_PROJECT_ID | Default project ID | - |
GITLAB_ALLOWED_PROJECT_IDS | Comma-separated list of allowed project IDs | - |
GITLAB_READ_ONLY_MODE | Enable read-only mode | false |
Available Tools
Repository Operations
search_repositories
- Search for repositoriesget_repository_tree
- Get repository file treeget_file_contents
- Read file contentscreate_or_update_file
- Create or update filespush_files
- Push multiple files
Merge Request Operations
get_merge_request
- Get merge request detailsget_merge_request_diffs
- Get merge request changescreate_merge_request
- Create new merge requestupdate_merge_request
- Update merge requestmerge_merge_request
- Merge a merge request
Issue Operations
create_issue
- Create new issueget_issue
- Get issue detailsupdate_issue
- Update issuelist_issues
- List issues
Commit Operations
list_commits
- List repository commitsget_commit
- Get commit detailsget_commit_diff
- Get commit changes
Branch Operations
create_branch
- Create new branchfork_repository
- Fork repository
Token Storage
OAuth tokens are automatically saved to:
- Path:
~/.config/gitlab-mcp/oauth-config.json
- Format: JSON configuration file
- Persistence: Tokens survive server restarts
- Security: Automatic token refresh and expiration handling
Examples
Authenticate with OAuth
Get Merge Request Details
Create Issue
Development
License
MIT License - see LICENSE file for details.
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a merge request
Support
For issues and questions:
- Create an issue in the GitLab repository
- Check existing documentation and examples
Built with ❤️ for the MCP ecosystem
This server cannot be installed
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.
Enables 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.
Related MCP Servers
- -securityFlicense-qualityFacilitates authentication with GitHub using OAuth protocol, allowing secure access and interaction with GitHub repositories and services.Last updated -4Python
- AsecurityFlicenseAqualityEnables comprehensive GitHub operations through natural language including file management, repository administration, issue tracking, and advanced code searching.Last updated -4701TypeScript
- -securityAlicense-qualityEnables interaction with GitHub repositories through the GitHub API, allowing file operations, repository management, issue tracking, and code search through natural language commands.Last updated -32TypeScriptMIT License
- -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 -1Python