Google Cloud MCP server

Integrates with Google Cloud services to provide direct access to Logging, Spanner, and Monitoring resources within conversations through authenticated connections.
Back to servers
Setup instructions
Provider
Kristof Kowalski
Release date
Mar 18, 2025
Language
TypeScript
Package
Stats
3.4K downloads
53 stars

The Google Cloud MCP server is a Model Context Protocol implementation that connects to Google Cloud services, allowing you to interact with your cloud resources through natural language. It provides context and tools for various Google Cloud services including Billing, Error Reporting, IAM, Logging, Monitoring, Profiler, Spanner, and Trace.

Supported Services

The server supports the following Google Cloud services:

  • Billing for cost management and analysis
  • Error Reporting for application error monitoring
  • Identity and Access Management (IAM) for permission management
  • Logging for log queries and analysis
  • Monitoring for metrics retrieval
  • Profiler for application performance analysis
  • Spanner for database interactions
  • Trace for distributed tracing analysis

Authentication

The server supports two authentication methods:

Service Account Key File (Recommended)

Set the GOOGLE_APPLICATION_CREDENTIALS environment variable to your service account key file path:

export GOOGLE_APPLICATION_CREDENTIALS="/path/to/your/keyfile.json"

Environment Variables

Alternatively, set these environment variables directly:

export GOOGLE_CLIENT_EMAIL="[email protected]"
export GOOGLE_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n"

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

Installation

Follow these steps to install the Google Cloud MCP server:

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

# Install dependencies
pnpm install

# Build
pnpm build

Authenticate to Google Cloud:

gcloud auth application-default login

Configuration

Configure the MCP server in your client's configuration file:

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

Usage Examples

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

Billing Queries

"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"

Error Reporting Queries

"Show me error groups from project my-webapp-prod-789 for the last hour"
"Get details for error group projects/my-app-123/groups/xyz789"
"Analyse error trends for service my-api in project analytics-prod-456"

IAM Queries

"Get IAM policy for project my-webapp-prod-123"
"Test if I have storage.buckets.create permission on project data-lake-456"
"Check deployment permissions for Cloud Run in project microservices-789"

Logging Queries

"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"

Spanner Queries

"List all databases in Spanner instance my-instance in project ecommerce-prod-123"
"Execute SQL: SELECT COUNT(*) FROM users in database user-db in project my-app-456"
"Show me table structure for orders in database inventory-db in project retail-789"

Monitoring Queries

"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"

Troubleshooting

Server Timeout Issues

If you encounter timeout issues:

  1. Enable debug logging by setting debug: true in your configuration
  2. Ensure lazyAuth: true is set to defer authentication until needed
  3. Verify your credentials file is accessible and valid
  4. Check logs for error messages

Authentication Issues

If experiencing authentication problems:

  • Verify your service account has the necessary permissions
  • Ensure the key file is properly formatted and accessible
  • Check that environment variables are correctly set

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "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"}}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "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"
            }
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "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"
            }
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later