Add SOCKS5 proxy support to SQ MCP

Environment

  • SonarQube Server
  • Client / AI tool using MCP (if applicable): Claude Code

Description

From my understanding, the MCP server only works with HTTP CONNECT proxies (http[s].proxyHost). SOCKS5 proxies are ignored, even when configured via -DsocksProxyHost

In our team, our WFH workflow rlies on SOCKS5 tunnels (ssh -D tunnels to reach internal SonarQube instances from outside the network). My workaround today is to use a socks5-to-http bridge, but this complexifies onboarding all our team members on SQ.

Is there any chance SOCKS5 proxy support could be added?

Cheers,
Benjamin

Hey @7ph, ça fait longtemps!

Thanks for the feedback, I think it makes sense! I created this ticket for reference.

I will try implementing it for our next release :slight_smile:

1 Like

Hey @nicolas.quinquenel

I had a suspicion this thread would end up in your team :laughing: Hope you’re doing well. Thank you for tracking the feature request!

2 Likes

Hey @7ph, just a heads-up that the latest release of our MCP now includes SOCKS5 support. Would you be open to trying it out to see if it resolves your issue?

Also, if you’re using Docker, make sure to pull the latest image or set --pull=always in your configuration.

Thanks!

2 Likes

Hey @nicolas.quinquenel I was AFK last week so couldn’t test it

I had to tweak a bit my .mcp.json to make it work (compared to the documentation). Here’s what worked for me:

{
  "mcpServers": {
    "sonarqube": {
      "command": "docker",
      "args": [
        "run",
        "--init",
        "--pull=always",
        "-i",
        "--rm",
        "-e",
        "SONARQUBE_TOKEN",
        "-e",
        "SONARQUBE_URL",
        "-e",
        "JAVA_TOOL_OPTIONS",
        "mcp/sonarqube"
      ],
      "env": {
        "SONARQUBE_TOKEN": "${WORKENV_CERN_SONAR_TOKEN}",
        "SONARQUBE_URL": "https://xxxxxxx.app.cern.ch",
        "JAVA_TOOL_OPTIONS": "-DsocksProxyHost=host.docker.internal -DsocksProxyPort=9375"
      }
    }
  }
}

So basically:

  • Dropping --network=host
  • "JAVA_TOOL_OPTIONS": "-DsocksProxyHost=host.docker.internal -DsocksProxyPort=9375"

That’s perhaps due to my specific set up (WSL2 / Win11) but the docker container wasn’t able to pick up the proxy

So.. all good for me, thanks!