Skip to content

Troubleshooting

flowchart TD
    A[Server won't start] --> B{Error message?}
    B -->|GITLAB_TOKEN required| C[Set GITLAB_TOKEN<br/>in .env or env]
    B -->|Invalid GITLAB_URL| D[Fix self-managed<br/>GITLAB_URL]
    B -->|401 Unauthorized| E[Regenerate token<br/>with api scope]
    B -->|403 Forbidden| F[Check token has<br/>api scope]
    B -->|Connection refused| G{Is GitLab reachable?}
    G -->|No| H[Check GITLAB_URL<br/>and network]
    G -->|Yes| I{TLS error?}
    I -->|Yes| J{Can install CA cert?}
    J -->|Yes| J1[Add CA cert to system<br/>trust store]
    J -->|No| J2[Set GITLAB_SKIP_TLS_VERIFY=true<br/>as last resort]
    I -->|No| K[Enable debug logging<br/>LOG_LEVEL=debug]

    style C fill:#22c55e,color:#fff
    style D fill:#22c55e,color:#fff
    style E fill:#22c55e,color:#fff
    style F fill:#22c55e,color:#fff
    style H fill:#f59e0b,color:#000
    style J1 fill:#22c55e,color:#fff
    style J2 fill:#f59e0b,color:#000
    style K fill:#3b82f6,color:#fff
SymptomCauseSolution
GITLAB_TOKEN is required at startupToken not setSet GITLAB_TOKEN in .env or environment
GITLAB_URL is not a valid URL at startupURL has invalid syntaxFix GITLAB_URL or omit it to use https://gitlab.com in stdio mode
401 Unauthorized from GitLab APIInvalid or expired PATGenerate a new token with api scope at GitLab → Preferences → Access Tokens
403 Forbidden on specific operationsToken lacks required scopeEnsure the token has api scope (not just read_api)
Connection refused or timeoutGitLab instance unreachableVerify GITLAB_URL is reachable: curl -s $GITLAB_URL/api/v4/version
SymptomCauseSolution
x509: certificate signed by unknown authoritySelf-signed certificateFirst try adding the CA certificate to your system trust store. If that’s not possible, set GITLAB_SKIP_TLS_VERIFY=true in .env or --skip-tls-verify in HTTP mode
x509: certificate has expiredExpired TLS certificateRenew the certificate on the GitLab server, or use GITLAB_SKIP_TLS_VERIFY=true temporarily

If the server cannot resolve your GitLab hostname:

Terminal window
# Verify DNS from the machine running the MCP server
nslookup gitlab.example.com
# or
dig gitlab.example.com +short

In Docker containers, ensure your compose file or docker run command uses --dns or a custom network with proper DNS configuration. Inside Kubernetes, check CoreDNS logs and resolv.conf in the pod.

Go’s net/http honours the standard proxy environment variables. Set them before launching the server:

Terminal window
export HTTPS_PROXY=http://proxy.corp.example.com:8080
export HTTP_PROXY=http://proxy.corp.example.com:8080
export NO_PROXY=localhost,127.0.0.1,.internal.corp
SymptomCauseSolution
Connection timeout behind corporate networkProxy not configuredSet HTTPS_PROXY / HTTP_PROXY
Proxy works for curl but not for the serverEnv vars not exported into the server processPass them in .env, Docker environment:, or Fly.io secrets
CONNECT rejected by proxy for api.github.comProxy denies outbound to GitHub (auto-update)Set AUTO_UPDATE=false or whitelist github.com and objects.githubusercontent.com
Internal GitLab routed through external proxyNO_PROXY missingAdd your GitLab hostname to NO_PROXY

When running the MCP server behind nginx, Caddy, or a cloud load balancer:

SymptomCauseSolution
Rate limiter counts all requests as one clientReads load-balancer IP instead of real client IPSet --trusted-proxy-header to the header your proxy sets (e.g. X-Forwarded-For, Fly-Client-IP)
WebSocket or SSE disconnectedProxy read timeout too shortIncrease proxy read timeout to at least 120s for long-running MCP streams
502 Bad GatewayServer not listening yetAdd a startup probe or retry; the server needs a few seconds to initialize on first request
SymptomCauseSolution
MCP client shows hundreds of individual tools instead of 32Meta-tools disabledSet META_TOOLS=true (default) to consolidate into domain meta-tools
Tool not found in tools/listTool surface mismatchIndividual mode uses gitlab_create_issue, meta mode uses gitlab_issue with action: create, and dynamic mode exposes gitlab_search_tools, gitlab_describe_tools, and gitlab_execute_tool
unknown action in meta-tool callInvalid action parameterCheck valid actions in the Tools Overview
json: unknown field "<name>" from a meta-toolMisspelled or stale parameter in paramsMeta-tools reject unknown keys. Use the exact parameter names for the chosen action (e.g. merge_request_iid, issue_iid, epic_iid, work_item_iid, snippet_id)
Enterprise tools missingEnterprise catalog disabledIn stdio mode, set GITLAB_ENTERPRISE=true. In HTTP mode, set --enterprise to force the catalog or let CE/EE auto-detection enable it when GitLab reports edition
SymptomCauseSolution
Update detected but not appliedMode is check onlySet AUTO_UPDATE=true to enable automatic application
Still running old version after updateProcess not restarted (Windows)Restart the server or use gitlab-mcp-server --shutdown to terminate all instances
Cannot replace binary (file locked)Running instances hold the fileRun gitlab-mcp-server --shutdown to terminate all instances first
Network error reaching GitHubFirewall or proxy blockingVerify connectivity to github.com from the server
SymptomCauseSolution
400 Bad RequestMissing token headerSend PRIVATE-TOKEN or Authorization: Bearer <token> header with every request
Pool eviction too frequentToo many unique tokensIncrease --max-http-clients (default: 100)
Sessions expiring unexpectedlyIdle timeout too shortIncrease --session-timeout (default: 30m)
SymptomCauseSolution
401 Unauthorized with valid OAuth tokenToken expired or GitLab rejected itRe-authorize through the OAuth flow; check that the GitLab OAuth app is still active
High latency on first request after cache expiryToken re-validation against GitLab APIExpected behavior — increase --oauth-cache-ttl (default: 15m, max: 2h) to reduce validation frequency
404 on /.well-known/oauth-protected-resourceOAuth mode not enabledStart the server with --auth-mode=oauth
Client doesn’t start OAuth flowClient lacks OAuth 2.1 supportUse PRIVATE-TOKEN header instead — it works in OAuth mode via automatic normalization
PRIVATE-TOKEN header not working in OAuth modeShould still workThe middleware normalizes PRIVATE-TOKEN to Bearer — check token validity
Operations fail with insufficient mcp scopeDCR fallback assigned mcp instead of apiConfigure clientId explicitly in the MCP client config. See HTTP Server Mode
SymptomCauseSolution
List results truncatedDefault per_page limitPass per_page (max 100) and page parameters to paginate
nextPage missing in responseLast page reachedNo more results — this is expected behavior
SymptomSolution
”Tool not found” in Copilot ChatCheck Output panel → MCP Logs for errors. Verify .vscode/mcp.json path
Server not appearing in MCP statusRun Ctrl+Shift+PMCP: List Servers to verify configuration
”Permission denied” on startupRun chmod +x /path/to/gitlab-mcp-server (Linux/macOS)
Server restarts repeatedlyCheck MCP Logs for missing GITLAB_URL or GITLAB_TOKEN
Waiting for initialize with Docker logs showing HTTP modeAdd --http=false after the image name for stdio mode (JSON-RPC over stdin/stdout, no port needed). Alternatively, run the container in HTTP mode with -p 8080:8080 and configure the MCP client as HTTP pointing to http://host:8080/mcp — this only works if the server is running and the port is reachable.

Enable verbose logging to diagnose issues:

  1. Set the log level to debug:

    Terminal window
    # Stdio mode
    LOG_LEVEL=debug ./gitlab-mcp-server 2>debug.log
    # HTTP mode (logs interleaved with server output)
    LOG_LEVEL=debug ./gitlab-mcp-server --http --gitlab-url=https://gitlab.com 2>debug.log
  2. Reproduce the issue by running the same operation that failed.

  3. Examine the logs — debug logs include:

    • Every tool call with input parameters
    • GitLab API request/response details
    • Token validation events (last 4 characters only)
    • Session pool operations (HTTP mode)

If you cannot resolve an issue:

  1. Enable debug logging (LOG_LEVEL=debug) and capture the output
  2. Check the GitHub Issues for known problems
  3. Open a new issue with:
    • Server version (gitlab-mcp-server --version or check startup logs)
    • Operating system and architecture
    • MCP client name and version
    • Redacted debug logs (remove any tokens or sensitive data)
    • Steps to reproduce the issue