CLI Arguments

September 2, 2026 · View on GitHub

Some MCP clients (like GitHub Copilot CLI) don't pass environment variables reliably. For those clients, configure the server with CLI arguments instead.

CLI arguments take precedence over environment variables.

Install the server once:

brew tap zereight/gitlab-mcp https://github.com/zereight/gitlab-mcp
brew install zereight/gitlab-mcp/zereight-mcp-gitlab

Or with npm:

npm install -g @zereight/mcp-gitlab

No global install? Pin npx to the previous stable release and keep the server flags after it, for example npx -y @zereight/mcp-gitlab@2.1.56 --token=.... Use @zereight/mcp-gitlab@latest if you always want the newest release.

Example config

{
  "mcpServers": {
    "gitlab": {
      "command": "zereight-mcp-gitlab",
      "args": ["--token=YOUR_GITLAB_TOKEN", "--api-url=https://gitlab.com/api/v4"],
      "tools": ["*"]
    }
  }
}

Available arguments

ArgumentEquivalent env varDescription
--tokenGITLAB_PERSONAL_ACCESS_TOKENGitLab Personal Access Token.
--api-urlGITLAB_API_URLGitLab API URL (e.g., https://gitlab.com/api/v4).
--read-only=trueGITLAB_READ_ONLY_MODEEnable read-only mode (deprecated — prefer --permission-mode=readonly).
--permission-modeGITLAB_PERMISSION_MODEreadonly, modify (no delete tools), or full.
--use-wiki=trueUSE_GITLAB_WIKIEnable wiki API tools.
--use-milestone=trueUSE_MILESTONEEnable milestone API tools.
--use-pipeline=trueUSE_PIPELINEEnable pipeline API tools.
--disable-version-check=trueGITLAB_DISABLE_VERSION_CHECKDisable the startup new-version notice.

Deprecation notice: --read-only=true and GITLAB_READ_ONLY_MODE are kept for backward compatibility but will be removed in a future major version. Use --permission-mode=readonly or GITLAB_PERMISSION_MODE=readonly instead.

Subcommands

Subcommands are not MCP server flags. They run and exit without starting the MCP server.

auth

Run GitLab's OAuth Device Authorization Grant (GitLab 17.9+; 17.2–17.8 need oauth2_device_grant_flow) and store a token at ~/.gitlab-mcp-token.json (or GITLAB_OAUTH_TOKEN_PATH). This complements the existing localhost callback flow; it does not replace it.

zereight-mcp-gitlab auth --client-id YOUR_APP_ID
zereight-mcp-gitlab auth --client-id YOUR_APP_ID --api-url https://gitlab.example.com/api/v4
zereight-mcp-gitlab auth --help
ArgumentEquivalent env varDescription
--client-idGITLAB_OAUTH_CLIENT_IDGitLab OAuth application ID.
--api-urlGITLAB_API_URLGitLab API URL; /api/v4 is stripped to origin.
--token-pathGITLAB_OAUTH_TOKEN_PATHToken file path.

After auth succeeds, start the MCP server with GITLAB_USE_OAUTH=true and the same client ID. If you use --token-path, set GITLAB_OAUTH_TOKEN_PATH to the same path when you start the server. See OAuth2 Authentication Setup Guide.

For the full list of configuration options, see Environment Variables.