How to connect GitLab to Claude Code
GitLab MCP Server is published by zereight and is not marked as the vendor's own. It runs on your machine through npx. The listing treats GITLAB_PERSONAL_ACCESS_TOKEN and GITLAB_JOB_TOKEN as optional, though its notes say one authentication option must be set. This guide registers it in Claude Code using the listing's install data and Claude Code's docs.
Updated Oct 26, 2026 · Built from catalog data; how we rank and grade
Checked against Claude Code's documentation on Oct 26, 2026. Commands and config blocks are generated from the same install data as each listing page.
Before you start
- Claude Code installed and able to start.
- Node.js with npx (the server starts with npx).
- GITLAB_PERSONAL_ACCESS_TOKEN (optional): 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.
- GITLAB_JOB_TOKEN (optional): Optional GitLab CI job token to use instead of a personal access token when running inside GitLab CI.
1. Check what you need
Claude Code launches this server with
npx, so Node.js comes first. Runnode --versionto see whether it is there.Check that it is installed node --version- It can take GITLAB_PERSONAL_ACCESS_TOKEN and GITLAB_JOB_TOKEN (next step).
2. Get GITLAB_PERSONAL_ACCESS_TOKEN and GITLAB_JOB_TOKEN
Both values are marked optional in the listing and suit different situations: a personal token for local use and a job token for GitLab CI. Decide which fits how you run the server.
- GITLAB_PERSONAL_ACCESS_TOKEN (optional): 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.
- GITLAB_JOB_TOKEN (optional): Optional GitLab CI job token to use instead of a personal access token when running inside GitLab CI.
3. Add GitLab MCP Server to Claude Code
The command passes both variables to the server with --env flags, while the file version keeps them as references. Either way Claude Code starts the package through
npx.Add it for you in every project claude mcp add --transport stdio --env GITLAB_PERSONAL_ACCESS_TOKEN=YOUR_GITLAB_PERSONAL_ACCESS_TOKEN --env GITLAB_JOB_TOKEN=YOUR_GITLAB_JOB_TOKEN --scope user gitlab-mcp -- npx -y @zereight/mcp-gitlab@2.3.7Or share it with the project: put this in .mcp.json at the project root .mcp.json{ "mcpServers": { "gitlab-mcp": { "command": "npx", "args": [ "-y", "@zereight/mcp-gitlab@2.3.7" ], "env": { "GITLAB_PERSONAL_ACCESS_TOKEN": "${GITLAB_PERSONAL_ACCESS_TOKEN}", "GITLAB_JOB_TOKEN": "${GITLAB_JOB_TOKEN}" } } } }Set the variable in the shell you start the host from export GITLAB_PERSONAL_ACCESS_TOKEN="paste-your-value-here" export GITLAB_JOB_TOKEN="paste-your-value-here"- The command keeps the value in ~/.claude.json; the .mcp.json version refers to an environment variable, so nothing secret is committed.
4. Restart or reload if it does not appear
Missing server? This step relates to reconnecting through Claude Code's menu and approving servers that come from a project file.
- The docs do not say a restart is needed after claude mcp add. Servers connect at startup and can be reconnected from the /mcp menu.
- In an interactive session Claude Code asks you to approve servers from a project .mcp.json before it uses them; claude mcp reset-project-choices resets those answers.
Check that it works
After the server list, check the tool count: the catalog records 293 for GitLab MCP Server, so expect a long list.
claude mcp list- Run claude mcp list from the shell, or /mcp inside a session. The list shows each server as Connected, Needs authentication, Failed to connect, or Pending approval.
- Once it is connected, Claude Code should list its tools; the catalog records 293 for GitLab MCP Server, including approve_deployment, approve_merge_request and bulk_publish_draft_notes.
Troubleshooting
- Error: MCP server has a "url" but no "type"
- Add "type": "http" (or sse) to the entry in the JSON file. Source
- MCP server already exists in local config
- Remove it from the other scope first with claude mcp remove <name> --scope <scope>, then add it again. Source
- A ${VAR} in the config stays literal
- The variable is unset. Export it before starting Claude Code or give it a default with ${VAR:-default}; claude mcp list shows a warning. Source
- Server shows disconnected in a session
- Open /mcp and reconnect it. Source
Security notes
- Publisher: zereight, not listed as the vendor's own server; license MIT.
- It runs on your machine with your user account's permissions, so it can reach any file or network resource you can. Read its source before you give it access: https://github.com/zereight/gitlab-mcp.
- Keep GITLAB_PERSONAL_ACCESS_TOKEN and GITLAB_JOB_TOKEN in an environment variable; the config above refers to it by name, so the value is not written to the file.
- This listing has no security grade: Agent Market has not published security grades yet, so the choice is yours to make from the source and the permissions.
Servers and skills in this guide
Related pages: other GitLab servers, comparisons and the general Claude Code guide.
- 1GitLab MCP Server
zereight
GitLab MCP server for projects, merge requests, issues, pipelines, wiki, releases, and more.
★ 2.1KLast active Oct 23, 2026Local (stdio)Claude Code, Codex, VS Code, Cursor +2
AFreshness: A–Security: not graded yet
Related
Sources
- Connect Claude Code to tools via MCP · fetched Oct 26, 2026
Cite this page
How to connect GitLab to Claude Code. Agent Mart. https://agentmart.dev/guides/connect-gitlab-to-claude-code (last updated 2026-10-26)