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.
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
- 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
- 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
- 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
- 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
- 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
- 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)
- 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
- 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
- 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
- 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
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
- 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!)
We recommend Docker for the easiest setup:
# 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- 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
go install github.com/nguyenvanduocit/gitlab-mcp@latest- Open Cursor
- Go to Settings β Features β Model Context Protocol
- Add a new MCP server with this configuration:
{
"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"
]
}
}
}{
"mcpServers": {
"gitlab": {
"command": "/usr/local/bin/gitlab-mcp",
"env": {
"GITLAB_URL": "https://gitlab.com",
"GITLAB_TOKEN": "your-personal-access-token"
}
}
}
}Replace https://gitlab.com with your GitLab instance URL (e.g., https://gitlab.yourcompany.com)
- 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.
Create a .env file for easier management:
# .env file
GITLAB_URL=https://gitlab.com
GITLAB_TOKEN=your-personal-access-tokenThen use it:
# With binary
gitlab-mcp -env .env
# With Docker
docker run --rm -i --env-file .env ghcr.io/nguyenvanduocit/gitlab-mcp:latestFor development and testing, you can run in HTTP mode:
# Start HTTP server on port 3000
gitlab-mcp -env .env -http_port 3000Then configure Cursor with:
{
"mcpServers": {
"gitlab": {
"url": "http://localhost:3000/mcp"
}
}
}Once configured, you can ask Claude to help with GitLab tasks using natural language:
- "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?"
- "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"
- "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"
- "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 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"
- "List all variables in group 'production'"
- "Create a new variable DATABASE_URL in group X"
- "Show me deploy tokens for project Y"
- "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"
list_projects- List projects in a groupget_project- Get detailed project information
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
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
list_pipelines- List project pipelinesget_pipeline- Get detailed pipeline informationtrigger_pipeline- Trigger new pipelines with variables
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
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
list_user_contribution_events- List user activitylist_group_users- List group memberslist_groups- List accessible groups
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
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_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
β "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
- 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
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/mcpgitlab-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
In addition to the MCP server, gitlab-mcp ships a standalone CLI binary (gitlab-cli) for direct terminal use β no MCP client needed.
just install-cli
# or
go install github.com/nguyenvanduocit/gitlab-mcp/cmd/gitlab-cli@latestexport GITLAB_URL=https://gitlab.com
export GITLAB_TOKEN=your-access-token
# or
gitlab-cli --env .env <command> [flags]| Command | Description |
|---|---|
list-projects |
List GitLab projects |
list-mrs |
List merge requests |
list-pipelines |
List pipelines |
list-branches |
List branches |
list-jobs |
List CI/CD jobs |
list-users |
List group members |
list-groups |
List groups |
manage-variable |
Manage CI/CD variables |
trigger-pipeline |
Trigger a pipeline |
search |
Search across GitLab |
# List projects
gitlab-cli list-projects --search my-repo
# List open MRs
gitlab-cli list-mrs --project-id 123 --state opened
# Trigger pipeline
gitlab-cli trigger-pipeline --project-id 123 --ref main
# JSON output
gitlab-cli list-projects --output json | jq '.[].path_with_namespace'Every command accepts:
--env stringβ Path to.envfile--output stringβ Output format:text(default) orjson
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
- Follow Conventional Commits for commit messages
- Add tests for new features
- Update documentation as needed
- Ensure all tests pass before submitting
This project is licensed under the MIT License - see the LICENSE file for details.
Need help? Check our CHANGELOG.md for recent updates or open an issue on GitHub.
brew install nguyenvanduocit/tap/gitlab-mcp