MCP Hub
Back to servers

mcp-gitlab

MCP server for GitLab — projects, merge requests, pipelines, CI/CD, and issues.

Stars
1
Updated
Feb 27, 2026

Quick Install

uvx mcp-gitlab

mcp-gitlab

PyPI version PyPI downloads Python License: MIT CI MCP Registry

mcp-gitlab is a Model Context Protocol (MCP) server for the GitLab REST API that provides 76 tools, 6 resources, and 5 prompts for AI assistants to manage projects, merge requests, pipelines, CI/CD variables, approvals, issues, code reviews, and more. Works with Claude Desktop, Claude Code, Cursor, Windsurf, VS Code Copilot, and any MCP-compatible client.

Built with FastMCP, httpx, and Pydantic.

1-Click Installation

Install in Cursor

Install in VS Code Install in VS Code Insiders

💡 Tip: For other AI assistants (Claude Code, Windsurf, IntelliJ), visit the GitLab MCP Installation Gateway.

Manual Setup Guides (Click to expand)

Prerequisite: Install uv first (required for all uvx install flows). Install uv.

Claude Code

claude mcp add gitlab -- uvx mcp-gitlab

Windsurf & IntelliJ

Windsurf: Add to ~/.codeium/windsurf/mcp_config.json IntelliJ: Add to Settings | Tools | MCP Servers

Note: The actual server config starts at gitlab inside the mcpServers object.

{
  "mcpServers": {
    "gitlab": {
      "command": "uvx",
      "args": ["mcp-gitlab"],
      "env": {
        "GITLAB_URL": "https://gitlab.example.com",
        "GITLAB_TOKEN": "glpat-xxxxxxxxxxxxxxxxxxxx"
      }
    }
  }
}

pip / uv

uv pip install mcp-gitlab

Configuration

VariableRequiredDefaultDescription
GITLAB_URLYes-GitLab instance URL (e.g. https://gitlab.example.com)
GITLAB_TOKENYes-Authentication token (see below)
GITLAB_READ_ONLYNofalseSet to true to disable write operations
GITLAB_TIMEOUTNo30Request timeout in seconds
GITLAB_SSL_VERIFYNotrueSet to false to skip SSL verification

Supported Token Types

The server checks these environment variables in order — first match wins:

  1. GITLAB_TOKEN
  2. GITLAB_PAT
  3. GITLAB_PERSONAL_ACCESS_TOKEN
  4. GITLAB_API_TOKEN

These accept any of the following token types:

Token TypeFormatUse Case
Personal access tokenglpat-xxxUser-level access with api scope
OAuth2 tokenoauth-xxxOAuth app integrations
CI job token$CI_JOB_TOKENGitLab CI pipeline access

Compatibility

ClientSupportedInstall Method
Claude DesktopYesclaude_desktop_config.json
Claude CodeYesclaude mcp add
CursorYesOne-click deeplink or .cursor/mcp.json
VS Code CopilotYesOne-click deeplink or .vscode/mcp.json
WindsurfYes~/.codeium/windsurf/mcp_config.json
Any MCP clientYesstdio or HTTP transport

Tools (76)

CategoryCountTools
Projects4get, create, delete, update merge settings
Project Approvals10get/update config, CRUD approval rules (project + MR)
Groups6list, get, share/unshare project, share/unshare group
Branches3list, create, delete
Commits4list, get (with diff), create, compare
Merge Requests8list, get, create, update, merge, merge-sequence, rebase, changes
MR Notes6list, add, delete, update, award emoji, remove emoji
MR Discussions4list, create (inline + multi-line), reply, resolve
Pipelines5list, get (with jobs), create, retry, cancel
Jobs4retry, play, cancel, get log
Tags4list, get, create, delete
Releases5list, get, create, update, delete
CI/CD Variables8CRUD for project variables, CRUD for group variables
Issues5list, get, create, update, add comment
Full tool reference (click to expand)

Projects

ToolDescription
gitlab_get_projectGet project details
gitlab_create_projectCreate a new project
gitlab_delete_projectDelete a project
gitlab_update_project_merge_settingsUpdate merge settings

Project Approvals

ToolDescription
gitlab_get_project_approvalsGet approval config
gitlab_update_project_approvalsUpdate approval settings
gitlab_list_project_approval_rulesList approval rules
gitlab_create_project_approval_ruleCreate approval rule
gitlab_update_project_approval_ruleUpdate approval rule
gitlab_delete_project_approval_ruleDelete approval rule
gitlab_list_mr_approval_rulesList MR approval rules
gitlab_create_mr_approval_ruleCreate MR approval rule
gitlab_update_mr_approval_ruleUpdate MR approval rule
gitlab_delete_mr_approval_ruleDelete MR approval rule

Groups

ToolDescription
gitlab_list_groupsList groups
gitlab_get_groupGet group details
gitlab_share_project_with_groupShare project with group
gitlab_unshare_project_with_groupUnshare project from group
gitlab_share_group_with_groupShare group with group
gitlab_unshare_group_with_groupUnshare group from group

Branches

ToolDescription
gitlab_list_branchesList branches
gitlab_create_branchCreate a branch
gitlab_delete_branchDelete a branch

Commits

ToolDescription
gitlab_list_commitsList commits
gitlab_get_commitGet commit (with optional diff)
gitlab_create_commitCreate commit with file actions
gitlab_compareCompare branches/tags/commits

Merge Requests

ToolDescription
gitlab_list_mrsList merge requests
gitlab_get_mrGet MR details
gitlab_create_mrCreate merge request
gitlab_update_mrUpdate merge request
gitlab_merge_mrMerge a merge request
gitlab_merge_mr_sequenceMerge multiple MRs in order
gitlab_rebase_mrRebase a merge request
gitlab_mr_changesGet MR file changes

MR Notes

ToolDescription
gitlab_list_mr_notesList MR comments
gitlab_add_mr_noteAdd comment to MR
gitlab_delete_mr_noteDelete MR comment
gitlab_update_mr_noteUpdate MR comment
gitlab_award_emojiAward emoji to note
gitlab_remove_emojiRemove emoji from note

MR Discussions

ToolDescription
gitlab_list_mr_discussionsList discussions
gitlab_create_mr_discussionCreate discussion (inline + multi-line)
gitlab_reply_to_discussionReply to discussion
gitlab_resolve_discussionResolve/unresolve discussion

Pipelines

ToolDescription
gitlab_list_pipelinesList pipelines
gitlab_get_pipelineGet pipeline (with optional jobs)
gitlab_create_pipelineTrigger pipeline
gitlab_retry_pipelineRetry failed jobs
gitlab_cancel_pipelineCancel pipeline

Jobs

ToolDescription
gitlab_retry_jobRetry a job
gitlab_play_jobTrigger manual job
gitlab_cancel_jobCancel a job
gitlab_get_job_logGet job log output

Tags

ToolDescription
gitlab_list_tagsList tags
gitlab_get_tagGet tag details
gitlab_create_tagCreate a tag
gitlab_delete_tagDelete a tag

Releases

ToolDescription
gitlab_list_releasesList releases
gitlab_get_releaseGet release details
gitlab_create_releaseCreate a release
gitlab_update_releaseUpdate a release
gitlab_delete_releaseDelete a release

CI/CD Variables

ToolDescription
gitlab_list_variablesList project variables
gitlab_create_variableCreate project variable
gitlab_update_variableUpdate project variable
gitlab_delete_variableDelete project variable
gitlab_list_group_variablesList group variables
gitlab_create_group_variableCreate group variable
gitlab_update_group_variableUpdate group variable
gitlab_delete_group_variableDelete group variable

Issues

ToolDescription
gitlab_list_issuesList issues
gitlab_get_issueGet issue details
gitlab_create_issueCreate an issue
gitlab_update_issueUpdate an issue
gitlab_add_issue_commentAdd comment to issue

Resources (6)

The server exposes curated workflow guides as MCP resources that clients can read on demand.

URINameDescription
resource://rules/gitlab-ciGitLab CI/CD Pipeline PatternsStage design, job rules, caching, artifacts, needs DAG, multi-project pipelines
resource://rules/git-workflowGit Workflow StandardsBranch naming, trunk-based flow, merge vs rebase, protected branches
resource://rules/mr-hygieneMerge Request Best PracticesMR size, description templates, review checklists, thread resolution
resource://rules/conventional-commitsConventional Commits SpecCommit types, scopes, breaking changes, changelog generation
resource://guides/code-reviewCode Review StandardsReview priorities, inline comments, approval workflows, nit vs blocker
resource://guides/codeownersGitLab CODEOWNERS ReferenceSyntax, section owners, approval rules, pattern matching

Prompts (5)

The server provides MCP prompts — reusable multi-tool workflow templates that clients can surface as slash commands.

PromptParametersWorkflow
review_mrproject_id, mr_iidFetch MR → check pipeline → review changes → write discussion notes
diagnose_pipelineproject_id, pipeline_idFetch pipeline → identify failed jobs → get logs → suggest fix
prepare_releaseproject_id, tag_name, refCompare commits since last tag → draft changelog → create tag + release
setup_branch_protectionproject_idReview settings → configure merge method → set approval rules
triage_issuesproject_id, labelList open issues → categorize → prioritize → identify duplicates

Usage Examples

Projects & Branches

"Get details for project my-org/api-gateway"
→ gitlab_get_project(project_id="my-org/api-gateway")

"Create a feature branch from main"
→ gitlab_create_branch(project_id="123", branch_name="feat/login", ref="main")

"Delete all branches merged into main"
→ gitlab_list_branches(project_id="123") → filter merged → gitlab_delete_branch for each

Merge Requests & Code Review

"Open a merge request from feat/login to main"
→ gitlab_create_mr(project_id="123", source_branch="feat/login", target_branch="main", title="Add login")

"Review MR !42 — list changes and add inline comments"
→ gitlab_mr_changes(project_id="123", mr_iid=42)
→ gitlab_create_mr_discussion(project_id="123", mr_iid=42, body="nit: ...", new_path="src/auth.py", new_line=15)

"Merge MR !42 after resolving all threads"
→ gitlab_list_mr_discussions(project_id="123", mr_iid=42) → resolve unresolved
→ gitlab_merge_mr(project_id="123", mr_iid=42, squash=True)

Pipelines & CI/CD

"Show failed pipelines on main this week"
→ gitlab_list_pipelines(project_id="123", ref="main", status="failed")

"Retry a failed pipeline"
→ gitlab_retry_pipeline(project_id="123", pipeline_id=456)

"Get the build log for job 789"
→ gitlab_get_job_log(project_id="123", job_id=789, tail_lines=100)

Issues

"Create a bug report in project 123"
→ gitlab_create_issue(project_id="123", title="Login page 500 error", labels=["bug","P1"])

"Find open issues assigned to me"
→ gitlab_list_issues(project_id="123", state="opened", assignee_username="johndoe")

Security Considerations

  • Token scope: Use the minimum required scope. api scope grants full access; prefer read_api for read-only deployments.
  • Read-only mode: Set GITLAB_READ_ONLY=true to disable all write operations (create, update, delete, merge). Read-only mode is enforced server-side before any API call.
  • SSL verification: GITLAB_SSL_VERIFY=true by default. Only disable for self-signed certificates in trusted networks.
  • CI/CD variable masking: gitlab_list_variables and gitlab_list_group_variables automatically mask values of variables marked as masked in GitLab, returning ***MASKED*** instead of the actual value.
  • MCP tool annotations: Each tool declares readOnlyHint, destructiveHint, and idempotentHint for client-side permission prompts.
  • No credential storage: The server does not persist tokens. Credentials are read from environment variables at startup.

Rate Limits & Permissions

Rate Limits

GitLab enforces per-user rate limits (default: 2000 requests/minute for authenticated users). When rate-limited, tools return a 429 error with a hint to wait before retrying. Paginated endpoints default to 20 results per page; use per_page (max 100) to reduce the number of API calls.

Required Permissions

OperationMinimum GitLab Role
Read projects, MRs, pipelines, issuesReporter
Create branches, MRs, issuesDeveloper
Merge MRs, manage CI/CD variablesMaintainer
Delete projects, manage approval rulesMaintainer/Owner
Share projects/groupsOwner (or Admin)

CLI & Transport Options

# Default: stdio transport (for MCP clients)
uvx mcp-gitlab

# HTTP transport (SSE or streamable-http)
uvx mcp-gitlab --transport sse --host 127.0.0.1 --port 8000
uvx mcp-gitlab --transport streamable-http --port 9000

# CLI overrides for config
uvx mcp-gitlab --gitlab-url https://gitlab.example.com --gitlab-token glpat-xxx --read-only

The server loads .env files from the working directory automatically via python-dotenv.

Development

git clone https://github.com/vish288/mcp-gitlab.git
cd mcp-gitlab
uv sync --all-extras

uv run pytest --cov
uv run ruff check .
uv run ruff format --check .

License

MIT

Reviews

No reviews yet

Sign in to write a review