/ Каталог / Песочница / Google Cloud Run
● Официальный GoogleCloudPlatform 🔑 Нужен свой ключ

Google Cloud Run

автор GoogleCloudPlatform · GoogleCloudPlatform/cloud-run-mcp

Deploy and manage Google Cloud Run services from an agent — official Google MCP, works with gcloud auth.

Official Google Cloud Platform MCP. Deploy containers or file contents to Cloud Run, list and inspect services, pull logs. Uses gcloud Application Default Credentials — no service account JSON in config. Best for agent-driven deploys and diagnose-in-place log queries.

Зачем использовать

Ключевые функции

Живое демо

Как выглядит на практике

cloud-run.replay ▶ готово
0/0

Установка

Выберите клиент

~/Library/Application Support/Claude/claude_desktop_config.json  · Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "cloud-run": {
      "command": "npx",
      "args": [
        "-y",
        "@google-cloud/cloud-run-mcp"
      ]
    }
  }
}

Откройте Claude Desktop → Settings → Developer → Edit Config. Перезапустите после сохранения.

~/.cursor/mcp.json · .cursor/mcp.json
{
  "mcpServers": {
    "cloud-run": {
      "command": "npx",
      "args": [
        "-y",
        "@google-cloud/cloud-run-mcp"
      ]
    }
  }
}

Cursor использует ту же схему mcpServers, что и Claude Desktop. Конфиг проекта приоритетнее глобального.

VS Code → Cline → MCP Servers → Edit
{
  "mcpServers": {
    "cloud-run": {
      "command": "npx",
      "args": [
        "-y",
        "@google-cloud/cloud-run-mcp"
      ]
    }
  }
}

Щёлкните значок MCP Servers на боковой панели Cline, затем "Edit Configuration".

~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "cloud-run": {
      "command": "npx",
      "args": [
        "-y",
        "@google-cloud/cloud-run-mcp"
      ]
    }
  }
}

Тот же формат, что и Claude Desktop. Перезапустите Windsurf для применения.

~/.continue/config.json
{
  "mcpServers": [
    {
      "name": "cloud-run",
      "command": "npx",
      "args": [
        "-y",
        "@google-cloud/cloud-run-mcp"
      ]
    }
  ]
}

Continue использует массив объектов серверов, а не map.

~/.config/zed/settings.json
{
  "context_servers": {
    "cloud-run": {
      "command": {
        "path": "npx",
        "args": [
          "-y",
          "@google-cloud/cloud-run-mcp"
        ]
      }
    }
  }
}

Добавьте в context_servers. Zed перезагружается автоматически.

claude mcp add cloud-run -- npx -y @google-cloud/cloud-run-mcp

Однострочная команда. Проверить: claude mcp list. Удалить: claude mcp remove.

Сценарии использования

Реальные сценарии: Google Cloud Run

Deploy a small service to Cloud Run from the agent

👤 Backend engineers, solo founders shipping prototypes ⏱ ~10 min intermediate

Когда использовать: You have a Node/Python service ready. You want it live on Cloud Run without context-switching to the console.

Предварительные требования
  • gcloud SDK installed + authenticatedgcloud auth login && gcloud auth application-default login
  • A GCP project with billing enabledgcloud projects list
Поток
  1. List projects, pick the right one
    List my GCP projects. I want to deploy to the one tagged with 'staging'.✓ Скопировано
    → Project identified
  2. Deploy the local folder
    Deploy ./my-api as a Cloud Run service named 'api-staging' in us-central1. Allow unauthenticated invocations. Use the auto-detected buildpack.✓ Скопировано
    → Deploy completes, URL returned
  3. Verify
    Get the service details. Call the URL with a curl-style test. Confirm 200.✓ Скопировано
    → Working service URL

Итог: A running Cloud Run service in 3-5 minutes, with the agent recording the URL for you.

Подводные камни
  • Unauthenticated flag exposes the service publicly — great for staging, bad for prod — For anything prod-adjacent, omit allow_unauthenticated and use IAM; front with Cloud Armor if user-facing
  • Each deploy creates a new revision, old ones linger and pin resources — Periodically clean up old revisions with gcloud, or configure revision retention
Сочетать с: fastmcp · fastapi-mcp

Diagnose a Cloud Run service from its logs

👤 On-call engineers ⏱ ~10 min intermediate

Когда использовать: A Cloud Run service is returning 500s. You want to see logs without opening the console.

Поток
  1. Pull recent logs
    Get the last 200 log entries for service 'api-prod' in us-central1. Filter to ERROR severity.✓ Скопировано
    → Error log entries
  2. Find patterns
    Group the errors by message template. Which one is most common? Include one sample stacktrace.✓ Скопировано
    → Top error with stacktrace
  3. Propose remediation
    Based on the stacktrace, point at the likely code path. Recommend a rollback to the previous revision if the errors are concentrated in the last deploy.✓ Скопировано
    → Root cause hypothesis + action

Итог: From alert to rollback decision in 5 minutes.

Подводные камни
  • Log retention is short by default (30 days) — For anything you might need to look at later, export logs to BigQuery or GCS via Log Router
Сочетать с: sentry

Deploy an MCP server (FastMCP / fastapi-mcp) to Cloud Run

👤 Platform engineers hosting shared MCPs ⏱ ~30 min advanced

Когда использовать: You built an MCP server and want it hosted for team-wide use.

Предварительные требования
  • Dockerfile or buildpack-compatible project — Cloud Run can use buildpacks for most languages
Поток
  1. Deploy the server
    Deploy ./my-mcp as Cloud Run service 'acme-mcp', region us-central1. Set env vars from my .env.prod. Require authentication.✓ Скопировано
    → Service deployed behind IAM
  2. Grant IAM access
    Grant role 'roles/run.invoker' on this service to [email protected] group.✓ Скопировано
    → Team can now invoke
  3. Wire clients
    Write the Claude Desktop config that connects via gcloud run services proxy or mcp-remote with IAM token.✓ Скопировано
    → Team has copy-paste setup

Итог: A team-hosted MCP with GCP-native auth, same deploy model as your other services.

Подводные камни
  • SSE connections drop on Cloud Run's default 5-minute request timeout — Set --timeout=3600 on the service; MCP connections need longer idle tolerance
Сочетать с: fastmcp · fastapi-mcp · mcp-context-forge

Комбинации

Сочетайте с другими MCP — эффект x10

cloud-run + fastmcp

Write a Python MCP, deploy to Cloud Run in one session

Scaffold a FastMCP server exposing our pricing API, then deploy it to Cloud Run service 'pricing-mcp' with IAM auth.✓ Скопировано
cloud-run + sentry

Cloud Run errors → Sentry for incident triage

If our Cloud Run service's error rate spikes, pull Sentry's matching issue and correlate stack traces with the last deploy.✓ Скопировано
cloud-run + mcp-context-forge

Host ContextForge itself on Cloud Run to federate MCPs

Deploy mcp-contextforge-gateway to Cloud Run with Redis for federation state. Register our 3 existing MCPs as backends.✓ Скопировано

Инструменты

Что предоставляет этот MCP

ИнструментВходные данныеКогда вызыватьСтоимость
list-projects Discover which project to target (local only) free
create-project name, project_id? Bootstrap a new GCP project (local only) free
list-services project, region? See what's running in a project/region free
get-service project, region, service Inspect a specific service's config free
get-service-log project, region, service, filter?, limit? Debugging — pull recent logs free
deploy-local-folder folder_path, service, region, project, allow_unauthenticated? Deploy code you have locally (local only) free (build) + per-request Cloud Run pricing
deploy-file-contents files: {path,content}[], service, region, project Deploy agent-generated code without local files free (build) + per-request Cloud Run pricing

Стоимость и лимиты

Во что обходится

Квота API
GCP quotas — generous for Cloud Run deploy API
Токенов на вызов
Log responses can be large — paginate or filter aggressively
Деньги
Cloud Run: free tier ~2M req/month, then ~$0.40 per million req + $0.000024 per vCPU-sec
Совет
Set min-instances=0 for non-critical services — cold starts hurt but cost drops to near-zero at idle

Безопасность

Права, секреты, радиус поражения

Минимальные скоупы: roles/run.admin roles/iam.serviceAccountUser
Хранение учётных данных: Application Default Credentials via gcloud auth application-default login — no key files
Исходящий трафик: Calls to *.googleapis.com
Никогда не давайте: roles/owner

Устранение неполадок

Частые ошибки и исправления

Permission denied on deploy

Your account needs roles/run.admin AND roles/iam.serviceAccountUser on the runtime service account. Check via gcloud projects get-iam-policy.

Build failed with 'buildpack not detected'

Add a Dockerfile, or a file that buildpacks recognize (package.json for Node, requirements.txt for Python, etc.).

Service deployed but returns 403

Either allow_unauthenticated wasn't set, or your invoking identity lacks roles/run.invoker. Decide: public or IAM-gated.

SSE MCP connections hang / drop

Increase --timeout=3600 and ensure min-instances=1 to avoid cold start disconnects.

Альтернативы

Google Cloud Run в сравнении

АльтернативаКогда использоватьКомпромисс
Vercel (for Next.js)You're specifically hosting a Next.js appSimpler DX for Next.js; narrower than Cloud Run
AWS App Runner / Lambda MCPYou're on AWSComparable serverless model, different ecosystem
Fly.ioYou want global edge by default and simpler pricingSmaller ecosystem; no official MCP yet

Ещё

Ресурсы

📖 Читать официальный README на GitHub

🐙 Открытые задачи

🔍 Все 400+ MCP-серверов и Skills