使用说明
GCP-MCP:谷歌云平台模型控制协议服务器
⚠️ 实验项目⚠️
该项目提供模型控制协议(MCP)服务器,用于与谷歌云平台资源进行交互。
概述
GCP-MCP允许AI助手和其他MCP客户端通过标准化接口与谷歌云平台服务进行交互。
安装
先决条件
- 紫外线
- 以适当的权限访问谷歌云平台
- Google Cloud SDK(用于身份验证)
设置
-
克隆此存储库:
git clone https://github.com/manuelbernhardt/gcp-mcp.git cd gcp-mcp -
使用安装依赖项
uv:uv sync -
使用Google Cloud进行身份验证:
gcloud auth application-default login
可用工具
秘密经理
list_secrets:列出GCP项目中的机密(可选按前缀筛选)delete_secret:从秘密管理器中删除秘密add_secret:在秘密管理器中添加或更新秘密get_secret_value:检索机密的值
云运行
list_cloud_run_services:列出项目和区域中的Cloud Run服务delete_cloud_run_service:删除云运行服务get_cloud_run_service_logs:获取Cloud Run服务的最新日志
配置游标
创建一个 mcp.json 文件在 ~/.cursor/mcp.json:
{
"mcpServers": {
"gcp": {
"command": "uv",
"args": ["--directory", "/path/to/gcp-mcp", "run", "main.py"]
}
}
}
测试
运行测试
# Run all tests
python -m unittest discover
# Run Secret Manager tests
python -m unittest test_secret_manager.py
# Run Cloud Run tests
python -m unittest test_cloud_run.py
# Run a specific test class
python -m unittest test_secret_manager.TestSecretManagerFunctions
python -m unittest test_cloud_run.TestCloudRunFunctions
# Run a specific test
python -m unittest test_secret_manager.TestSecretManagerFunctions.test_list_secrets
