返回市场
声呐MCP服务器

声呐MCP服务器

作者:lreimer2 星标更新:2025-05-10

项目介绍

Sonar MVP 服务器

这是一个用Golang实现的SonarQube云API的MCP服务器。

构建与发布

# 快速构建最新快照
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": "<<在此插入令牌>>"
        }
      }
    }
}

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

# 作为stdio二进制文件
npx @modelcontextprotocol/inspector go run main.go

# 使用SSE服务器
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镜像进行部署。

# 创建一个新的SONAR_TOKEN密钥
gcloud services enable secretmanager.googleapis.com
print $SONAR_TOKEN | gcloud secrets create sonar-token --data-file=-

# 接下来从源代码部署本地构建到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.-Leander Reimer (@lreimer),mario-leander.reimer@qaware.de

许可证

本软件根据MIT开源许可证提供,详情请参阅LICENSE文件。