platform-mcp
A read-only MCP server that enables AI agents to act as GCP platform engineers, allowing them to investigate incidents, take inventory, and find cost-optimization opportunities in Google Cloud projects without mutating any infrastructure.
README
platform-mcp
A read-only Model Context Protocol server that turns an AI agent (Claude Code, Claude Desktop, or any MCP client) into a GCP platform engineer. Point it at a Google Cloud project and ask it to investigate incidents, take inventory, and surface cost-optimization opportunities — all without any ability to change your infrastructure.
Observation only. No tool in this server mutates state. Combined with a viewer-only identity (below), that gives you a hard, defense-in-depth guarantee that an agent can look but never touch.
What it can do
| Area | Tools |
|---|---|
| Logs & errors | query_logs, get_recent_errors, list_error_groups |
| Metrics & alerting | query_metric, list_alert_policies, list_uptime_checks |
| Cost & recommendations | get_cost_breakdown, get_billing_info, list_cost_recommendations, list_recommendations |
| Resource inventory | search_assets, list_compute_instances, list_cloud_run_services, list_gke_clusters, list_sql_instances |
Typical prompts once it's connected:
- "What are the top error groups in the last 24 hours, and which one is newest?"
- "Which GKE node pools are over-provisioned? Show mean CPU against machine type."
- "Where can I reduce spend in this project?"
Requirements
- Python 3.11+
- A Google Cloud project and credentials (your own login, or a service account)
- The
gcloudCLI for the one-time setup
Install
git clone https://github.com/deBilla/platform-mcp.git
cd platform-mcp
python3 -m venv .venv
./.venv/bin/pip install -e .
One-time GCP setup
1. Enable the APIs the tools depend on:
gcloud services enable \
logging.googleapis.com monitoring.googleapis.com clouderrorreporting.googleapis.com \
recommender.googleapis.com cloudasset.googleapis.com cloudbilling.googleapis.com \
bigquery.googleapis.com \
--project YOUR_PROJECT_ID
2. Grant read-only access to the identity the server runs as.
For local development with your own login (Application Default Credentials):
gcloud auth application-default login
The identity needs these viewer roles on the project, plus roles/billing.viewer
on the billing account:
roles/viewer # broad read (compute, run, gke, sql via Asset Inventory)
roles/logging.viewer
roles/monitoring.viewer
roles/errorreporting.viewer
roles/recommender.viewer
roles/cloudasset.viewer
roles/bigquery.dataViewer # only for get_cost_breakdown
roles/bigquery.jobUser # only for get_cost_breakdown
3. (Recommended) Use a dedicated read-only service account instead of your login:
PROJECT=YOUR_PROJECT_ID
gcloud iam service-accounts create platform-mcp-ro \
--display-name "platform-mcp read-only" --project $PROJECT
SA=platform-mcp-ro@$PROJECT.iam.gserviceaccount.com
for ROLE in roles/viewer roles/logging.viewer roles/monitoring.viewer \
roles/errorreporting.viewer roles/recommender.viewer roles/cloudasset.viewer; do
gcloud projects add-iam-policy-binding $PROJECT \
--member="serviceAccount:$SA" --role="$ROLE"
done
# Let your own login impersonate it (no key file to manage):
gcloud iam service-accounts add-iam-policy-binding $SA \
--member="user:you@example.com" \
--role="roles/iam.serviceAccountTokenCreator" --project $PROJECT
Then impersonate it (preferred — no key file):
export IMPERSONATE_SERVICE_ACCOUNT=$SA
…or point at a downloaded key via GOOGLE_APPLICATION_CREDENTIALS.
Security model
Read-only is enforced by IAM, not by OAuth scope. The server requests the
broad cloud-platform scope and stays read-only purely because it never calls a
mutating API. Do not rely on the code alone — run it under a viewer-only
identity (step 3 above) so the credential itself is incapable of writing,
regardless of what code executes. This gives you two independent layers: the
server doesn't try to write, and the identity couldn't if it did.
Configuration
Copy the example config and fill in your values:
cp .mcp.json.example .mcp.json
.mcp.json is git-ignored, so your project id and service-account email stay
local. Environment variables it (or your shell) can set:
| Variable | Purpose |
|---|---|
GCP_PROJECT |
Target project. Falls back to your ADC default project if unset. |
IMPERSONATE_SERVICE_ACCOUNT |
Read-only SA to impersonate (no key file needed). |
GOOGLE_APPLICATION_CREDENTIALS |
Path to a read-only SA key file (alternative to impersonation). |
BILLING_EXPORT_TABLE |
Fully-qualified BigQuery billing export table, required only for get_cost_breakdown (e.g. YOUR_PROJECT_ID.billing.gcp_billing_export_v1_XXXXXX). |
PLATFORM_MCP_DEFAULT_LIMIT |
Default max rows for list-style tools (default 50). |
Register with a client
Claude Code / Claude Desktop — add the block from .mcp.json.example to your
MCP config (.mcp.json in a project for Claude Code, or
claude_desktop_config.json for Desktop), pointing command at the venv's
console script so no global install is needed:
{
"mcpServers": {
"platform-mcp": {
"command": "/absolute/path/to/platform-mcp/.venv/bin/platform-mcp",
"env": {
"GCP_PROJECT": "YOUR_PROJECT_ID",
"IMPERSONATE_SERVICE_ACCOUNT": "platform-mcp-ro@YOUR_PROJECT_ID.iam.gserviceaccount.com"
}
}
}
}
MCP Inspector — for interactive testing:
./.venv/bin/mcp dev src/platform_mcp/server.py
Notes
- All tools cap result counts and truncate long payloads to stay token-friendly.
- Cost recommenders are zonal/regional;
list_cost_recommendationsauto-discovers the locations where you have resources (via Asset Inventory) and fans out, skipping locations and recommenders that are empty or unavailable. get_cost_breakdownuses parameterized BigQuery queries with a whitelisted set of group-by columns.
License
MIT © 2026 Dimuthu Wickramanayake
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。