SonarQube云API服务器

一个用Golang实现的SonarQube云API的MCP服务器,支持本地开发和云部署。

  • by lreimer
  • Go
  • 本地部署
  • 2 星标
  • 更新于
在 GitHub 查看 lreimer/sonar-mcp-server

使用说明

声纳MVP服务器

用于Golang SonarQube Cloud API的MCP服务器实现。

构建和发布

# to quickly build the latest snapshot
goreleaser build --snapshot --clean
goreleaser release --skip=publish --snapshot --clean

使用说明

如果您想在本地使用该工具,例如使用Claude Desktop,请使用以下工具 MCP服务器的配置。

{
    "mcpServers": {
      "sonar": {
        "command": "/Users/mario-leander.reimer/Applications/sonar-mcp-server",
        "args": ["-t", "stdio"],
        "env": {
          "SONAR_TOKEN": "<<INSERT TOKEN HERE>>"
        }
      }
    }
}

或者,您可以使用MCP内省器进行简单的本地开发:

# as stdio binary
npx @modelcontextprotocol/inspector go run main.go

# as SSE server using 
go run main.go --transport sse
npx @modelcontextprotocol/inspector npx mcp-remote@next http://localhost:8080/sse
npx @modelcontextprotocol/inspector

部署

目前使用手动Google Cloud Run部署。两者都可以部署 直接从源代码或使用构建在Github上的Docker镜像。

# create a new secret for the SONAR_TOKEN
gcloud services enable secretmanager.googleapis.com
print $SONAR_TOKEN | gcloud secrets create sonar-token --data-file=-

# next deploy the local build from source to Cloud Run
gcloud services enable run.googleapis.com cloudbuild.googleapis.com artifactregistry.googleapis.com

gcloud secrets add-iam-policy-binding sonar-token \
  --member=serviceAccount:343509396461-compute@developer.gserviceaccount.com \
  --role=roles/secretmanager.secretAccessor

gcloud run deploy sonar-mcp-server --source=. \
  --region=europe-north1 \
  --port=8080 --allow-unauthenticated \
  --set-secrets=SONAR_TOKEN=sonar-token:latest \
  --set-env-vars=BASE_URL=https://sonar-mcp-server-343509396461.europe-north1.run.app

gcloud run services delete sonar-mcp-server --async --region=europe-north1

维护者

M.-利安德·莱默(@lreimer), mario-leander.reimer@qaware.de

许可证

此软件是在麻省理工学院开源许可证下提供的,请阅读 LICENSE 文件以获取详细信息。