使用说明
谷歌云MCP服务器
使用Go和Cobra的Google Cloud的MCP服务器实现。
服务器支持 stdio 以及 SSE 作为运输。下列
服务和运营已经实施:
- 项目:项目列表,项目描述
- 容器:集群列表,集群描述
- 云运行:服务列表,服务描述
构建和发布
goreleaser build --snapshot --clean
goreleaser release --skip=publish --snapshot --clean
使用说明
如果您想在本地使用该工具,例如使用Claude Desktop,请使用以下工具 MCP服务器的配置。
{
"mcpServers": {
"gcloud": {
"command": "/Users/mario-leander.reimer/Applications/gcp-mcp-server",
"args": ["--transport", "stdio"],
"env": {
}
}
}
}
或者,您可以使用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:8000/sse
npx @modelcontextprotocol/inspector
部署
目前使用手动Google Cloud Run部署。两者都可以部署 直接从源代码或使用构建在Github上的Docker镜像。
# make sure to enable all required APIs
gcloud services enable secretmanager.googleapis.com
gcloud services enable cloudbuild.googleapis.com artifactregistry.googleapis.com
gcloud services enable run.googleapis.com
# create Google service account with required permissions and create key file
export PROJECT_ID=$(gcloud config get-value project)
export SA_NAME=gcp-mcp-server-sa
gcloud iam service-accounts create $SA_NAME --display-name="GCP MCP Server Service Account"
gcloud projects add-iam-policy-binding $PROJECT_ID \
--member="serviceAccount:$SA_NAME@$PROJECT_ID.iam.gserviceaccount.com" \
--role="roles/editor"
gcloud iam service-accounts keys create $SA_NAME.json \
--iam-account=$SA_NAME@$PROJECT_ID.iam.gserviceaccount.com
# create the keyfile as a secret and attach IAM policy
gcloud secrets create $SA_NAME --data-file=$SA_NAME.json
gcloud secrets add-iam-policy-binding $SA_NAME \
--member=serviceAccount:343509396461-compute@developer.gserviceaccount.com \
--role=roles/secretmanager.secretAccessor
gcloud run deploy gcp-mcp-server --source=. \
--region=europe-north1 \
--port=8000 --allow-unauthenticated \
--set-secrets=/secrets/gcp-mcp-server-sa.json=gcp-mcp-server-sa:latest \
--set-env-vars=GOOGLE_APPLICATION_CREDENTIALS=/secrets/gcp-mcp-server-sa.json,BASE_URL=https://gcp-mcp-server-343509396461.europe-north1.run.app
gcloud run services delete gcp-mcp-server --async --region=europe-north1
维护者
M.-利安德·莱默(@lreimer), mario-leander.reimer@qaware.de
许可证
该软件是在麻省理工学院开源许可证下提供的,请阅读
这 LICENSE 文件以获取详细信息。