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.
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 Servercreate a merge request for the authentication feature branch"
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
@anupsahu/gitlab-mcp
MCP (Model Context Protocol) server for GitLab API with OAuth 2.0 PKCE authentication.
Related MCP server: GitHub MCP Server
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=trueAuthenticate using the
oauth_login_pkcetoolTokens are automatically saved and persist across restarts
Port requirement: OAuth callback always uses http://localhost:7171 for compatibility with GitLab's official OAuth app. Ensure port 7171 is free during authentication.
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 |
| Enable OAuth 2.0 authentication |
|
| GitLab API URL |
|
| Personal access token (if not using OAuth) | - |
| Default project ID | - |
| Comma-separated list of allowed project IDs | - |
| Enable read-only mode |
|
| Preferred localhost callback port |
|
| Fallback range for callback port (inclusive) |
|
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.jsonFormat: 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