You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All configuration is done through environment variables. The server validates all values at startup using Zod schemas and will fail fast with descriptive errors if any value is invalid.
You can set variables in a .env file (loaded automatically via dotenv) or pass them directly as environment variables. To load a different file, use --env-file:
The client will normalize each entry and rotate across them for load distribution.
Authentication
Personal Access Token
Variable
Type
Default
Description
GITLAB_PERSONAL_ACCESS_TOKEN
string
—
Token with api scope. Used as the default request token when set.
OAuth 2.0 PKCE
Variable
Type
Default
Description
GITLAB_USE_OAUTH
boolean
false
Enable OAuth PKCE flow.
GITLAB_OAUTH_CLIENT_ID
string
—
Required when OAuth is enabled. Application ID from GitLab OAuth settings.
GITLAB_OAUTH_CLIENT_SECRET
string
—
Optional. Required only for confidential OAuth applications.
GITLAB_OAUTH_GITLAB_URL
string
derived from GITLAB_API_URL
GitLab base URL for OAuth endpoints (e.g. https://gitlab.com).
GITLAB_OAUTH_REDIRECT_URI
string (URL)
http://127.0.0.1:8765/callback
Local callback URL for the OAuth flow.
GITLAB_OAUTH_SCOPES
string
api (read_api in read-only mode)
Space or comma-separated OAuth scopes. If omitted, gitlab-mcp defaults to read_api when GITLAB_READ_ONLY_MODE=true, otherwise api.
GITLAB_OAUTH_TOKEN_PATH
string
~/.gitlab-mcp-oauth-token.json
File path for persisting OAuth tokens. Stored with chmod 600.
GITLAB_OAUTH_AUTO_OPEN_BROWSER
boolean
true
Automatically open the browser for authorization.
External Token Script
Variable
Type
Default
Description
GITLAB_TOKEN_SCRIPT
string
—
Shell command to execute for obtaining a token. Must output either a raw token string or JSON ({"access_token":"..."}, {"token":"..."}, or {"private_token":"..."}).
GITLAB_TOKEN_SCRIPT_TIMEOUT_MS
number
10000
Script execution timeout (500ms–120s).
GITLAB_TOKEN_CACHE_SECONDS
number
300
How long to cache the resolved token (0–86400s).
Token File
Variable
Type
Default
Description
GITLAB_TOKEN_FILE
string
—
Path to a file containing a token. Supports ~/ prefix.
GITLAB_ALLOW_INSECURE_TOKEN_FILE
boolean
false
Allow token files with group/other read permissions. By default, the file must be chmod 600.
Cookie-Based Auth
Variable
Type
Default
Description
GITLAB_AUTH_COOKIE_PATH
string
—
Path to a Netscape-format cookie file. Auto-reloads on file changes.
GITLAB_COOKIE_WARMUP_PATH
string
/user
API path used for session warmup when cookies are loaded.
Remote Authorization (HTTP Mode)
Variable
Type
Default
Description
REMOTE_AUTHORIZATION
boolean
false
Require per-request tokens via Authorization (Bearer), Private-Token, or Job-Token headers for HTTP requests. Disables fallback auth chain.
ENABLE_DYNAMIC_API_URL
boolean
false
Require per-request API URL via X-GitLab-API-URL header. Requires REMOTE_AUTHORIZATION=true.
Policy
Variable
Type
Default
Description
GITLAB_READ_ONLY_MODE
boolean
false
Disable tools that require write, delete, or admin capabilities.
GITLAB_ALLOWED_PROJECT_IDS
string
—
Comma-separated project IDs. If set, only these projects can be accessed. Empty = no restriction.
GITLAB_ALLOWED_TOOLS
string
—
Comma-separated tool allowlist. Accepts names with or without gitlab_ prefix (e.g. get_project or gitlab_get_project). Empty = all tools enabled.