Gcp Cost MCP Server

MCP运维云端

提供方 nozomi-koborinai · 包名 @modelcontextprotocol/inspector

运维云端 stdio · 本地进程 OAuth 授权 社区 / 第三方 Claude DesktopClaudeCursor
查看接入方式

一个用于估算Google Cloud运行成本的MCP服务器,可直接从AI助手获取GCP成本估算,支持动态生成估算指南和自动免费层级扣除。

一句话选型结论

按资料字段整理

Gcp Cost MCP Server 属于运维云端类 MCP 服务器,stdio · 本地进程,OAuth 授权,可直接接入 Claude Desktop、Claude、Cursor,有可直接执行的安装命令。接入前先确认权限范围;涉及写入、删除或付款的操作,建议先在测试环境验证。

分类运维云端 传输方式stdio · 本地进程 鉴权OAuth 授权 部署方式本地部署
GitHub 星标 16 仓库热度,无公开仓库时显示未标注
工具数 5 暴露给模型的工具数量
资源 / 提示词 0 / 0 资源与提示词模板数量
维护方 社区 / 第三方 核验等级 仅资料核对

工具与能力

运维云端
数量来自来源目录的标注,具体工具清单以官方文档为准
工具数量5暴露给模型可调用的工具个数
资源数量0可读取的资源条目
提示词数量0内置提示词模板数量

能力标签

支持客户端

适用场景

云计算Go本地部署成本估算GoogleCloudAI集成自动化工具

安装与配置

stdio · 本地进程 OAuth 授权
客户端在本机拉起子进程,数据不出本机
npx @modelcontextprotocol/inspector ./gcp-cost-mcp-server

这条命令只是入口,具体启动参数请按官方文档补齐,不要直接照搬到别的服务器。

  1. 1
    准备运行环境

    stdio 服务在本地起进程,需要先装好 Node.js,再按安装命令拉取依赖。

  2. 2
    安装服务

    复制上面的安装命令执行;命令里带占位符的位置,换成自己的密钥或路径。

  3. 3
    写入客户端配置

    在客户端的 MCP 配置里填好启动命令和参数,保存后完全退出客户端再打开,让新配置生效。

  4. 4
    验证是否可用

    连接成功后客户端会列出约 5 个工具,随便调一个只读工具确认能返回结果。

典型使用场景

3 类
按分类与标签整理的常见用法,具体以官方文档为准
云资源查询

查实例、存储、账单等云上资源状态。

部署与发布

把部署、重启、回滚这类操作接进对话。

监控与告警

拉取监控指标,异常时让模型帮你判断。

选择建议

选之前先看这几条
按条目字段给出的判断,不替你决定用不用

值得选的地方

  • 资料标注 5 个工具,职责相对集中,接入后不容易误操作。
  • 有现成的安装命令,不用自己找入口,照着跑就能起服务。
  • 已适配 Claude Desktop、Claude、Cursor,换客户端不用重新研究配置。

先想清楚的地方

  • stdio 方式要求本地装好运行时(如 Node.js),换机器要重新装一遍。
  • 使用前要准备好OAuth 授权对应的凭据,并按最小权限配置。
  • 版本更新与行为细节以官方仓库为准。

更适合

  • 需要在运维云端场景里让模型直接调用外部能力的人。
  • 已经在用 Claude Desktop、Claude 的用户,接入路径最短。
  • 想先快速试一下、能接受在本地或自有环境跑服务的人。

不太适合

  • 完全不想在本地装环境的人。
  • 不方便管理密钥或第三方授权的人。
  • 需要厂商级 SLA 和技术支持的生产环境。

同类对比

6 个同类
同分类里挑最接近的几条,字段以各自详情页为准
MCP 服务器工具数传输方式部署方式安装命令最后核验
Gcp Cost MCP Server当前 5 stdio · 本地进程 本地部署 有 2026-05-17
lobehub 未标注 stdio · 本地进程 本地部署 有 2026-04-11
TrendRadar 未标注 stdio · 本地进程 本地部署 有 2026-04-13
Ui Tars Desktop 8a825770 未标注 stdio · 本地进程 本地部署 有 2026-05-17
ruflo 未标注 stdio · 本地进程 本地部署 有 2026-04-13
FastGPT 未标注 stdio · 本地进程 本地部署 有 2026-04-11

服务器档案

运维云端
字段来自项目仓库与公开索引,中文说明由本站标注
提供方nozomi-koborinai上游标注的维护方 nozomi-koborinai
分类运维云端本站按上游分类展示
连接方式stdio · 本地进程客户端在本机拉起子进程,数据不出本机
鉴权方式OAuth 授权远程服务建议用最小权限凭据
维护方社区 / 第三方核验等级 仅资料核对
包名 / 运行时@modelcontextprotocol/inspector · Node.js本地安装时用到的包标识与运行时
部署类型本地部署上游给出的部署形态
最近核验2026-05-17上游最后核验时间

详细介绍

16.7 KB
来自项目仓库与上游目录的原文,未做删改

GCP成本MCP服务器

> 备注:这是一个非官方项目,不隶属于谷歌或Genkit团队,也不得到谷歌或Genkit团队的认可或支持。

用于估算Google Cloud运行成本的MCP(模型上下文协议)服务器。

而不是手动使用 谷歌云定价计算器,您可以直接从Claude Desktop、Gemini CLI或Cursor等AI助手获得GCP成本估算。

特性

可用工具

工具 说明
get_estimation_guide 从这里开始! 根据SKU分析为任何GCP服务动态生成估算指南
list_services 列出所有可用的Google Cloud服务及其ID
list_skus 列出特定服务的SKU(可计费项目)
get_sku_price 获取特定SKU的定价详细信息
estimate_cost 根据SKU和使用量计算成本, 自动扣除免费等级

工具关系

每个工具都是 独立和无国籍AI助手根据上下文自主决定调用哪些工具以及调用顺序:```mermaid
graph TB
guide["get_estimation_guide
─────────────────
IN: service_name
OUT: required params, pricing
factors, free tier info, tips
─────────────────
Internally resolves
service & SKU lookup"]

services["list_services
─────────────────
IN: name filter (opt)
OUT: service_id, display_name"]

skus["list_skus
─────────────────
IN: service_id, region, keyword
OUT: sku_id, display_name,
categories, regions"]

price["get_sku_price
─────────────────
IN: sku_id, currency
OUT: price/unit, pricing tiers"]

cost["estimate_cost
─────────────────
IN: sku_id, usage_amount
OUT: estimated cost with
automatic free tier deduction
─────────────────
Internally resolves pricing"]

services -- "service_id" --> skus
skus -- "sku_id" --> price
skus -- "sku_id" --> cost


> **实心箭头** 显示数据流——一个工具的输出为另一个工具提供输入。 `get_estimation_guide` 和 `estimate_cost` 是 **独立的**:它们在内部解决了自己的依赖关系,减少了往返。

|用例|人工智能如何使用工具|
|----------|----------------------|
| **快速估算** | `get_estimation_guide` → 收集用户需求→ `estimate_cost` |
| **多业务** |多个 `get_estimation_guide` + `estimate_cost` 电话 **并行** |
| **探索定价** | `list_services` → `list_skus` → `get_sku_price` |
| **直接计算** | `estimate_cost` 具有已知的SKU ID|

### 支持服务列表

`get_estimation_guide` 与...合作 **任何谷歌云服务**:

- **动态指南生成**:通过分析云计费目录API中的SKU动态生成指南
- **免费等级信息**:自动从GCP文档中提取并包含在指南中
- **普遍覆盖**:适用于所有GCP服务-没有硬编码的服务列表

该工具分析可用SKU以确定:

- 所需参数(区域、实例类型、存储等)
- 定价因素和计费维度
- 免费等级配额(如果可用)
- 成本优化提示

## 快速开始

### 先决条件

- 谷歌云SDK(`gcloud`)已安装
- 已配置应用程序默认凭据

> **备注**:无需设置Google Cloud项目或启用API。此服务器使用OAuth身份验证访问公共定价数据。

### 1.设置身份验证```bash
gcloud auth application-default login

2.安装

选择最适合您环境的安装方法:

选项A:自制(macOS/Linux)——推荐

在macOS或Linux上安装的最简单方法:```bash
brew tap nozomi-koborinai/tap
brew install gcp-cost-mcp-server


二进制文件将安装到 `/opt/homebrew/bin/gcp-cost-mcp-server` (苹果硅)或 `/usr/local/bin/gcp-cost-mcp-server` (英特尔/Linux)。

**升级到最新版本:**```bash
# Update tap to fetch the latest Formula
brew update

# Check the available version
brew info gcp-cost-mcp-server

# Upgrade to the latest version
brew upgrade gcp-cost-mcp-server

> 备注:始终运行 brew update 首先,确保您获得最新版本。如果没有它,Homebrew将使用缓存的配方信息。

选项B:下载预构建的二进制文件

下载自 GitHub发布 对于您的平台:

二进制 平台 架构
gcp-cost-mcp-server-darwin-arm64 macOS 苹果硅(M1/M2/M3/M4)
gcp-cost-mcp-server-darwin-amd64 macOS 英特尔
gcp-cost-mcp-server-linux-amd64 Linux x86_64
gcp-cost-mcp-server-windows-amd64.exe Windows x86_64

> macOS用户:下载后,删除隔离属性:
>
>bash > chmod +x gcp-cost-mcp-server-darwin-* > xattr -d com.apple.quarantine gcp-cost-mcp-server-darwin-* >

选项C:从源代码构建

需要Go 1.21+:```bash
git clone https://github.com/nozomi-koborinai/gcp-cost-mcp-server.git
cd gcp-cost-mcp-server
go build -o gcp-cost-mcp-server .


### 3.配置您的MCP客户端

先找到你的二进制路径:```bash
# If installed via Homebrew
which gcp-cost-mcp-server
# Output: /opt/homebrew/bin/gcp-cost-mcp-server (Apple Silicon)
#         /usr/local/bin/gcp-cost-mcp-server (Intel/Linux)

克劳德桌面

增添 ~/Library/Application Support/Claude/claude_desktop_config.json:```json
{
"mcpServers": {
"gcp-cost": {
"command": "/opt/homebrew/bin/gcp-cost-mcp-server"
}
}
}


#### 光标

增添 `.cursor/mcp.json` 在您的项目或全局配置中:```json
{
"mcpServers": {
"gcp-cost": {
"command": "/opt/homebrew/bin/gcp-cost-mcp-server"
}
}
}

Gemini CLI

增添 ~/.gemini/settings.json:```json
{
"mcpServers": {
"gcp-cost": {
"command": "/opt/homebrew/bin/gcp-cost-mcp-server"
}
}
}


> **备注**:替换 `/opt/homebrew/bin/gcp-cost-mcp-server` 如果不同,请使用实际的二进制路径。

## 使用示例

### 基本成本估算(对话式)

从一个简单的问题开始——人工智能将指导你完成细节:```
You: "How much would Cloud Run cost for 2 instances?"

AI: "To estimate Cloud Run costs accurately, I need a few more details:
- Region: Where will this be deployed? (e.g., asia-northeast1, us-central1)
- vCPU: How many vCPUs per instance? (e.g., 1, 2, 4)
- Memory: How much memory per instance? (e.g., 1 GiB, 2 GiB)
- Billing type: Instance-based or request-based?
- Monthly usage: Will it run 24/7 (730 hours) or less?"

You: "Tokyo region, 1 vCPU, 2GB memory, instance-based, 24/7"

AI: "Based on your requirements for 2 Cloud Run instances in Tokyo (asia-northeast1):

📊 Cost Breakdown:
- vCPU: 2 vCPU × 2,628,000 sec = 5,256,000 vCPU-seconds
Free tier applied: -180,000 vCPU-seconds
Billable: 5,076,000 vCPU-seconds × $0.000024 = $121.82/month

- Memory: 4 GiB × 2,628,000 sec = 10,512,000 GiB-seconds
Free tier applied: -360,000 GiB-seconds
Billable: 10,152,000 GiB-seconds × $0.0000025 = $25.38/month

💰 Total estimated: ~$147.20/month (free tier already applied)

💡 Tip: Cloud Run's free tier (180,000 vCPU-sec + 360,000 GiB-sec/month)
has been automatically deducted from your estimate."

探索服务和SKU```

You: "What's the service ID for Compute Engine?"
You: "List the available SKUs for Compute Engine in Tokyo region"
You: "How much would an n2-standard-4 instance cost for 730 hours?"


### 任何GCP服务

所有服务均支持动态指南生成:```
You: "How much would Vertex AI cost for my ML training?"

AI: "I'll generate an estimation guide for Vertex AI by analyzing available SKUs...

Based on my analysis, to estimate Vertex AI costs, I need:
1. Region: Where will training run?
2. Machine type: What accelerator type? (e.g., NVIDIA T4, A100)
3. Training hours: How long will training take?
4. Storage: How much training data?

Free tier note: Vertex AI offers $300 in free credits for new users.

Would you like me to list the specific SKUs available for Vertex AI?"

架构图估算(多服务)

上传架构图并获得完整的成本明细:```
You: [Upload architecture diagram image]
"Please estimate the monthly cost for this architecture"

AI: "I've analyzed your architecture diagram. Here are the GCP services identified:
- Cloud Run (Application layer)
- Cloud SQL (Database)
- Cloud Storage (Static files)
- Cloud Load Balancing (Traffic distribution)

To provide an accurate estimate, I need some details:

🌏 Common Settings:
- Region: Is asia-northeast1 (Tokyo) okay?

📦 Cloud Run:
- vCPUs: 1? 2? 4?
- Memory: 1GB? 2GB? 4GB?
- Instance count: How many instances?
- Uptime: 24/7 or specific hours only?

🗄️ Cloud SQL:
- Database type: MySQL? PostgreSQL?
- Machine type: Dev (db-f1-micro)? Production (db-custom-2-4096)?
- Storage: How many GB needed?
- High Availability (HA): Required?"

You: "Tokyo region, Cloud Run with 1vCPU/2GB × 2 instances running 24/7,
Cloud SQL PostgreSQL db-custom-2-4096, 100GB SSD with HA,
Cloud Storage 50GB Standard"

AI: "Thank you! Here's your estimate (free tiers automatically applied):

Service Configuration Monthly Cost
Cloud Run 2 × 1vCPU × 2GB (24/7) $147.20 ✨
Cloud SQL PostgreSQL, 2vCPU/4GB, 100GB HA $178.50
Cloud Storage 50GB Standard $0.00 ✨
Cloud Load Balancing Base + traffic $18.00
Total $343.70

✨ = Free tier applied

💡 Cost Optimization Tips:
- Cloud Run: Set min instances to 0 to reduce idle costs
- Cloud SQL: Disable HA for ~50% savings (dev environments)
- Consider 1yr/3yr Committed Use Discounts (CUDs) for up to 57% off"


此工作流程:

1. AI分析架构图以识别GCP服务
1. AI首先询问共享参数(地区),然后询问服务特定的详细信息
1. AI使用MCP工具计算每项服务的成本
1. AI提供了一个包含总体和优化提示的综合细分

## 身份验证选项

### 使用应用程序默认凭据(推荐)

这是个人使用的最简单的选择:```bash
gcloud auth application-default login

使用服务帐户

对于生产或自动化环境,请使用服务帐户:```json
{
"mcpServers": {
"gcp-cost": {
"command": "/path/to/gcp-cost-mcp-server",
"env": {
"GOOGLE_APPLICATION_CREDENTIALS": "/path/to/service-account.json"
}
}
}
}


**所需IAM角色** (仅适用于定制/合同定价):

- `roles/billing.viewer` (账单账户查看器)

> 对于公开定价数据,不需要IAM角色。

______________________________________________________________________

## 建筑

### 项目结构```
gcp-cost-mcp-server/
├── main.go                      # Entry point, tool registration
├── internal/
│   ├── freetier/                # Free tier information retrieval
│   │   ├── service.go           # FreeTierService with 24h cache
│   │   ├── search.go            # DuckDuckGo search client
│   │   ├── scraper.go           # GCP documentation scraper
│   │   └── patterns.go          # Regex patterns for extraction
│   ├── pricing/
│   │   └── client.go            # Cloud Billing Catalog API client
│   ├── tools/
│   │   ├── get_estimation_guide.go  # Dynamic guide generator
│   │   ├── estimate_cost.go         # Cost calc + free tier
│   │   ├── list_services.go
│   │   ├── list_skus.go
│   │   └── get_sku_price.go
│   └── mcp/
│       └── server.go            # MCP server wrapper

工具设计```mermaid

flowchart TB
subgraph MCP["MCP Server Tools"]
direction TB

Guide["get_estimation_guide
─────────────────
• Dynamic SKU analysis
• Free tier info included
• Self-contained"]

Services["list_services
─────────────────
Returns: service IDs"]
SKUs["list_skus
─────────────────
Returns: SKU IDs, regions"]
Price["get_sku_price
─────────────────
Returns: price/unit, tiers"]
Cost["estimate_cost
─────────────────
• Auto free tier deduction
• Tiered pricing support
• Self-contained"]

Services --> SKUs
SKUs --> Price
SKUs --> Cost
end

subgraph External["External Services"]
Billing["Google Cloud Billing API v2beta
cloudbilling.googleapis.com"]
Docs["GCP Documentation
(for free tier info)"]
DDG["DuckDuckGo Search
(fallback for doc discovery)"]
end

MCP --> Billing
Guide -.-> Docs
Guide -.-> DDG
Cost -.-> Docs
Cost -.-> DDG


### 数据流```mermaid
sequenceDiagram
participant User
participant AI as AI Assistant
participant MCP as MCP Server
participant API as Cloud Billing API
participant Docs as GCP Docs

User->>AI: "How much would Cloud Run cost?"
AI->>MCP: get_estimation_guide("Cloud Run")
MCP->>API: ListSKUs(Cloud Run)
API-->>MCP: SKU list
MCP->>Docs: Fetch free tier info
Docs-->>MCP: Free tier data
MCP-->>AI: Dynamic guide + free tier
AI->>User: "I need: region, vCPU, memory..."

User->>AI: "Tokyo, 1vCPU, 2GB, 24/7"
AI->>MCP: list_services()
MCP->>API: ListServices
API-->>MCP: Service IDs
AI->>MCP: list_skus(service_id)
MCP->>API: ListSKUs
API-->>MCP: SKU details
AI->>MCP: estimate_cost(sku_id, usage)
MCP->>MCP: Apply free tier deduction
MCP-->>AI: Cost with free tier applied
AI->>User: "Estimated: $147.20/month (free tier applied)"

关键组件

组件 描述
get_estimation_guide 通过分析云计费API的SKU动态生成指南。包括从GCP文档中获取的免费等级信息。
list_services 查询云计费API中的所有可用服务。返回查询SKU所需的服务ID。
list_skus 列出特定服务的SKU。可按地区和类别筛选。
get_sku_price 获取特定SKU的详细定价。支持多种货币(美元、日元、欧元等)。
估算成本 通过自动扣除免费等级来计算最终成本。处理分层定价计算。
FreeTier服务 通过DuckDuckGo搜索+GCP文档抓取获取免费等级信息。将结果缓存24小时。

发展

构建```bash

go build -o gcp-cost-mcp-server .


### 测试```bash
# Run all tests
go test -v ./...

# With coverage
go test -cover ./...

使用MCP检查员进行测试```bash

npx @modelcontextprotocol/inspector ./gcp-cost-mcp-server


### 交叉编译```bash
# macOS (Apple Silicon)
GOOS=darwin GOARCH=arm64 go build -o dist/gcp-cost-mcp-server-darwin-arm64 .

# macOS (Intel)
GOOS=darwin GOARCH=amd64 go build -o dist/gcp-cost-mcp-server-darwin-amd64 .

# Linux (x86_64)
GOOS=linux GOARCH=amd64 go build -o dist/gcp-cost-mcp-server-linux-amd64 .

# Windows (x86_64)
GOOS=windows GOARCH=amd64 go build -o dist/gcp-cost-mcp-server-windows-amd64.exe .

发布过程

通过以下方式自动发布 GoRelease GitHub Actions。

要创建新版本,请执行以下操作:```bash

1. Create and push a tag

git tag v0.6.0
git push origin v0.6.0


这将自动:

1. 为所有平台构建二进制文件(darwin/linux/windows、amd64/arm64)
1. 使用changelog创建GitHub版本
1. 更新 自制水龙头 公式

**自制水龙头自动化的先决条件:**

- GitHub个人访问令牌(PAT) `repo` 范围
- 将其存储为 `HOMEBREW_TAP_TOKEN` 存储库中的机密

### 本地开发```bash
# Build
go build -o gcp-cost-mcp-server .

# Run locally
./gcp-cost-mcp-server

# Test GoReleaser config (dry run)
goreleaser release --snapshot --clean

为什么选择Genkit for Go?

此MCP服务器由以下组件构建 Genkit for Go 而不是使用生的 mcp走 图书馆直接。原因如下:

类型安全工具定义

Genkit自动从Go结构标签生成JSON模式,消除了手动模式定义:go // Genkit: Type-safe with auto-generated schema genkit.DefineTool(g, "list_skus", "Lists SKUs for a service", func(ctx *ai.ToolContext, input struct { ServiceID string `json:"service_id" jsonschema_description:"The service ID"` PageSize int `json:"page_size,omitempty"` }) (*Output, error) { // Implementation })

自动MCP电桥

Genkit的MCP插件会自动从注册表中发现工具并将其转换为MCP格式,无需手动注册。

统一的生态系统

特点 优点
Genkit用户界面 在开发过程中直观地调试和测试工具
追踪 自动执行跟踪和可观察性
AI模型集成 与Gemini、Bedrock、OpenAI无缝连接
MCP主机 使用同一代码库中的其他MCP服务器

刀具中断支持

Genkit的 ToolContext 为长时间运行的操作提供中断/恢复功能,这对用户确认流很有用。

面向未来

工具定义与以下工具定义相同:

  • MCP服务器工具(适用于Claude Desktop、Cursor、Gemini CLI)
  • Genkit Flow组件(用于AI代理工作流)
  • HTTP API端点(通过 genkit.Handler)

有关更多详细信息,请参阅 Genkit MCP插件文档.

许可证

MIT许可证

常见问题

8 问
答案由本站依据条目字段整理,不引用上游原文
Gcp Cost MCP Server 怎么安装?

在客户端按下面的安装命令接入:npx @modelcontextprotocol/inspector ./gcp-cost-mcp-server。对应的包名是 @modelcontextprotocol/inspector。装完在客户端配置里引用同一个包或端点。

Gcp Cost MCP Server 怎么在 Claude Desktop、Claude、Cursor 里配置?

它的传输方式是stdio · 本地进程,在客户端的 MCP 配置里填好启动命令和参数,保存后完全退出客户端再打开,配置才会生效。

Gcp Cost MCP Server 收费吗?

本站不代收费用,也没有标注具体价格。是否收费取决于服务本身和背后的接口额度,正式使用前按官方说明确认。

Gcp Cost MCP Server 需要 API Key 吗?

资料标注需要OAuth 授权认证,使用前准备好对应凭据,并按最小权限配置。

Gcp Cost MCP Server 支持哪些客户端?

资料标注支持 Claude Desktop、Claude、Cursor;其他客户端只要能配置 MCP Server,也能用同样的命令或地址接入。

Gcp Cost MCP Server 能提供哪些能力?

资料显示约 5 个工具;能力标签包括 云计算、Go、Claude。具体工具清单以官方文档为准。

Gcp Cost MCP Server 需要什么运行环境?

运行时为 Node.js;属于本地进程,需要在本机装好运行环境。

Gcp Cost MCP Server 是本地还是远程?

它是本地进程(stdio),由客户端在本机拉起。传输方式为stdio · 本地进程。

热门专题

按标签挑服务器
全部专题 →

服务器信息以作者仓库与官方文档为准;分类、传输方式与鉴权方式的中文说明为中文整理,最近核验 2026-05-17。