mcpField
S
Sonar MVP Server

Sonar MVP Server

本地服务
github.com/lreimer开发工具277 周前更新

关于 Sonar MVP Server

Sonar MVP Server 是一个用于访问 SonarQube Cloud API 的 Go MCP 服务,支持本地 stdio 和 SSE 传输,并提供 Google Cloud Run 部署说明。

主要功能

  1. 01访问 SonarQube Cloud API
  2. 02支持 stdio 和 SSE 传输
  3. 03支持部署到 Google Cloud Run

适用场景

  1. 01通过 MCP 客户端连接 SonarQube Cloud
  2. 02在本地通过 stdio 运行服务
  3. 03将服务部署到 Google Cloud Run

MCP 相关

它通过 MCP 服务提供 SonarQube Cloud API 访问能力。README 展示了 stdio 配置和 SSE 用法。

配置

本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。

mcp.json · 通用配置
{
"mcpServers": {
"sonar": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/inspector"
]
}
}
}
启动命令npx -y @modelcontextprotocol/inspector

本地服务需要在你的电脑上安装运行环境(如 Node.js 18+)。各客户端的配置文件位置不同,请参考客户端文档。

安装包
npm@modelcontextprotocol/inspector

工具

还没有获取到工具列表

本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。

详细介绍

Sonar MVP Server

SonarQube Cloud API 的 Golang 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 introspector 轻松进行本地开发:

# 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:[email protected] \
  --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),[email protected]

许可证

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

评论

支持 Markdown

第一次接触 MCP?

从协议是什么,到在客户端里装上第一个服务,这几条回答覆盖了大多数入门问题。

一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。