Skip to content

Logging

GitLab MCP Server uses dual logging — log messages are sent both to stderr (for terminal/file capture) and to the MCP client via the protocol’s logging capability.

DestinationFormatPurpose
stderrHuman-readable text or JSONTerminal output, file redirection, debugging
MCP protocolnotifications/messageDisplayed in the MCP client’s UI (e.g., VS Code Output panel)

This ensures logs are always visible regardless of the client’s logging support.

The server supports four log levels:

LevelWhen Used
debugDetailed diagnostic information — tool call parameters, API request/response details, session pool operations
infoNormal operational events — server startup, tool registration, update checks
warnNon-fatal issues — network timeouts, missing optional configuration, deprecated usage
errorFailures — authentication errors, API failures, unrecoverable tool errors

Set the log level via environment variable:

Terminal window
# Stdio mode
LOG_LEVEL=debug ./gitlab-mcp-server
# HTTP mode
LOG_LEVEL=info ./gitlab-mcp-server --http --gitlab-url=https://gitlab.example.com

The default level is info.

When the MCP client supports logging, the server sends structured log notifications:

{
"jsonrpc": "2.0",
"method": "notifications/message",
"params": {
"level": "info",
"logger": "gitlab-mcp-server",
"data": {
"message": "starting MCP server",
"transport": "stdio",
"version": "2.1.0",
"tools": 40,
"resources": 24,
"prompts": 38
}
}
}

Log messages follow strict security rules:

  • No tokens — GitLab tokens are never included in log messages
  • Masked identifiers — In HTTP mode, tokens are shown as ...a1b2 (last 4 characters only)
  • No PII — User-submitted data is not logged at info level or above
  • Debug only — Detailed request/response data is only logged at debug level