GCP MCP

GCP MCP

一个模型上下文协议服务器,它使像 Claude 这样的人工智能助手能够通过自然语言与 Google Cloud Platform (GCP) 环境进行交互,从而允许用户在对话期间查询和管理 GCP 资源。

Category
访问服务器

Tools

run-gcp-code

Run GCP code

list-projects

List all GCP projects accessible with current credentials

select-project

Selects GCP project to use for subsequent interactions

get-billing-info

Get billing information for the current project

get-cost-forecast

Get cost forecast for the current project

get-billing-budget

Get billing budgets for the current project

list-gke-clusters

List all GKE clusters in the current project

list-sql-instances

List all Cloud SQL instances in the current project

get-logs

Get Cloud Logging entries for the current project

README

GCP MCP

一个模型上下文协议 (MCP) 服务器,使像 Claude 这样的人工智能助手能够与您的 Google Cloud Platform 环境进行交互。这允许在对话期间使用自然语言查询和管理您的 GCP 资源。

GCP MCP Demo

特性

  • 🔍 使用自然语言查询和修改 GCP 资源
  • ☁️ 支持多个 GCP 项目
  • 🌐 多区域支持
  • 🔐 安全的凭据处理(没有凭据暴露给外部服务)
  • 🏃‍♂️ 使用您的 GCP 凭据进行本地执行
  • 🔄 自动重试以提高可靠性

前提条件

  • Node.js
  • Claude Desktop/Cursor/Windsurf
  • 本地配置的 GCP 凭据(应用程序默认凭据)

安装

  1. 克隆存储库:
git clone https://github.com/eniayomi/gcp-mcp
cd gcp-mcp
  1. 安装依赖项:
npm install

配置

Claude Desktop

  1. 打开 Claude 桌面应用程序,转到 Settings -> Developer -> Edit Config

  2. 将以下条目添加到您的 claude_desktop_config.json

通过 npm:

{
  "mcpServers": {
    "gcp": {
      "command": "sh",
      "args": ["-c", "npx -y gcp-mcp"]
    }
  }
}

如果您从源代码安装:

{
  "mcpServers": {
    "gcp": {
      "command": "npm",
      "args": [
        "--silent",
        "--prefix",
        "/path/to/gcp-mcp",
        "start"
      ]
    }
  }
}

如果使用源代码安装,请将 /path/to/gcp-mcp 替换为您的项目目录的实际路径。

Cursor

  1. 打开 Cursor 并转到 Settings (⌘,)
  2. 导航到 AI -> Model Context Protocol
  3. 添加新的 MCP 配置:
{
  "gcp": {
    "command": "npx -y gcp-mcp"
  }
}

Windsurf

  1. 打开 ~/.windsurf/config.json(如果不存在则创建)
  2. 添加 MCP 配置:
{
  "mcpServers": {
    "gcp": {
      "command": "npx -y gcp-mcp"
    }
  }
}

GCP 设置

  1. 设置 GCP 凭据:

    • 使用 gcloud auth application-default login 设置应用程序默认凭据
  2. 刷新您的人工智能助手 (Claude Desktop/Cursor/Windsurf)

用法

首先选择一个项目或提出如下问题:

  • "列出我可以访问的所有 GCP 项目"
  • "显示项目 X 中的所有 Cloud SQL 实例"
  • "我当前的结算状态是什么?"
  • "显示我的 Cloud Run 服务的日志"
  • "列出 us-central1 中的所有 GKE 集群"
  • "显示项目 X 中的所有 Cloud Storage 存储桶"
  • "在 us-central1 中部署了哪些 Cloud Functions?"
  • "列出所有 Cloud Run 服务"
  • "显示 BigQuery 数据集和表"

可用工具

  1. run-gcp-code: 使用 TypeScript 代码执行 GCP API 调用
  2. list-projects: 列出所有可访问的 GCP 项目
  3. select-project: 选择一个 GCP 项目以进行后续操作
  4. get-billing-info: 获取当前项目的结算信息
  5. get-cost-forecast: 获取当前项目的成本预测
  6. get-billing-budget: 获取当前项目的结算预算
  7. list-gke-clusters: 列出当前项目中的所有 GKE 集群
  8. list-sql-instances: 列出当前项目中的所有 Cloud SQL 实例
  9. get-logs: 获取当前项目的 Cloud Logging 条目

示例交互

  1. 列出可用项目:
List all GCP projects I have access to
  1. 选择一个项目:
Use project my-project-id
  1. 检查结算状态:
What's my current billing status?
  1. 查看日志:
Show me the last 10 log entries from my project

支持的服务

  • Google Compute Engine
  • Cloud Storage
  • Cloud Functions
  • Cloud Run
  • BigQuery
  • Cloud SQL
  • Google Kubernetes Engine (GKE)
  • Cloud Logging
  • Cloud Billing
  • Resource Manager
  • 更多即将推出...

故障排除

查看日志:

tail -n 50 -f ~/Library/Logs/Claude/mcp-server-gcp.log

常见问题:

  1. 身份验证错误:确保您已运行 gcloud auth application-default login
  2. 权限错误:检查您帐户的 IAM 角色
  3. API 错误:验证是否在您的项目中启用了所需的 API

贡献

欢迎贡献!请随时提交 Pull Request。

许可证

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选