gitlab-mcp
Provides comprehensive tools for GitLab: manage projects, merge requests, issues, pipelines, wikis, milestones, releases, labels, commits, branches, and file management.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@gitlab-mcplist merge requests assigned to me"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
gitlab-mcp
A production-ready MCP server for GitLab. It lets AI assistants read and manage GitLab projects, merge requests, issues, pipelines, wikis, releases, and more through a broad, policy-controlled tool registry.
Highlights
Comprehensive GitLab coverage — projects, merge requests (with code-context analysis), issues, pipelines, wikis, milestones, releases, labels, commits, branches, GraphQL, and file management
Multiple transports — stdio for local CLI usage, Streamable HTTP for remote deployments, optional SSE
Flexible authentication — personal access tokens, OAuth 2.0 PKCE, external token scripts, token files, cookie-based auth, and per-request remote authorization
Policy engine — readonly/modify/full modes, tool allowlist/denylist, feature toggles, and project-scoped restrictions
Enterprise networking — HTTP/HTTPS proxy, custom CA certificates, Cloudflare bypass, multi-instance API rotation
Output control — JSON, compact JSON, or YAML formatting with configurable response size limits
Related MCP server: gitlab-mcp
Usage
Supported clients
Claude Desktop, Claude Code, VS Code, GitHub Copilot Chat (VS Code), Cursor, JetBrains AI Assistant, GitLab Duo, and any MCP client that supports stdio or streamable HTTP.
Current client format references:
Authentication methods
The server supports three auth patterns:
Personal Access Token (PAT)
OAuth 2.0 PKCE (recommended for local interactive use)
Remote per-request auth (
REMOTE_AUTHORIZATION=true, HTTP mode)
OAuth2 setup (stdio, recommended for local interactive use)
Create a GitLab OAuth application in
Settings -> Applications.Set redirect URI to
http://127.0.0.1:8765/callback(or your custom callback).Set scope to
api.Copy the Application ID as
GITLAB_OAUTH_CLIENT_ID.
{
"mcpServers": {
"gitlab": {
"command": "npx",
"args": ["-y", "gitlab-mcp@latest"],
"env": {
"GITLAB_USE_OAUTH": "true",
"GITLAB_OAUTH_CLIENT_ID": "your_oauth_client_id",
"GITLAB_OAUTH_REDIRECT_URI": "http://127.0.0.1:8765/callback",
"GITLAB_API_URL": "https://gitlab.com/api/v4",
"GITLAB_ALLOWED_PROJECT_IDS": "",
"GITLAB_PERMISSION_MODE": "full",
"USE_GITLAB_WIKI": "true",
"USE_MILESTONE": "true",
"USE_PIPELINE": "true"
}
}
}
}If your OAuth app is confidential, also set GITLAB_OAUTH_CLIENT_SECRET.
Personal Access Token setup (stdio)
{
"mcpServers": {
"gitlab": {
"command": "npx",
"args": ["-y", "gitlab-mcp@latest"],
"env": {
"GITLAB_PERSONAL_ACCESS_TOKEN": "glpat-xxxxxxxxxxxxxxxxxxxx",
"GITLAB_API_URL": "https://gitlab.com/api/v4",
"GITLAB_ALLOWED_PROJECT_IDS": "",
"GITLAB_PERMISSION_MODE": "full",
"USE_GITLAB_WIKI": "true",
"USE_MILESTONE": "true",
"USE_PIPELINE": "true"
}
}
}
}VS Code .vscode/mcp.json examples
PAT with secure prompt input:
{
"inputs": [
{
"type": "promptString",
"id": "gitlab_token",
"description": "GitLab Personal Access Token",
"password": true
}
],
"servers": {
"gitlab": {
"type": "stdio",
"command": "node",
"args": ["/absolute/path/to/gitlab-mcp/dist/index.js"],
"env": {
"GITLAB_PERSONAL_ACCESS_TOKEN": "${input:gitlab_token}",
"GITLAB_API_URL": "https://gitlab.com/api/v4",
"GITLAB_PERMISSION_MODE": "full"
}
}
}
}OAuth (confidential app) with secure prompt input:
{
"inputs": [
{
"type": "promptString",
"id": "gitlab_oauth_secret",
"description": "GitLab OAuth Client Secret",
"password": true
}
],
"servers": {
"gitlab": {
"type": "stdio",
"command": "node",
"args": ["/absolute/path/to/gitlab-mcp/dist/index.js"],
"env": {
"GITLAB_USE_OAUTH": "true",
"GITLAB_OAUTH_CLIENT_ID": "your_oauth_client_id",
"GITLAB_OAUTH_CLIENT_SECRET": "${input:gitlab_oauth_secret}",
"GITLAB_OAUTH_REDIRECT_URI": "http://127.0.0.1:8765/callback",
"GITLAB_API_URL": "https://gitlab.com/api/v4"
}
}
}
}GitHub Copilot Chat in VS Code uses the same .vscode/mcp.json format.
Claude Desktop / Claude Code / Cursor
Claude Desktop reads claude_desktop_config.json.
Claude Code supports project-level .mcp.json and claude mcp add-json.
Cursor uses .cursor/mcp.json.
{
"mcpServers": {
"gitlab": {
"command": "node",
"args": ["/absolute/path/to/gitlab-mcp/dist/index.js"],
"env": {
"GITLAB_PERSONAL_ACCESS_TOKEN": "glpat-xxxxxxxxxxxxxxxxxxxx",
"GITLAB_API_URL": "https://gitlab.com/api/v4"
}
}
}
}GitLab Duo (~/.gitlab/duo/mcp.json)
{
"mcpServers": {
"gitlab": {
"command": "node",
"args": ["/absolute/path/to/gitlab-mcp/dist/index.js"],
"env": {
"GITLAB_PERSONAL_ACCESS_TOKEN": "glpat-xxxxxxxxxxxxxxxxxxxx",
"GITLAB_API_URL": "https://gitlab.com/api/v4"
}
}
},
"approvedTools": ["gitlab_get_project", "gitlab_list_merge_requests"]
}JetBrains AI Assistant
JetBrains can import an existing MCP JSON config or register the server manually.
Use stdio command node /absolute/path/to/gitlab-mcp/dist/index.js, or HTTP endpoint http://127.0.0.1:3333/mcp with required headers.
Remote authorization (multi-user HTTP)
Start server:
REMOTE_AUTHORIZATION=true \
HTTP_HOST=0.0.0.0 \
MCP_ALLOWED_HOSTS=127.0.0.1 \
HTTP_PORT=3333 \
node dist/http.jsClient config:
{
"mcpServers": {
"gitlab": {
"url": "http://127.0.0.1:3333/mcp",
"headers": {
"Authorization": "Bearer glpat-xxxxxxxxxxxxxxxxxxxx"
}
}
}
}Dynamic per-request API URL:
REMOTE_AUTHORIZATION=true \
ENABLE_DYNAMIC_API_URL=true \
HTTP_HOST=0.0.0.0 \
MCP_ALLOWED_HOSTS=127.0.0.1 \
HTTP_PORT=3333 \
node dist/http.jsAdd header in client requests:
{
"headers": {
"Authorization": "Bearer glpat-xxxxxxxxxxxxxxxxxxxx",
"X-GitLab-API-URL": "https://gitlab.example.com/api/v4"
}
}Remote auth behavior matrix:
Server Mode | Required Request Headers | Token Fallback Chain |
| none | enabled |
|
| disabled |
|
| disabled |
When HTTP_HOST is not 127.0.0.1, localhost, or ::1, HTTP startup rejects
server-side GITLAB_PERSONAL_ACCESS_TOKEN or GITLAB_JOB_TOKEN unless inbound
requests are protected by MCP_HTTP_AUTH_TOKEN, REMOTE_AUTHORIZATION=true, or
GITLAB_MCP_OAUTH=true.
Docker
For containerized deployments, PAT or remote auth is recommended.
OAuth interactive callback flow is usually less convenient in containers.
The Compose service listens on 0.0.0.0 inside the container but publishes only
127.0.0.1:3333 on the host by default. For the remote-authorization example,
set REMOTE_AUTHORIZATION=true in .env, leave server-side GitLab credentials
empty, and send each client's GitLab token as shown above.
docker compose up --build -dor:
docker build -t gitlab-mcp .
docker run -d \
--name gitlab-mcp \
-p 127.0.0.1:3333:3333 \
-e HTTP_HOST=0.0.0.0 \
-e MCP_ALLOWED_HOSTS=127.0.0.1 \
-e REMOTE_AUTHORIZATION=true \
-e GITLAB_API_URL=https://gitlab.com/api/v4 \
gitlab-mcpClients must send their GitLab credential in Authorization: Bearer <token>,
Private-Token, or Job-Token. To keep a GitLab token in the container instead,
set a separate 32+ character MCP_HTTP_AUTH_TOKEN and require clients to send that
value as the bearer token; never expose a server-held GitLab token as the MCP bearer.
Compatibility notes
GITLAB_PROJECT_IDis not a supported environment variable in this repository.To set an effective default project, use
GITLAB_ALLOWED_PROJECT_IDSwith one project ID, or passproject_idin tool arguments.CLI argument overrides such as
--tokenor--api-urlare not implemented (--env-fileis supported).JSON config files do not support comments (
//).
MCP Server Configuration
HTTP server
pnpm install
cp .env.example .env
pnpm build
# stdio (local MCP)
pnpm start
# streamable HTTP server (http://127.0.0.1:3333/mcp)
pnpm start:http
# optional: load a specific env file
pnpm start -- --env-file .env.local
pnpm start:http -- --env-file .env.localTransport and entrypoint
Transport | Entry Point | Endpoint | Best For |
stdio |
| stdin/stdout | Local single-user MCP clients |
Streamable HTTP |
|
| Remote/shared deployments |
SSE (legacy) |
|
| Legacy SSE-only clients ( |
Health |
|
| Liveness/readiness checks |
SSE=true is not compatible with REMOTE_AUTHORIZATION=true.
Tool Categories
Tools are organized into these categories. All GitLab tools use the gitlab_ prefix, except health_check.
Category | Examples |
Projects |
|
Repository |
|
Merge Requests |
|
MR Code Context |
|
MR Discussions |
|
MR Notes |
|
Draft Notes |
|
Issues |
|
Pipelines |
|
Commits |
|
Labels |
|
Milestones |
|
Releases |
|
Wiki |
|
Uploads |
|
GraphQL |
|
Users & Groups |
|
Health |
|
See docs/tools.md for usage details and docs/tools-index.md for the generated complete registry.
Policy & Security
The policy engine controls which tools are available at registration time:
# Read-only mode — exposes only read and GraphQL query capabilities
GITLAB_PERMISSION_MODE=readonly
# Modify mode — allows read/write/admin, but hides delete-capability tools
GITLAB_PERMISSION_MODE=modify
# Deprecated legacy kill switch; true takes precedence and forces readonly
GITLAB_READ_ONLY_MODE=true
# Disable specific capability classes without going fully read-only
GITLAB_DISABLED_CAPABILITIES=delete,graphql
# Only expose specific tools (supports with or without gitlab_ prefix)
GITLAB_ALLOWED_TOOLS=get_project,list_merge_requests,get_merge_request
# Or select compact domain presets (multiple values form a union)
GITLAB_TOOLSETS=core,wiki
# Opt in only for clients that still call legacy duplicate names
GITLAB_ENABLE_COMPATIBILITY_ALIASES=true
# Sensitive variable administration is hidden until explicitly enabled
GITLAB_ENABLE_CI_VARIABLE_TOOLS=true
# Optional second gate; callers must also pass include_value=true
GITLAB_ALLOW_CI_VARIABLE_VALUES=false
# Group Dependency Proxy administration is also opt-in
GITLAB_ENABLE_DEPENDENCY_PROXY_TOOLS=true
# Block tools by regex pattern
GITLAB_DENIED_TOOLS_REGEX=^gitlab_(delete|create)_
# Restrict to specific projects
GITLAB_ALLOWED_PROJECT_IDS=123,456,789
# Legacy compatibility setting; raw GraphQL remains disabled in project-scoped mode
GITLAB_ALLOW_GRAPHQL_WITH_PROJECT_SCOPE=false
# Disable feature groups
USE_PIPELINE=false
USE_GITLAB_WIKI=falseThe two sensitive tool families use two independent gates. Enabling a family does not add it to the default core registry; select its toolset (or all) as well:
GITLAB_TOOLSETS=core,ci-variables,dependency-proxy
GITLAB_ENABLE_CI_VARIABLE_TOOLS=true
GITLAB_ENABLE_DEPENDENCY_PROXY_TOOLS=trueUnsafe or invalid GITLAB_DENIED_TOOLS_REGEX patterns fail startup.
In modify mode, raw GraphQL mutation tools remain available for updates, but the server parses each document and blocks mutation-root fields containing delete, destroy, remove, prune, or purge. Aliases and fragment expansion cannot bypass the check, and documents that cannot be verified fail closed.
GITLAB_ALLOWED_PROJECT_IDS is a strict resource boundary, not just a default project. Project-scoped tools validate every supplied source, target, and parent project ID. Safe global list/search tools return only allowed projects (global code search is executed once per allowed project), while group-wide, namespace-wide, user-wide, event-wide, fork, and unscoped create operations are hidden. Todo reads are filtered and a single todo is verified before mutation. Raw GraphQL executors are always hidden because an arbitrary document cannot be proven project-safe; project-bound Work Item tools remain available and enforce the same allowlist. The legacy GITLAB_ALLOW_GRAPHQL_WITH_PROJECT_SCOPE variable is retained for configuration compatibility but cannot override this boundary.
Configuration
All configuration is done through environment variables. Key settings:
For file-based loading, .env is loaded by default. You can override it with:
node dist/index.js --env-file .env.local
node dist/http.js --env-file=.env.productionArea | Variable | Default | Description |
GitLab API |
|
| Base API URL. Supports comma-separated multi-instance URLs. |
GitLab API |
| — | Static default token used when |
GitLab API |
| — | Static CI job token fallback when no personal access token is configured. |
Remote Auth |
|
| Require per-request token headers in HTTP mode (disables fallback token chain). |
Remote Auth |
|
| Require |
Remote Auth |
|
| Enable stateless MCP OAuth. Requires a pre-registered app, public URL, and shared state secret. |
Remote Auth |
| — | Application ID of the pre-registered GitLab OAuth app used by MCP OAuth. |
Remote Auth |
| — | Shared 32–64 byte base64(url) master key for stateless OAuth values. |
HTTP Server |
|
| HTTP bind host ( |
HTTP Server |
|
| HTTP server port. |
HTTP Server |
| — | Public base URL used when HTTP download tools return proxy URLs. |
HTTP Server |
|
| Force JSON-only responses (no streaming framing). |
HTTP Server |
|
| Enable legacy SSE endpoints ( |
Sessions |
|
| Idle session timeout in HTTP mode. |
Sessions |
|
| Use stateless Streamable HTTP transports; clients must send auth on every request. |
Sessions |
|
| Maximum concurrent sessions ( |
Sessions |
|
| Per-session rate limit ( |
Policy |
|
|
|
Policy |
|
| Deprecated kill switch. When |
Policy |
| — | Restrict access to specific GitLab project IDs. |
Policy |
| — | Tool allowlist (supports names with or without |
Policy |
|
| Full registry by default; use presets like |
Policy |
| — | Capability denylist. Valid values: |
Policy |
|
| Second gate for CI/CD variable tools; also select |
Policy |
|
| Allow values only when a list/get call also passes |
Policy |
|
| Second gate for Dependency Proxy tools; also select |
Policy |
| — | Regex denylist for tool names. |
Policy |
|
| Deprecated compatibility setting; raw GraphQL stays disabled in project-scoped mode. |
Auth Extensions |
|
| Enable OAuth 2.0 PKCE flow. |
Auth Extensions |
| mode-dependent | OAuth scopes advertised/requested by local OAuth and MCP OAuth. |
Auth Extensions |
| — | Resolve token from an external script. |
Auth Extensions |
| — | Resolve token from a local file. |
Auth Extensions |
| — | Enable cookie-jar based session auth from Netscape cookie file. |
Output |
|
| Response format; prefer |
Output |
|
| Max response payload (1KB–2MB), oversized payloads are truncated safely. |
Output |
|
| Max size for files saved locally by download tools such as job artifacts. |
Output |
| current working directory | Comma-separated roots allowed for stdio local uploads and artifact writes. |
Output |
| random per process | Random 32+ character secret for short-lived download URLs; set this for multi-replica deployments. |
Output |
|
| Lifetime of generated HTTP download proxy URLs. |
Output |
|
| Upstream GitLab HTTP timeout (1s–120s). |
Output |
|
| Retries for idempotent GETs on 429/502/503/504; mutations are never retried. |
Output |
|
| Initial exponential delay for retryable GETs without |
Output |
|
| Maximum accepted retry delay; longer |
Output |
|
| Error verbosity ( |
Network/TLS |
| — | Proxy settings for outbound GitLab requests, including per-host proxy bypass rules. |
Network/TLS |
| — | Custom CA certificate path (PEM). |
Network/TLS |
|
| Add browser-like headers for Cloudflare-protected instances. |
Network/TLS |
| — | Custom User-Agent for GitLab requests. |
See docs/configuration.md for the complete reference.
Authentication Methods
Authentication behavior depends on mode:
REMOTE_AUTHORIZATION=true(HTTP strong mode) Each request must includeAuthorization: Bearer <token>,Private-Token: <token>, orJob-Token: <token>. WhenENABLE_DYNAMIC_API_URL=true, each request must also includeX-GitLab-API-URL.REMOTE_AUTHORIZATION=false(default mode) The server resolves credentials in this order:GITLAB_PERSONAL_ACCESS_TOKEN->GITLAB_JOB_TOKEN-> OAuth PKCE (GITLAB_USE_OAUTH=true) ->GITLAB_TOKEN_SCRIPT->GITLAB_TOKEN_FILE.
Cookie-based auth (GITLAB_AUTH_COOKIE_PATH) is applied independently via a cookie jar and can work with or without a token.
See docs/authentication.md for setup guides.
Development
pnpm dev # stdio mode with hot-reload
pnpm dev:http # HTTP mode with hot-reload
pnpm test # Run tests
pnpm test:live # Run opt-in read-only checks against a real GitLab instance
pnpm test:watch # Run tests in watch mode
pnpm lint # Lint
pnpm typecheck # Type check
pnpm inspector # Launch MCP InspectorProject Structure
See docs/architecture.md for detailed design documentation.
Documentation
Configuration Reference — All environment variables
Tools Reference — Complete list of MCP tools
Generated Tool Index — Registry inventory checked by CI
Security Policy — Private vulnerability reporting and deployment baseline
Authentication Guide — Auth methods and setup
Deployment Guide — Docker, production, and multi-instance
Live Testing — Manual read-only checks against a real GitLab instance
Architecture — Internal design and patterns
Acknowledgements
This repository references and learns from parts of the implementation in zereight/gitlab-mcp. Thanks to the maintainers and contributors for their work.
License
MIT
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/mcpland/gitlab-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server