GitLab MCP Server
Lets your AI agent work with GitLab projects, merge requests, issues, pipelines, wikis and releases.
2.1k stars on GitHubby zereightLicense MITUpdated 18 days ago
How to install
This MCP is local: it runs on your computer.
It works in apps installed on your PC (Claude Desktop, Claude Code, Cursor, VS Codeβ¦). Choose your app:
Paste in the terminal:
claude mcp add gitlab -- npx -y @zereight/mcp-gitlab
What to fill in
| Name | What it is | Required |
|---|---|---|
GITLAB_PERSONAL_ACCESS_TOKEN | GitLab personal access token for local stdio use. A non-empty value overrides GITLAB_PERSONAL_ACCESS_TOKEN_FILE. One of this token, GITLAB_PERSONAL_ACCESS_TOKEN_FILE, GITLAB_JOB_TOKEN, GITLAB_AUTH_COOKIE_PATH, or GITLAB_USE_OAUTH=true must be set. Create a token with the GitLab scopes the tools need, such as api or read_api. | No |
GITLAB_PERSONAL_ACCESS_TOKEN_FILE | Path to a file that contains the personal access token. Read once at startup and trimmed. Ignored when GITLAB_PERSONAL_ACCESS_TOKEN or --token is non-empty. A missing, unreadable, or empty file stops startup. Does not replace job token, OAuth, cookie, or remote authorization. | No |
GITLAB_JOB_TOKEN | Optional GitLab CI job token to use instead of a personal access token when running inside GitLab CI. | No |
GITLAB_AUTH_COOKIE_PATH | Optional path to a GitLab authentication cookie file for cookie-based authentication. | No |
GITLAB_USE_OAUTH | Set to true to start with GitLab OAuth instead of a personal access token, job token, or cookie file. | No |
GITLAB_OAUTH_CLIENT_ID | GitLab OAuth application ID. When GITLAB_USE_OAUTH=true, set this or GITLAB_OAUTH_TOKEN_SCRIPT. | No |
GITLAB_OAUTH_TOKEN_SCRIPT | Command that prints an OAuth access token. When GITLAB_USE_OAUTH=true, set this or GITLAB_OAUTH_CLIENT_ID. | No |
GITLAB_API_URL | GitLab API base URL. Use https://gitlab.com/api/v4 for GitLab.com or your self-managed GitLab API URL. | No |
GITLAB_ALLOWED_PROJECT_IDS | Optional comma-separated list of GitLab project IDs that this server is allowed to access. | No |
GITLAB_PERMISSION_MODE | Tool exposure. Allowed values are readonly, modify, and full. Unset uses full. readonly keeps read-only tools. modify blocks delete and teardown tools. | No |
GITLAB_TOOLSETS | Optional comma-separated toolset ids (projects, issues, merge_requests, β¦). Unset keeps the lean core default plus discover_tools. Do not set all unless you accept loading ~all schemas (~73k tokens). | No |
GITLAB_TOOLS | Optional comma-separated list of individual tool names to add on top of enabled toolsets. | No |
GITLAB_DENIED_TOOLS_REGEX | Optional regular expression used to hide matching tools from the server. | No |
GITLAB_TOOL_POLICY_APPROVE | Optional comma-separated list of tool names that require explicit approval before execution. | No |
GITLAB_TOOL_POLICY_HIDDEN | Optional comma-separated list of tool names to hide from tools/list. | No |
NODE_TLS_REJECT_UNAUTHORIZED | Set to 0 only when you intentionally need to connect to a GitLab instance with invalid or self-signed TLS certificates. | No |
GITLAB_CA_CERT_PATH | Optional path to a custom CA certificate file for self-managed GitLab instances. | No |
GITLAB_MASKING_ENABLED | Set to true to mask text tool results and returned errors using built-in or configured rules. | No |
GITLAB_MASKING_CONFIG | Optional path to a response-masking JSON configuration file. | No |
GITLAB_MASKING_POLICY_FILE | Optional protected server-owned JSON file containing managed masking policies. | No |
GITLAB_MASKING_WORKSPACE_DIR | Directory used to resolve response-masking configuration paths. | No |
Ready! Now test it
Restart the app and paste one of these requests in the chat:
List the changed files in merge request 123 of group/project.
Show me the output of the failed pipeline job.
What it is
This server connects your agent to GitLab through its REST and GraphQL API. It starts with 40 tools and can activate more by category, up to 288 in total. It supports gitlab.com and self-hosted instances, and a read-only mode.
What it can do
list_merge_request_changed_filesandget_merge_request_file_diff: review a merge request in two stepsget_pipeline_job_output: read job logs with paginationdiscover_tools: activate more tool categorieshelpexecute_graphql- Projects, issues, wiki, releases, tags and milestones
jmespathoption to shrink big results
When to use
- βΊWhen you want your agent to review a merge request file by file.
- βΊWhen a pipeline fails and you want the job log without opening GitLab.
- βΊWhen you want to manage issues and milestones from chat.
What you need
npm install -g @zereight/mcp-gitlab, then use the zereight-mcp-gitlab binary.Skills that pair well
MCP or skill?
The MCP gives the agent the hands. The skill teaches the right way to use them. Together, the result is better and uses fewer tokens.
gitlab-automationLets your agent automate project management in GitLab. Helps control issues, merge requests, and pipelines programmatically.building-devsecops-pipeline-with-gitlab-ciLets your agent build security into the development process. It checks code and applications for flaws before they are released.github-gitlabGives your agent access to GitHub or GitLab projects to check issues, pull requests and history, and make small approved changes.Frequently asked questions
How many tools does it show?
40 by default (38 core plus discover_tools and help). 288 exist in total.
Should I load all tools?
No. The readme says not to set GITLAB_TOOLSETS=all, which costs about 73k schema tokens. Use discover_tools instead.
How do I sign in?
With GITLAB_PERSONAL_ACCESS_TOKEN, local OAuth, MCP OAuth for Claude.ai, or per-request remote authorization.
Does it work with self-hosted GitLab?
Yes, set GITLAB_API_URL to your instance.
Can I use it without MCP?
Yes. A Skill and CLI path does the same workflows in a terminal with zereight-mcp-gitlab.
Is the api toolset safe?
The readme warns it bypasses allowlists and safety checks and can be driven by prompt injection. Enable it only on purpose.
If it does not work
- βΊCheck that the token is set and that GITLAB_API_URL is correct, for example https://gitlab.com/api/v4.
- βΊCheck your Node.js version is 20 or newer.
- βΊUse a URL-encoded project path such as group%2Fproject for project_id.
5 new skills a week. 1 minute to read.