Skip to main content
Glama
Google Cloud MCP Server

Google Cloud MCP Server

by krzko

Google Cloud MCP 服务器

连接到 Google Cloud 服务的模型上下文协议服务器,用于提供与 Google Cloud 资源交互的上下文和工具。

服务

支持的服务:

  • [x] 谷歌云日志

  • [x] 谷歌云监控

  • [x] 谷歌云扳手

正在开发中的服务器:

  • [ ] 谷歌云追踪

  • [ ] Google IAM

  • [ ] 谷歌云计算

  • [ ] 谷歌云运行

  • [ ] 谷歌云存储

谷歌云日志

查询和过滤来自 Google Cloud Logging 的日志条目:

  • 使用自定义过滤器查询日志

  • 搜索特定时间范围内的日志

  • 以可读格式格式化并显示日志条目

谷歌云扳手

与 Google Cloud Spanner 数据库交互:

  • 对 Spanner 数据库执行 SQL 查询

  • 列出可用的数据库和表

  • 探索数据库架构

谷歌云监控

从 Google Cloud Monitoring 检索并分析指标:

  • 使用自定义过滤器查询指标

  • 随时间变化的指标数据可视化

  • 列出可用的指标类型

谷歌云追踪

分析来自 Google Cloud Trace 的分布式跟踪:

  • 通过 ID 检索跟踪

  • 使用过滤选项列出最近的跟踪

  • 查找与日志相关的痕迹

  • 识别失败的痕迹

  • 使用自然语言查询跟踪(例如,“显示过去一小时的失败跟踪”)

Related MCP server: BigQuery MCP Server

验证

该服务器支持两种 Google Cloud 身份验证方法:

  1. 服务帐号密钥文件(推荐):将GOOGLE_APPLICATION_CREDENTIALS环境变量设置为服务帐号密钥文件的路径。这是标准的 Google Cloud 身份验证方法。

  2. 环境变量:直接设置GOOGLE_CLIENT_EMAIL和GOOGLE_PRIVATE_KEY环境变量。这对于无法存储密钥文件的环境非常有用。

如果设置了,服务器还将使用GOOGLE_CLOUD_PROJECT环境变量,否则它将尝试从身份验证凭据中确定项目 ID。

安装

# Clone the repository
git clone https://github.com/krzko/google-cloud-mcp.git
cd google-cloud-mcp

# Install dependencies
pnpm install

# Build
pnpm build

向 Google Cloud 进行身份验证:

gcloud auth application-default login

在您的客户端中配置mcpServers :

{
  "mcpServers": {
      "google-cloud-mcp": {
          "command": "node",
          "args": [
              "/Users/foo/code/google-cloud-mcp/dist/index.js"
          ],
          "env": {
              "GOOGLE_APPLICATION_CREDENTIALS": "/Users/foo/.config/gcloud/application_default_credentials.json"
          }
      }
  }
}

发展

启动服务器

# Build the project
pnpm build

# Start the server
pnpm start

开发模式

# Build the project
pnpm build

# Start the server and inspector
npx -y @modelcontextprotocol/inspector node dist/index.js

与 Smithery 一起使用(很快)

此服务器可与 Smithery 一起部署和使用。服务器实现了身份验证的延迟加载,这意味着它将立即启动并推迟身份验证,直到实际需要时才进行。操作仍然需要身份验证,但这种方法可以防止服务器初始化期间出现超时。

注意:Smithery 本地服务器支持目前正在开发中,可能尚不可用。

故障排除

服务器超时问题

如果在使用 Smithery 运行服务器时遇到超时问题,请尝试以下操作:

  1. 通过在配置中设置debug: true来启用调试日志记录

  2. 确保将lazyAuth: true设置为推迟身份验证,直到真正需要时才进行

  3. 确保您的凭证文件可访问且有效

  4. 检查日志中是否有任何错误消息

重要提示:操作仍然需要身份验证,但启用延迟加载后,服务器将立即启动并在需要时进行身份验证,而不是在初始化期间。

身份验证问题

服务器支持两种身份验证方法:

  1. 服务帐户密钥文件:将GOOGLE_APPLICATION_CREDENTIALS环境变量设置为服务帐户密钥文件的路径

  2. 环境变量:设置GOOGLE_CLIENT_EMAIL和GOOGLE_PRIVATE_KEY环境变量

如果您遇到身份验证问题,请确保:

  • 您的服务帐号具有必要的权限

  • 密钥文件格式正确且可访问

  • 环境变量设置正确

Available Tools

40 tools
gcp-billing-analyse-costsAnalyse Billing CostsC

Perform detailed cost analysis with trends and insights for Google Cloud billing data

Inputs: billingAccountName (required), startDate (required), endDate (required), projectId, +2 more.

gcp-billing-cost-recommendationsGenerate Cost RecommendationsB

Generate cost optimisation recommendations with potential savings for Google Cloud billing

Inputs: billingAccountName (required), projectId, minSavingsAmount, priority.

gcp-billing-detect-anomaliesDetect Cost AnomaliesC

Detect unusual cost patterns and spending anomalies in Google Cloud billing data

Inputs: billingAccountName (required), lookbackDays, thresholdPercentage, projectId.

gcp-billing-get-account-detailsGet Billing Account DetailsA

Retrieve detailed information about a specific Google Cloud billing account

Inputs: billingAccountName (required).

gcp-billing-get-project-infoGet Project Billing InformationA

Retrieve billing configuration and status for a Google Cloud project

Inputs: projectId.

gcp-billing-list-accountsList Billing AccountsA

List all Google Cloud billing accounts accessible to the user

Inputs: pageSize, pageToken, filter.

gcp-billing-list-projectsList Billing Account ProjectsA

List all projects associated with a specific Google Cloud billing account

Inputs: billingAccountName (required), pageSize, pageToken.

gcp-billing-list-servicesList Google Cloud ServicesB

List all available Google Cloud services for billing and cost analysis

Inputs: pageSize, pageToken.

gcp-billing-list-skusList Service SKUsB

List all SKUs (Stock Keeping Units) and pricing information for a Google Cloud service

Inputs: serviceId (required), pageSize, pageToken, currencyCode.

gcp-billing-service-breakdownGet Service Cost BreakdownC

Get detailed cost breakdown by Google Cloud service with usage and SKU information

Inputs: billingAccountName (required), projectId, timeRange.

gcp-error-reporting-get-group-detailsD

Inputs: no named parameters.

gcp-error-reporting-list-groupsD

Inputs: no named parameters.

gcp-iam-analyse-permission-gapsAnalyse Permission GapsC

Compare current permissions against required permissions for specific operations and identify gaps

Inputs: requiredPermissions (required), project, operationDescription.

gcp-iam-get-project-policyGet Project IAM PolicyB

Retrieve the IAM policy for a Google Cloud project

Inputs: project, requestedPolicyVersion.

gcp-iam-list-deployment-servicesList Available Deployment ServicesB

List all GCP services with pre-defined deployment permission sets

Inputs: no named parameters.

gcp-iam-test-project-permissionsTest Project IAM PermissionsA

Test which permissions the current caller has on a Google Cloud project

Inputs: permissions (required), project.

gcp-iam-test-resource-permissionsTest Resource-Specific IAM PermissionsA

Test which permissions the current caller has on specific Google Cloud resources

Inputs: resource (required), permissions (required).

gcp-iam-validate-deployment-permissionsValidate Deployment PermissionsA

Check if current caller has required permissions for deploying to common GCP services

Inputs: service (required), project, includeOptional.

gcp-logging-query-logsQuery LogsB

Query Google Cloud Logs with custom filters. Searches across all payload types (text, JSON, proto) and metadata fields.

Inputs: filter (required), limit.

gcp-logging-query-time-rangeQuery Logs by Time RangeA

Query Google Cloud Logs within a specific time range. Supports relative times (1h, 2d) and ISO timestamps.

Inputs: startTime (required), endTime, filter, limit.

gcp-logging-search-comprehensiveComprehensive Log SearchC

Search across all log fields including textPayload, jsonPayload, protoPayload, labels, HTTP requests, and metadata. Provides maximum context.

Inputs: searchTerm (required), timeRange, severity, resource, +1 more.

gcp-monitoring-list-metric-typesD

Inputs: filter, pageSize, timeout.

gcp-monitoring-query-metricsD

Inputs: filter (required), startTime (required), endTime, alignmentPeriod.

gcp-monitoring-query-natural-languageD

Inputs: query (required), startTime, endTime, alignmentPeriod.

gcp-profiler-analyse-performanceD

Inputs: no named parameters.

gcp-profiler-list-profilesD

Inputs: no named parameters.

gcp-spanner-execute-queryD

Inputs: sql (required), instanceId, databaseId, params.

gcp-spanner-list-databasesD

Inputs: instanceId (required).

gcp-spanner-list-instancesD

Inputs: _dummy.

gcp-spanner-list-tablesD

Inputs: instanceId, databaseId.

gcp-spanner-query-countD

Inputs: instanceId, databaseId, queryType, status, +3 more.

gcp-spanner-query-natural-languageD

Inputs: query (required), instanceId, databaseId.

gcp-trace-find-from-logsD

Inputs: filter (required), projectId, limit.

gcp-trace-get-traceD

Inputs: traceId (required), projectId.

gcp-trace-list-tracesD

Inputs: projectId, filter, limit, startTime.

gcp-trace-query-natural-languageD

Inputs: query (required), projectId.

gcp-utils-get-project-idGet Project IDA

Get the current Google Cloud project ID and recent project history

Inputs: no named parameters.

gcp-utils-set-project-idSet Project IDB

Set the default Google Cloud project ID to use for all operations

Inputs: project_id (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    C2.2/5.0

    Scored across 40 tools

    Disambiguation3/5

    Tools are separated by service prefix, but within services like logging and Spanner, multiple tools for querying logs or databases overlap in purpose. Additionally, many tools lack descriptions, increasing ambiguity.

    Naming Consistency5/5

    All tools follow a consistent pattern: 'gcp-{service}-{action}-{noun}' in snake_case. For example, gcp-billing-list-accounts, gcp-iam-get-project-policy. No mixing of styles.

    Tool Count3/5

    40 tools is high but not extreme for a multi-service server. However, several services have only 3 tools with missing descriptions, suggesting the count is inflated without full coverage.

    Completeness2/5

    Many services have significant gaps: error reporting, monitoring, profiler, and trace lack CRUD operations and detailed descriptions. Spanner is missing update/delete. Billing and logging are more complete, but overall surface is incomplete.

    Maintenance

    ActivityInactive
    ResponsivenessLimited data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      A Model Context Protocol server that enables AI assistants like Claude to interact with Google Cloud Platform environments through natural language, allowing users to query and manage GCP resources during conversations.
      9
      171 npm
      199
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      A Model Context Protocol server that connects to Google Cloud services, allowing users to query logs, interact with Spanner databases, and analyze monitoring metrics through natural language.
      MIT