Skip to content

Configuration

GitLab MCP Server is configured through environment variables for stdio mode and CLI flags for HTTP mode. This page covers the options most users need; see the repository environment reference and CLI reference for the exhaustive tables.

This must be set for the server to start in stdio mode:

VariableDescriptionExample
GITLAB_TOKENPersonal Access Token with api scopeglpat-xxxxxxxxxxxxxxxxxxxx
VariableDefaultDescription
GITLAB_URLhttps://gitlab.comGitLab instance base URL. Set this for self-managed instances
GITLAB_SKIP_TLS_VERIFYfalseSkip TLS certificate verification for self-signed certs
TOOL_SURFACEdynamicCanonical tool catalog selector: dynamic, meta, or individual
META_TOOLSlegacyDeprecated compatibility selector. true maps to meta, false maps to individual, and dynamic values map to the matching TOOL_SURFACE value when TOOL_SURFACE is absent
CAPABILITY_SURFACEfullResource and prompt catalog selector: full keeps the complete catalog; minimal keeps gitlab://workspace/roots plus gitlab://tools, and disables optional resources, prompts, and workflow guides
META_PARAM_SCHEMAopaqueMeta-tool input-schema strategy: opaque (default), compact (6.5x opaque size), or full (11.9x opaque size). Applies to meta-tool tools/list schemas only
GITLAB_ENTERPRISEfalseEnable Enterprise/Premium tools in stdio mode. In HTTP mode, --enterprise can force the catalog; otherwise edition is auto-detected per token+URL entry
GITLAB_READ_ONLYfalseDisable all mutating tools (create, update, delete)
GITLAB_SAFE_MODEfalseReturn structured JSON preview instead of executing mutating tools (dry-run mode)
EMBEDDED_RESOURCEStrueEmbed canonical gitlab:// MCP resource URIs in get-tool results; set false for clients that do not tolerate duplicate content blocks
EXCLUDE_TOOLSComma-separated list of tool names to exclude (e.g., gitlab_delete_project,gitlab_admin)
GITLAB_IGNORE_SCOPESfalseSkip automatic PAT scope detection — register all tools regardless of token scopes
LOG_LEVELinfoLog verbosity: debug, info, warn, error
VariableDefaultDescription
AUTO_UPDATEtrueAuto-update behavior: true (apply on start), check (notify only), false (disabled)
AUTO_UPDATE_REPOjmrplens/gitlab-mcp-serverGitHub repository for release assets
AUTO_UPDATE_INTERVAL1hPeriodic check interval (HTTP mode only)
AUTO_UPDATE_TIMEOUT60sStartup/background update timeout (range: 5s–10m)
VariableDefaultDescription
YOLO_MODEfalseSkip destructive action confirmations (not recommended)
AUTOPILOTfalseSame as YOLO_MODE — skip destructive confirmations
GITLAB_MCP_ALLOWED_IMPORT_DIRSAdditional OS path-list-separated directories allowed for local project/group import archives
RATE_LIMIT_RPS0Per-server tools/call rate limit in req/s (0 = disabled)
RATE_LIMIT_BURST40Token-bucket burst size when RATE_LIMIT_RPS > 0
.env
# Required
GITLAB_TOKEN=glpat-xxxxxxxxxxxxxxxxxxxx
# Optional
GITLAB_SKIP_TLS_VERIFY=false
TOOL_SURFACE=dynamic
GITLAB_ENTERPRISE=false
GITLAB_READ_ONLY=false
GITLAB_SAFE_MODE=false
EXCLUDE_TOOLS=
GITLAB_IGNORE_SCOPES=false
LOG_LEVEL=info
# Auto-update
AUTO_UPDATE=true

For self-managed GitLab, add GITLAB_URL=https://gitlab.example.com.

Create .vscode/mcp.json in your workspace:

{
"servers": {
"gitlab": {
"type": "stdio",
"command": "/path/to/gitlab-mcp-server",
"env": {
"GITLAB_TOKEN": "glpat-xxxxxxxxxxxxxxxxxxxx"
}
}
}
}

Secure token configuration using VS Code input variables:

{
"inputs": [
{
"id": "gitlab-token",
"type": "promptString",
"description": "GitLab Personal Access Token",
"password": true
}
],
"servers": {
"gitlab": {
"type": "stdio",
"command": "/path/to/gitlab-mcp-server",
"env": {
"GITLAB_TOKEN": "${input:gitlab-token}"
}
}
}
}

When running in HTTP mode (--http), configuration uses CLI flags instead of environment variables:

FlagDefaultDescription
--httpfalseEnable HTTP transport mode
--http-addr:8080Listen address and port
--gitlab-urlFixed GitLab instance URL. Omit to require GITLAB-URL per request
--skip-tls-verifyfalseSkip TLS verification
--tool-surfacedynamicCanonical tool catalog selector: dynamic, meta, or individual
--meta-tools(unset)Deprecated compatibility flag. Use --tool-surface=individual instead of --meta-tools=false
--meta-param-schemaopaqueMeta-tool params schema mode: opaque, compact, or full; applies to meta-tool schemas only
--capability-surfacefullResource and prompt catalog selector: full or minimal; minimal keeps gitlab://workspace/roots and gitlab://tools, and omits optional resources, workflow guides, and prompts
--enterprisefalseForce Enterprise/Premium tools when explicitly set; omit to auto-detect CE/EE per token+URL entry
--read-onlyfalseRead-only mode
--safe-modefalseIntercept mutating tools and return a JSON preview instead of executing them
--embedded-resourcestrueEmbed canonical MCP resource URIs in get-tool results
--exclude-toolsComma-separated tool names to exclude
--ignore-scopesfalseSkip PAT scope detection
--max-http-clients100Maximum concurrent client sessions
--session-timeout30mIdle session timeout
--http-idle-timeout0 (disabled)HTTP server idle connection timeout. Default 0 disables idle closure, so --session-timeout is the effective lifetime; set a positive duration to recycle idle connections sooner
--auto-updatetrueAuto-update mode
--auto-update-repojmrplens/gitlab-mcp-serverGitHub release repository
--auto-update-interval1hPeriodic update check interval
--auto-update-timeout60sStartup/background update timeout (5s–10m)
--auth-modelegacyAuthentication mode: legacy or oauth
--oauth-cache-ttl15mOAuth token identity cache TTL (1m–2h)
--revalidate-interval15mToken re-validation interval; 0 to disable (upper bound: 24h)
--rate-limit-rps0Per-server tools/call rate limit in req/s (0 = disabled)
--rate-limit-burst40Token-bucket burst size when --rate-limit-rps > 0
--trusted-proxy-headerHTTP header with real client IP for rate limiting behind proxies (e.g. Fly-Client-IP, X-Forwarded-For)

General flags (both stdio and HTTP modes):

FlagDefaultDescription
--shutdownfalseTerminate all running instances and exit

Example:

Terminal window
# Single GitLab.com instance (fixed URL for all clients; replace for self-managed GitLab)
./gitlab-mcp-server \
--http \
--http-addr=0.0.0.0:8080 \
--gitlab-url=https://gitlab.com \
--max-http-clients=200 \
--session-timeout=1h
# Multi-instance (each client specifies their GitLab URL via GITLAB-URL header)
./gitlab-mcp-server \
--http \
--http-addr=0.0.0.0:8080

The server loads configuration in the following order (later sources override earlier ones):

  1. ~/.gitlab-mcp-server.env — User-level defaults (home directory)
  2. .env — Project-level configuration (current working directory)
  3. System environment variables — Exported variables in the shell
  4. CLI flags — Command-line arguments (highest priority)

For GitLab instances with self-signed TLS certificates:

Terminal window
GITLAB_SKIP_TLS_VERIFY=true

Enable GITLAB_READ_ONLY=true to restrict the server to read-only operations. All tools that create, update, or delete resources are disabled. This is useful for:

  • Audit and compliance environments
  • Shared servers where users should only query data
  • Tokens with read_api scope

Enable GITLAB_SAFE_MODE=true to intercept mutating tools and return a structured JSON preview of what would be executed, without actually performing the operation. Read-only tools work normally. This is useful for:

  • Reviewing operations before execution (dry-run)
  • Training environments where you want to see tool behavior
  • Debugging tool parameters without side effects