nguyenvanduocit/gitlab-mcp
If you are the rightful owner of gitlab-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
GitLab MCP is a tool for interacting with the GitLab API through the Model Context Protocol (MCP).
GitLab MCP
A comprehensive Go-based MCP (Model Context Protocol) connector for GitLab that enables AI assistants like Claude to interact seamlessly with GitLab repositories, projects, and workflows. This tool provides a powerful interface for AI models to perform comprehensive GitLab operations through natural language.
WHY
While GitLab provides various API integrations, our MCP implementation offers superior AI-native interaction and comprehensive workflow management. We've built this connector to address the real challenges developers and project managers face when working with GitLab through AI assistants.
Key Advantages:
- Comprehensive GitLab Integration: Full access to projects, merge requests, pipelines, commits, CI/CD jobs, and user management
- AI-Optimized Interface: Designed specifically for natural language interactions with AI assistants
- Real-World Workflow Focus: Built to solve actual daily problems like code review, CI/CD monitoring, and project management
- Enhanced Productivity: Seamless integration allowing AI to help with GitLab operations without context switching
- Developer-Friendly: Tools designed for actual development workflows, not just basic API calls
š Features Overview
š Project & Repository Management
- List and explore projects with detailed information and access levels
- Get file content from any repository with branch/commit support
- Browse repository structure and navigate codebases
- Access project metadata including statistics and configuration
š Merge Request Operations
- List merge requests with filtering by state, author, and target branch
- Get detailed MR information including changes, discussions, and approvals
- Create new merge requests with custom titles and descriptions
- Comment on merge requests and manage discussions
- Monitor merge request status and review progress
- Get MR pipelines and commits for comprehensive review
- Rebase merge requests when needed
š Pipeline & CI/CD Management
- List and analyze pipelines with status and duration information
- Get detailed pipeline information including jobs and artifacts
- Trigger new pipelines with custom variables
- Monitor pipeline execution and job details
- Track CI/CD performance across projects
š¼ Job Management
- List project and pipeline jobs with filtering capabilities
- Get detailed job information including logs and artifacts
- Cancel running jobs when needed
- Retry failed jobs for quick recovery
- Monitor job status across pipelines
š Commit & History Tracking
- Search and list commits with author, date, and message filtering
- Get detailed commit information including changes and statistics
- Search commits by author and file path for targeted analysis
- Comment on commits for code review
- Cherry-pick and revert commits for branch management
- Track repository history and development progress
š Git Flow Workflow Support
- Create release branches following Git Flow conventions
- Create feature branches with proper naming
- Create hotfix branches for urgent fixes
- Finish releases by creating merge requests to develop and master
- Finish features by creating merge requests to develop
- Finish hotfixes by creating merge requests to both branches
- List Git Flow branches by type (feature, release, hotfix)
š„ User & Group Management
- View user contribution events and activity streams
- List group members and their roles
- List accessible groups with filtering options
- Track user contributions across projects
- Monitor team activity and collaboration
š Variable & Security Management
- List group variables with security information
- Create and update group variables with proper scoping
- Manage variable security (protected, masked, raw)
- Remove variables when no longer needed
- Handle environment-specific variables
š Deployment & Token Management
- List deploy tokens for projects and groups
- Create deploy tokens with specific scopes
- Manage token permissions and expiration
- Delete tokens when no longer needed
- Handle both project and group-level tokens
š Advanced Search Capabilities
- Global search across all GitLab content
- Group-specific search within organizations
- Project-specific search for targeted results
- Search by scope (projects, merge requests, commits, users, code)
- Specialized search tools for issues, merge requests, commits, and code
š Quick Start Guide
Prerequisites
Before you begin, you'll need:
- GitLab Account with access to your GitLab instance (GitLab.com or self-hosted)
- Personal Access Token from GitLab (we'll help you get this)
- Cursor IDE with Claude integration
Step 1: Get Your GitLab Personal Access Token
- Go to your GitLab instance ā User Settings ā Access Tokens
- Click "Add new token"
- Give it a name like "GitLab MCP Connector"
- Select scopes:
api,read_user,read_repository,write_repository - Set expiration date (optional)
- Click "Create personal access token"
- Copy the token (you won't see it again!)
Step 2: Choose Your Installation Method
We recommend Docker for the easiest setup:
š³ Option A: Docker (Recommended)
# Pull the latest image
docker pull ghcr.io/nguyenvanduocit/gitlab-mcp:latest
# Test it works (replace with your details)
docker run --rm \
-e GITLAB_URL=https://gitlab.com \
-e GITLAB_TOKEN=your-personal-access-token \
ghcr.io/nguyenvanduocit/gitlab-mcp:latest
š¦ Option B: Download Binary
- Go to GitHub Releases
- Download for your platform:
- macOS:
gitlab-mcp_darwin_amd64 - Linux:
gitlab-mcp_linux_amd64 - Windows:
gitlab-mcp_windows_amd64.exe
- macOS:
- Make it executable (macOS/Linux):
chmod +x gitlab-mcp_* sudo mv gitlab-mcp_* /usr/local/bin/gitlab-mcp
š ļø Option C: Build from Source
go install github.com/nguyenvanduocit/gitlab-mcp@latest
Step 3: Configure Cursor
- Open Cursor
- Go to Settings ā Features ā Model Context Protocol
- Add a new MCP server with this configuration:
For Docker Users:
{
"mcpServers": {
"gitlab": {
"command": "docker",
"args": [
"run", "--rm", "-i",
"-e", "GITLAB_URL=https://gitlab.com",
"-e", "GITLAB_TOKEN=your-personal-access-token",
"ghcr.io/nguyenvanduocit/gitlab-mcp:latest"
]
}
}
}
For Binary Users:
{
"mcpServers": {
"gitlab": {
"command": "/usr/local/bin/gitlab-mcp",
"env": {
"GITLAB_URL": "https://gitlab.com",
"GITLAB_TOKEN": "your-personal-access-token"
}
}
}
}
For Self-Hosted GitLab:
Replace https://gitlab.com with your GitLab instance URL (e.g., https://gitlab.yourcompany.com)
Step 4: Test Your Setup
- Restart Cursor completely
- Open a new chat with Claude
- Try these test commands:
List my GitLab groups
Show me recent merge requests in my projects
What's the status of the latest pipeline?
If you see GitLab data, congratulations! š You're all set up.
š§ Advanced Configuration
Using Environment Files
Create a .env file for easier management:
# .env file
GITLAB_URL=https://gitlab.com
GITLAB_TOKEN=your-personal-access-token
Then use it:
# With binary
gitlab-mcp -env .env
# With Docker
docker run --rm -i --env-file .env ghcr.io/nguyenvanduocit/gitlab-mcp:latest
HTTP Mode for Development
For development and testing, you can run in HTTP mode:
# Start HTTP server on port 3000
gitlab-mcp -env .env -http_port 3000
Then configure Cursor with:
{
"mcpServers": {
"gitlab": {
"url": "http://localhost:3000/mcp"
}
}
}
šÆ Usage Examples
Once configured, you can ask Claude to help with GitLab tasks using natural language:
Project & Repository Management
- "Show me all my GitLab groups"
- "List projects in group 'my-team'"
- "Get the README file from the main branch of project X"
- "What are the recent changes in project Z?"
Merge Request Operations
- "Show me all open merge requests in project ABC"
- "Create a merge request from feature-branch to develop"
- "What's the status of MR #123 in project ABC?"
- "Add a comment to merge request #456 saying 'LGTM'"
- "Show me the pipeline status for MR #789"
Pipeline & CI/CD Management
- "What's the status of the latest pipeline in project X?"
- "Trigger a new pipeline on the develop branch"
- "Show me failed pipelines from the last week"
- "List all running jobs in project Y"
- "Cancel job #123 in project Z"
Git Flow Workflows
- "Create a release branch for version 1.2.0"
- "Create a feature branch called user-authentication"
- "Finish the release 1.2.0 and create merge requests"
- "List all feature branches in the project"
Search & Discovery
- "Search for commits containing 'bug fix' across all projects"
- "Find merge requests related to authentication in group X"
- "Search for code containing 'API_KEY' in project Y"
- "Show me all users in group Z"
Variable & Security Management
- "List all variables in group 'production'"
- "Create a new variable DATABASE_URL in group X"
- "Show me deploy tokens for project Y"
Development Insights
- "Show me recent commits by author John"
- "What commits were made to the main branch today?"
- "List all commits with 'fix' in the message"
- "Show me user activity for the development team"
š ļø Available Tools Reference
Project Tools
list_projects- List projects in a groupget_project- Get detailed project information
Merge Request Tools
list_mrs- List merge requests with filteringget_mr_details- Get detailed MR informationcreate_mr- Create new merge requestscreate_mr_note- Add comments to merge requestslist_mr_comments- List all MR commentsget_mr_pipelines- Get MR pipeline informationget_mr_commits- Get MR commit historycreate_mr_pipeline- Trigger new MR pipelinerebase_mr- Rebase merge requests
Repository Tools
get_file_content- Get file content from repositorieslist_commits- List commits with date filteringget_commit_details- Get detailed commit informationsearch_commits- Search commits by author/path/dateget_commit_comments- Get commit commentspost_commit_comment- Add comments to commitsget_commit_merge_requests- Get MRs associated with commitscherry_pick_commit- Cherry-pick commits to other branchesrevert_commit- Revert commits
Pipeline Tools
list_pipelines- List project pipelinesget_pipeline- Get detailed pipeline informationtrigger_pipeline- Trigger new pipelines with variables
Job Tools
list_project_jobs- List all project jobslist_pipeline_jobs- List jobs for specific pipelineget_job- Get detailed job informationcancel_job- Cancel running jobsretry_job- Retry failed jobs
Git Flow Tools
gitflow_create_release- Create release branchesgitflow_finish_release- Finish releases with MRsgitflow_create_feature- Create feature branchesgitflow_finish_feature- Finish features with MRsgitflow_create_hotfix- Create hotfix branchesgitflow_finish_hotfix- Finish hotfixes with MRsgitflow_list_branches- List Git Flow branches
User & Group Tools
list_user_contribution_events- List user activitylist_group_users- List group memberslist_groups- List accessible groups
Variable Tools
list_group_variables- List group variablesget_group_variable- Get specific variable detailscreate_group_variable- Create new variablesupdate_group_variable- Update existing variablesremove_group_variable- Remove variables
Deployment Tools
list_all_deploy_tokens- List all deploy tokens (admin)list_project_deploy_tokens- List project deploy tokensget_project_deploy_token- Get project token detailscreate_project_deploy_token- Create project tokensdelete_project_deploy_token- Delete project tokenslist_group_deploy_tokens- List group deploy tokensget_group_deploy_token- Get group token detailscreate_group_deploy_token- Create group tokensdelete_group_deploy_token- Delete group tokens
Search Tools
search_global- Search across all GitLabsearch_group- Search within specific groupssearch_project- Search within specific projectssearch_issues_global- Global issue searchsearch_merge_requests_global- Global MR searchsearch_commits_global- Global commit searchsearch_code_global- Global code search
š ļø Troubleshooting
Common Issues
ā "Connection failed" or "Authentication error"
- Double-check your
GITLAB_URL(should include https://) - Verify your personal access token is correct and not expired
- Make sure your token has the required scopes (
api,read_user,read_repository,write_repository)
ā "No MCP servers found"
- Restart Cursor completely after adding the configuration
- Check the MCP configuration syntax in Cursor settings
- Verify the binary path is correct (for binary installations)
ā "Permission denied" errors
- Make sure your GitLab account has access to the projects you're trying to access
- Check if your personal access token has the necessary permissions
- Verify you're using the correct GitLab instance URL
ā "Rate limit exceeded"
- GitLab has API rate limits; wait a moment before retrying
- Consider using a more specific query to reduce API calls
ā "Missing required environment variables"
- Ensure both
GITLAB_URLandGITLAB_TOKENare set - Check that environment variables are properly loaded from .env file
Getting Help
- Check the logs: Run with
-http_portto see detailed error messages - Test your credentials: Try the Docker test command from Step 2
- Verify Cursor config: The app will show you the exact configuration to use
- Check GitLab permissions: Ensure your token has access to the resources you need
š Development
For local development and contributing:
# Clone the repository
git clone https://github.com/nguyenvanduocit/gitlab-mcp.git
cd gitlab-mcp
# Create .env file with your credentials
cp .env.example .env
# Edit .env with your details
# Run in development mode
just dev
# or
go run main.go -env .env
# Build the project
just build
# Install locally
just install
# Test with MCP inspector (if running in HTTP mode)
npx @modelcontextprotocol/inspector http://localhost:3000/mcp
Project Structure
gitlab-mcp/
āāā bin/ # Compiled binaries
āāā tools/ # Tool implementations
ā āāā projects.go # Project management tools
ā āāā merge_requests.go # MR management tools
ā āāā repositories.go # Repository and commit tools
ā āāā pipelines.go # Pipeline management tools
ā āāā job.go # CI/CD job tools
ā āāā flow.go # Git Flow workflow tools
ā āāā users.go # User management tools
ā āāā groups.go # Group management tools
ā āāā variable.go # Variable management tools
ā āāā deploy.go # Deployment token tools
ā āāā search.go # Search functionality tools
āāā util/ # Utility functions
āāā main.go # Application entry point
āāā go.mod # Go module definition
āāā justfile # Build automation
āāā README.md # This file
š¤ Contributing
We welcome contributions! Here's how to get started:
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'feat: add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Contribution Guidelines
- Follow Conventional Commits for commit messages
- Add tests for new features
- Update documentation as needed
- Ensure all tests pass before submitting
š License
This project is licensed under the MIT License - see the file for details.
Need help? Check our for recent updates or open an issue on GitHub.