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.
The server supports the following Google Cloud services:
The server supports two authentication methods:
Set the GOOGLE_APPLICATION_CREDENTIALS
environment variable to your service account key file path:
export GOOGLE_APPLICATION_CREDENTIALS="/path/to/your/keyfile.json"
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.
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
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"
}
}
}
}
Once configured, you can interact with Google Cloud services using natural language 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"
"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"
"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"
"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"
"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"
"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"
If you encounter timeout issues:
debug: true
in your configurationlazyAuth: true
is set to defer authentication until neededIf experiencing authentication problems:
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.
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.
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"
}
}
}
}
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.
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.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.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