Google Cloud Logging MCP Server

Local setup required. This server has to be cloned and prepared on your machine before you register it in Claude Code.
1

Set the server up locally

Run this once to clone and prepare the server before adding it to Claude Code.

Run in terminal
bun install
bun run start
2

Register it in Claude Code

After the local setup is done, run this command to point Claude Code at the built server.

Run in terminal
claude mcp add -e "GOOGLE_CLOUD_PROJECT=${GOOGLE_CLOUD_PROJECT}" google-cloud-logging -- bun run "<FULL_PATH_TO_CLOUD_LOGGING_MCP>/dist/index.js"

Replace <FULL_PATH_TO_CLOUD_LOGGING_MCP>/dist/index.js with the actual folder you prepared in step 1.

Required:GOOGLE_CLOUD_PROJECT+ 1 optional
README.md

Query, search, and analyze logs across Google Cloud Platform projects.

Google Cloud Logging MCP Server

A Model Context Protocol (MCP) server that provides access to Google Cloud Logging. This server allows AI assistants to query, search, and analyze logs from Google Cloud Platform projects.

Features

  • Query Logs: Search and filter logs across GCP projects
  • Get Log Details: Retrieve detailed information about specific log entries
  • List Projects: List available GCP projects

Getting Started

Prerequisites

  • Bun runtime
  • Google Cloud credentials configured
  • Access to Google Cloud Logging API

Quick Start

  1. Install dependencies:

    bun install
    
  2. Set up Google Cloud credentials:

    # Option 1: Use gcloud CLI
    gcloud auth application-default login
    
    # Option 2: Use service account
    export GOOGLE_APPLICATION_CREDENTIALS="/path/to/service-account.json"
    
  3. Set your project ID:

    export GOOGLE_CLOUD_PROJECT="your-project-id"
    
  4. Run the server:

    bun run start
    

Using with Claude Desktop

Add the following to your Claude Desktop configuration file:

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

{
  "mcpServers": {
    "cloud-logging": {
      "command": "bun",
      "args": ["run", "/path/to/cloud-logging-mcp/src/main.ts"],
      "env": {
        "GOOGLE_CLOUD_PROJECT": "your-project-id"
      }
    }
  }
}

Example Tool Usage

Query Logs

Search and filter logs from Google Cloud Logging.

{
  "tool": "queryLogs",
  "input": {
    "projectId": "my-project",
    "filter": "resource.type=\"cloud_run_revision\" AND severity>=ERROR",
    "orderBy": {
      "timestamp": "desc"
    },
    "pageSize": 50
  }
}

Parameters:

  • projectId: GCP project ID
  • filter: Log filter query (follows GCP logging query syntax)
  • orderBy: Sort order for results
  • pageSize: Number of results per page
  • pageToken: Token for pagination
  • resourceNames: Specific log resources to query
  • summaryFields: Fields to include in the summary

Get Log Detail

Retrieve complete details for a specific log entry.

{
  "tool": "getLogDetail",
  "input": {
    "projectId": "my-project",
    "logId": "65f5a7b60000000001234567"
  }
}

Parameters:

  • projectId: GCP project ID
  • logId: The unique identifier of the log entry

List Projects

List all accessible Google Cloud projects.

{
  "tool": "listProjects",
  "input": {}
}

Parameters: None

Common Filter Examples

  • By severity: severity>=ERROR
  • By time range: timestamp>="2024-01-01T00:00:00Z"
  • By resource: resource.type="cloud_run_revision"
  • By text search: textPayload:"connection timeout"
  • Combined: resource.type="k8s_container" AND severity=ERROR AND timestamp>="2024-01-01T00:00:00Z"

Troubleshooting

  1. Authentication errors: Ensure your Google Cloud credentials are properly configured
  2. Permission errors: Check that your account has the logging.logEntries.list permission
  3. No results: Verify your filter syntax and that logs exist for your query

Development

# Run tests
bun test

# Type checking
bun run typecheck

# Linting
bun run lint

# Format code
bun run format

Architecture

The server follows a clean architecture pattern:

  • /adapter: External service integrations (Google Cloud APIs)
  • /domain: Core business logic and data models
  • /port: Interface definitions and MCP tool handlers
  • /util: Utility functions and helpers

License

MIT

Tools (3)

queryLogsSearch and filter logs from Google Cloud Logging.
getLogDetailRetrieve complete details for a specific log entry.
listProjectsList all accessible Google Cloud projects.

Environment Variables

GOOGLE_APPLICATION_CREDENTIALSPath to the service account JSON key file
GOOGLE_CLOUD_PROJECTrequiredThe default Google Cloud project ID

Configuration

claude_desktop_config.json
{"mcpServers": {"cloud-logging": {"command": "bun", "args": ["run", "/path/to/cloud-logging-mcp/src/main.ts"], "env": {"GOOGLE_CLOUD_PROJECT": "your-project-id"}}}}

Try it

List all my available Google Cloud projects.
Find all error logs from the cloud_run_revision resource in my project.
Show me the details for log entry 65f5a7b60000000001234567.
Search for logs containing 'connection timeout' from the last 24 hours.

Frequently Asked Questions

What are the key features of Google Cloud Logging?

Query and filter logs across GCP projects. Retrieve detailed information about specific log entries. List all accessible Google Cloud projects. Support for advanced GCP logging query syntax.

What can I use Google Cloud Logging for?

Debugging production issues by searching for specific error patterns in Cloud Run logs.. Auditing system events by filtering logs based on timestamps and resource types.. Quickly retrieving full metadata for a specific log entry identified during an incident.. Managing log visibility across multiple GCP projects from a single AI interface..

How do I install Google Cloud Logging?

Install Google Cloud Logging by running: bun install && bun run start

What MCP clients work with Google Cloud Logging?

Google Cloud Logging works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep Google Cloud Logging docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare