Environment
- SonarQube Server or Cloud? SonarQube Server 9.9.8
- Deployment type (STDIO/HTTP, Docker/JAR): Docker
- Client / AI tool using MCP (if applicable): Cursor
Description
I’m attempting to connect the SonarQube MCP Server (Docker image mcp/sonarqube:latest) to our SonarQube Server instance but receiving an authentication error, despite having valid credentials.
Environment:
-
SonarQube Server Version: 9.9.8.100196
-
MCP Server: Docker image mcp/sonarqube:latest (updated 15 days ago)
-
Token Type: User token with squ_ prefix (freshly generated)
-
Connection: Docker container with --network host
Error Message:
Exception in thread “main” org.sonarsource.sonarqube.mcp.serverapi.exception.UnauthorizedException:
SonarQube answered with Not authorized. Please check server credentials.
at org.sonarsource.sonarqube.mcp.serverapi.ServerApiHelper.handleError(ServerApiHelper.java:135)
at org.sonarsource.sonarqube.mcp.serverapi.ServerApiHelper.get(ServerApiHelper.java:52)
at org.sonarsource.sonarqube.mcp.serverapi.features.FeaturesApi.listFeatures(FeaturesApi.java:36)
at org.sonarsource.sonarqube.mcp.SonarQubeMcpServer.loadBackendIndependentTools(SonarQubeMcpServer.java:272)
Troubleshooting Performed:
- Verified token validity:
-
Token authentication endpoint returns: {“valid”:true}

-
System status endpoint accessible: {“status”:“UP”,“version”:“9.9.8.100196”}

- Tested API endpoints manually:
-
/api/authentication/validate → 200 OK

-
/api/features/list → 200 OK (returns features)

-
/api/v2/features → 404 Not Found

Configuration { "command": "docker", "type": "stdio", "args": ["run", "--network", "host", "-i", "--rm", "-e", "SONARQUBE_TOKEN", "-e", "SONARQUBE_URL", "mcp/sonarqube"], "env": { "SONARQUBE_TOKEN": "squ_xxx...", "SONARQUBE_URL": "http://internal.server.com/sonar" } }