home / mcp / gcp mcp server

GCP MCP Server

Model Context Protocol server for Google Cloud Platform services. Provides 16 specialized tools for GCP logging and monitoring with AI assistant integration. Features enterprise-grade security, multi-project support, and comprehensive documentation.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "jayrajgoyal-gcp-mcp": {
      "command": "python3.11",
      "args": [
        "-m",
        "gcp_mcp.cli",
        "--credentials",
        "/path/to/your/credentials.json"
      ],
      "env": {
        "GOOGLE_APPLICATION_CREDENTIALS": "/path/to/your/credentials.json"
      }
    }
  }
}

You run a GCP MCP Server to access Cloud Logging and related GCP services through an MCP interface. It lets you query logs, stream data in real time, detect error patterns, and perform root cause analysis across multiple projects, using secure authentication with a service account.

How to use

Start the MCP server locally and connect your MCP client to it. Use the provided tools to query Cloud Logging, analyze logs for patterns, and investigate errors across your GCP projects. The server supports running with a service account key or Application Default Credentials, so you can integrate it into your existing cloud workflows.

How to install

Prerequisites: you need Python 3.8 or higher. Ensure your GCP project has the necessary APIs enabled and you have a service account with sufficient permissions.

Step 1: Clone the project repository and navigate into it.

git clone https://github.com/JayRajGoyal/gcp-mcp.git
cd gcp-mcp

Step 2: Install dependencies.

pip install -r requirements.txt

Step 3: Run the MCP server with your credentials.

python -m gcp_mcp.cli --credentials /path/to/your/credentials.json

If you prefer running via Claude Code integration, you can add the MCP server configuration to Claude Code so you can start it from the Claude interface.

Configuration and authentication

Authentication supports multiple methods. You can supply a service account key file via the GOOGLE_APPLICATION_CREDENTIALS environment variable, use Application Default Credentials, or authenticate with user credentials using gcloud.

Create a configuration file to set a default project and behavior for log processing. You can customize retention, result limits, and which log names to exclude.

Security

Do not commit service account keys to version control. Use environment variables to configure credentials and follow best practices for securing credentials and access to your GCP resources.

Troubleshooting

If the server fails to start, verify that Python 3.8+ is installed, the credentials file exists at the specified path, and the service account has enough IAM roles (Logging viewer at minimum). Check the chosen project id and API enablement for Cloud Logging and related services.

Notes

The MCP server supports querying Cloud Logging data, real-time log streaming, error pattern detection, multi-project access, and root cause analysis. Planned enhancements include tighter Cloud Monitoring, Error Reporting, and Cloud Trace integrations.

Available tools

log_query

Query GCP Cloud Logging with advanced filters to retrieve relevant log entries for a given project and time range.

log_analysis

Analyze logs to identify patterns, anomalies, and potential issues across services and projects.

investigate_errors

Find and analyze error patterns in logs to aid root cause investigations across your GCP projects.