Skip to main content
Glama
GCP Billing and Monitoring MCP Server

GCP Billing and Monitoring MCP Server

by RadiumGu

GCP Billing and Monitoring MCP Server

A Model Context Protocol server that connects to Google Cloud services to provide context and tools for interacting with your Google Cloud resources.

Services

Supported Google Cloud services:

Billing

Manage and analyse Google Cloud billing with cost optimisation insights:

Tools: gcp-billing-list-accounts, gcp-billing-get-account-details, gcp-billing-list-projects, gcp-billing-get-project-info, gcp-billing-list-services, gcp-billing-list-skus, gcp-billing-analyse-costs, gcp-billing-detect-anomalies, gcp-billing-cost-recommendations, gcp-billing-service-breakdown

Example prompts:

  • "Show me all my billing accounts"

  • "Analyse costs for project my-app-prod-123 for the last 30 days"

  • "Generate cost recommendations for billing account billingAccounts/123456-789ABC-DEF012"

  • "Check for billing anomalies in project my-ecommerce-456"

Logging

Query and filter log entries from Google Cloud Logging:

Tools: gcp-logging-query-logs, gcp-logging-query-time-range, gcp-logging-search-comprehensive

Example prompts:

  • "Show me logs from project my-app-prod-123 from the last hour with severity ERROR"

  • "Search for logs containing 'timeout' from service my-api in project backend-456"

  • "Query logs for resource type gce_instance in project compute-prod-789"

Monitoring

Retrieve and analyse metrics from Google Cloud Monitoring:

Tools: gcp-monitoring-query-metrics, gcp-monitoring-list-metric-types, gcp-monitoring-query-natural-language

Example prompts:

  • "Show me CPU utilisation metrics for project web-app-prod-123 for the last 6 hours"

  • "List available metric types for Compute Engine in project infrastructure-456"

  • "Query memory usage for instances in project backend-services-789"

Related MCP server: GCP MCP

Quick Start

Once configured, you can interact with Google Cloud services using natural language:

"What are my current billing costs for project my-webapp-prod-123?"
"Find logs containing 'database timeout' from project backend-prod-321 yesterday"
"What's the CPU usage of Compute Engine instances in project infrastructure-987?"

Authentication

This server supports two methods of authentication with Google Cloud:

  1. Service Account Key File (Recommended): Set the GOOGLE_APPLICATION_CREDENTIALS environment variable to the path of your service account key file. This is the standard Google Cloud authentication method.

  2. Environment Variables: Set GOOGLE_CLIENT_EMAIL and GOOGLE_PRIVATE_KEY environment variables directly. This is useful for environments where storing a key file is not practical.

The server will also use the GOOGLE_CLOUD_PROJECT environment variable if set, otherwise it will attempt to determine the project ID from the authentication credentials.

Installation

# Clone the repository
git clone https://github.com/RadiumGu/gcp-billing-and-monitoring-mcp.git
cd gcp-billing-and-monitoring-mcp

# Install dependencies
pnpm install

# Build
pnpm build

Authenticate to Google Cloud:

gcloud auth application-default login

Configure the mcpServers in your client:

{
  "mcpServers": {
      "gcp-billing-and-monitoring-mcp": {
          "command": "node",
          "args": [
              "/path/to/gcp-billing-and-monitoring-mcp/dist/index.js"
          ],
          "env": {
              "GOOGLE_APPLICATION_CREDENTIALS": "/path/to/your/service-account-key.json"
          }
      }
  }
}

Development

Starting the server

# Build the project
pnpm build

# Start the server
pnpm start

Development mode

# Build the project
pnpm build

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

Troubleshooting

Server Timeout Issues

If you encounter timeout issues when running the server with Smithery, try the following:

  1. Enable debug logging by setting debug: true in your configuration

  2. Ensure lazyAuth: true is set to defer authentication until it's actually needed

  3. Ensure your credentials file is accessible and valid

  4. Check the logs for any error messages

Important: Authentication is still required for operation, but with lazy loading enabled, the server will start immediately and authenticate when needed rather than during initialization.

Authentication Issues

The server supports two methods of authentication:

  1. Service Account Key File: Set GOOGLE_APPLICATION_CREDENTIALS environment variable to the path of your service account key file

  2. Environment Variables: Set GOOGLE_CLIENT_EMAIL and GOOGLE_PRIVATE_KEY environment variables

If you're having authentication issues, make sure:

  • Your service account has the necessary permissions

  • The key file is properly formatted and accessible

  • Environment variables are correctly set

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.1/5.0

    Scored across 40 tools

    Disambiguation3/5

    Tools are grouped by GCP service domains (billing, IAM, logging, monitoring, profiler, Spanner, trace, utils), which reduces ambiguity within each group, but there is overlap across groups. For example, multiple tools handle queries (gcp-logging-query-logs, gcp-monitoring-query-metrics, gcp-spanner-execute-query) without clear boundaries in their descriptions, and some tools like gcp-billing-analyse-costs and gcp-billing-service-breakdown could be confused for similar purposes. The domain grouping helps, but the sheer number of tools creates potential for misselection.

    Naming Consistency4/5

    Tool names follow a consistent pattern of gcp-<service>-<action>-<target> with hyphens, making them predictable and readable. Minor deviations exist, such as gcp-utils-get-project-id using 'utils' instead of a service name and some names being more verbose (e.g., gcp-billing-detect-anomalies vs. gcp-trace-get-trace), but overall the naming is highly consistent across the set.

    Tool Count2/5

    With 40 tools, the count is excessive for a single server, even given the broad scope of GCP billing and monitoring. This feels heavy and unwieldy, likely overwhelming for agents and users. A more focused approach with fewer, more generalized tools or splitting into multiple servers would be more appropriate, as the current scope spans multiple distinct domains beyond just billing and monitoring.

    Completeness3/5

    The server covers multiple GCP domains (billing, IAM, logging, monitoring, profiler, Spanner, trace, utils) with basic CRUD-like operations, but there are notable gaps. For example, in billing, tools exist for analysis and listing, but update or delete operations are missing; in monitoring and profiler, many tools lack descriptions, making it hard to assess coverage. The inclusion of unrelated services like Spanner suggests scope creep rather than a complete surface for the stated purpose.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to interact with Google Cloud Platform services for log analysis and root cause investigation. Provides tools to query Cloud Logging, detect error patterns, and perform real-time log streaming across multiple GCP projects.
      MIT
    • A
      license
      C
      quality
      D
      maintenance
      Enables AI assistants to interact with Google Cloud Platform resources through natural language queries. Supports querying and managing GCP services like Compute Engine, Cloud Storage, BigQuery, and more across multiple projects and regions.
      9
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables cost optimization and financial operations for Google BigQuery through natural language interactions. Provides insights into BigQuery spending, usage patterns, and cost management recommendations.
      -
    • A
      license
      B
      quality
      D
      maintenance
      Enables interaction with Google Cloud Platform services through gcloud CLI, supporting operations like querying logs, checking Cloud Run status, managing secrets, executing Cloud SQL queries, and monitoring billing information.
      11
      23 npm
      1
      MIT