Skip to main content
Glama

GCP MCP Server

NPM Version License TypeScript MCP

A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact seamlessly with your Google Cloud Platform environment. Built with TypeScript and featuring 25+ tools across 8 major GCP service categories.

✨ Key Features

  • πŸ€– AI-Native: Natural language interface for all GCP operations

  • πŸ” Secure: Uses your existing GCP credentials (no external access required)

  • 🌐 Multi-Project: Seamlessly work across multiple GCP projects and regions

  • ⚑ Comprehensive: 25 tools covering compute, storage, databases, serverless, and more

  • πŸ› οΈ Developer-Friendly: Full TypeScript implementation with excellent error handling

  • πŸ”„ Reliable: Built-in retry logic and robust error handling

  • πŸ“Š Observable: Comprehensive logging for debugging and monitoring

Related MCP server: GCP Billing and Monitoring MCP Server

πŸš€ Quick Start

Prerequisites

  • Node.js v18 or higher

  • Google Cloud SDK configured with authentication

  • Claude Desktop, Cursor, Windsurf, or any MCP-compatible AI assistant

Installation & Setup

  1. Authenticate with GCP:

    gcloud auth application-default login
  2. Install via NPX (recommended):

    npx gcp-mcp-server
  3. Configure your AI assistant:

    Claude Desktop - Add to claude_desktop_config.json:

    {
      "mcpServers": {
        "gcp": {
          "command": "npx",
          "args": ["-y", "gcp-mcp-server"]
        }
      }
    }

    Cursor - Add to MCP settings:

    {
      "gcp": {
        "command": "npx",
        "args": ["-y", "gcp-mcp-server"]
      }
    }

    Windsurf - Add to ~/.windsurf/config.json:

    {
      "mcpServers": {
        "gcp": {
          "command": "npx",
          "args": ["-y", "gcp-mcp-server"]
      }
    }
  4. Restart your AI assistant and start chatting with your GCP environment!

πŸ› οΈ Available Tools (25 Total)

πŸ”§ Core Management (5 tools)

Tool

Description

run-gcp-code

Execute custom TypeScript code against GCP APIs

list-projects

List all accessible GCP projects

select-project

Select a project for subsequent operations

get-billing-info

Get billing information and status

get-cost-forecast

Get cost forecasting data

οΏ½ Compute Engine (4 tools)

Tool

Description

list-compute-instances

List VM instances (by zone or all zones)

get-compute-instance

Get detailed instance information

start-compute-instance

Start a stopped instance

stop-compute-instance

Stop a running instance

πŸ—„οΈ Cloud Storage (3 tools)

Tool

Description

list-storage-buckets

List all storage buckets

list-storage-objects

List objects in a specific bucket

get-storage-object-info

Get metadata for specific objects

πŸ“Š BigQuery (3 tools)

Tool

Description

list-bigquery-datasets

List all BigQuery datasets

list-bigquery-tables

List tables in a dataset

query-bigquery

Execute SQL queries on BigQuery

πŸ—ƒοΈ Cloud SQL (2 tools)

Tool

Description

list-sql-instances

List all Cloud SQL instances

get-sql-instance

Get detailed instance information

⚑ Cloud Functions (2 tools)

Tool

Description

list-cloud-functions

List all Cloud Functions

get-cloud-function

Get detailed function information

πŸƒ Cloud Run (2 tools)

Tool

Description

list-cloud-run-services

List all Cloud Run services

get-cloud-run-service

Get detailed service information

🚒 Google Kubernetes Engine (2 tools)

Tool

Description

list-gke-clusters

List all GKE clusters

get-gke-cluster

Get detailed cluster information

πŸ“ Cloud Logging (2 tools)

Tool

Description

query-logs

Query Cloud Logging with filters

list-log-entries

List recent log entries

πŸ’‘ Example Conversations

Getting Started

User: "Show me all my GCP projects"
Assistant: [Lists all accessible projects with IDs and names]

User: "Use project my-web-app-prod"
Assistant: [Selects project and shows available regions]

Infrastructure Management

User: "List all running compute instances in us-west1"
Assistant: [Shows VM instances with status, machine type, and IPs]

User: "What storage buckets do I have?"
Assistant: [Lists buckets with size, location, and storage class]

User: "Show me my Cloud Run services"
Assistant: [Displays services with URLs, traffic allocation, and status]

Data & Analytics

User: "What BigQuery datasets are in my project?"
Assistant: [Lists datasets with creation time and location]

User: "Query my sales table for last month's revenue"
Assistant: [Executes SQL and returns results]

Cost Management

User: "What's my current billing status?"
Assistant: [Shows billing account, budget alerts, and current usage]

User: "Forecast my costs for the next 3 months"
Assistant: [Displays cost predictions based on usage trends]

Troubleshooting

User: "Show me error logs from my app in the last hour"
Assistant: [Queries Cloud Logging and displays relevant errors]

User: "Why is my Cloud Function timing out?"
Assistant: [Analyzes function configuration and recent logs]

πŸ—οΈ Architecture

The server is built with a clean, modular architecture:

src/
β”œβ”€β”€ types/           # TypeScript type definitions
β”œβ”€β”€ utils/           # Utilities (logging, errors, state management)
β”œβ”€β”€ tools/           # Tool definitions and handlers
β”‚   β”œβ”€β”€ definitions.ts
β”‚   └── handlers.ts
β”œβ”€β”€ config.ts        # Configuration constants
β”œβ”€β”€ server.ts        # MCP server implementation
└── index.ts         # Application entry point

πŸ”§ Development

Local Development Setup

# Clone the repository
git clone https://github.com/startupmanch/gcp-mcp-server
cd gcp-mcp-server

# Install dependencies
npm install

# Build the project
npm run build

# Run in development mode
npm run dev

Available Scripts

npm run dev          # Development mode with auto-reload
npm run build        # Production build
npm run start        # Start built server
npm run test         # Run test suite
npm run lint         # Lint code
npm run format       # Format code with Prettier
npm run clean        # Clean build artifacts

Testing with MCP Inspector

# Build and test with MCP Inspector
npm run build
npx @modelcontextprotocol/inspector ./bin.js

πŸ“‹ Requirements

  • Node.js: Version 18 or higher

  • Google Cloud SDK: Properly configured and authenticated

  • GCP Projects: Access to at least one GCP project with appropriate IAM permissions

Required GCP APIs

The following APIs should be enabled in your GCP project:

  • Cloud Resource Manager API

  • Compute Engine API

  • Cloud Storage API

  • BigQuery API

  • Cloud SQL Admin API

  • Cloud Functions API

  • Cloud Run API

  • Cloud Logging API

  • Cloud Billing API

  • Kubernetes Engine API

οΏ½ Security & Permissions

Required IAM Roles

Your GCP account needs the following roles (or equivalent custom roles):

  • roles/viewer (basic read access)

  • roles/compute.viewer (Compute Engine resources)

  • roles/storage.objectViewer (Cloud Storage)

  • roles/bigquery.user (BigQuery)

  • roles/cloudsql.viewer (Cloud SQL)

  • roles/cloudfunctions.viewer (Cloud Functions)

  • roles/run.viewer (Cloud Run)

  • roles/container.viewer (GKE)

  • roles/logging.viewer (Cloud Logging)

Security Features

  • Local Credentials: Uses your local GCP authentication

  • No External Access: All operations run locally

  • Principle of Least Privilege: Only requests necessary permissions

  • Secure by Default: No credentials stored or transmitted

πŸ› Troubleshooting

Common Issues

Authentication Errors

# Re-authenticate with GCP
gcloud auth application-default login

# Verify access
gcloud projects list

Permission Denied

  • Verify your IAM roles include the required permissions

  • Check that APIs are enabled in your GCP project

Server Not Starting

  • Ensure Node.js v18+ is installed

  • Verify GCP credentials are configured

  • Check the server logs for specific errors

Debug Mode

Enable debug logging:

export LOG_LEVEL=debug
npx gcp-mcp-server

🀝 Contributing

We welcome contributions! Here's how to get started:

  1. Fork the repository

  2. Create a feature branch: git checkout -b feature/amazing-feature

  3. Make your changes and add tests

  4. Run the test suite: npm test

  5. Commit your changes: git commit -m 'Add amazing feature'

  6. Push to the branch: git push origin feature/amazing-feature

  7. Open a Pull Request

Development Guidelines

  • Follow TypeScript best practices

  • Add tests for new functionality

  • Update documentation for new features

  • Follow conventional commit messages

  • Ensure all tests pass before submitting

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments


Made with ❀️ for the AI and Cloud communities

For support, feature requests, or bug reports, please open an issue on GitHub.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      Enables AI assistants to interact with and manage Google Cloud Platform resources including Compute Engine, Cloud Run, Storage, BigQuery, and other GCP services through a standardized MCP interface.
      1
      6
      MIT
    • A
      license
      C
      quality
      D
      maintenance
      Enables interaction with Google Cloud services including billing cost analysis, log querying, and metrics monitoring through natural language commands. Provides comprehensive tools for managing GCP resources, analyzing costs, detecting anomalies, and retrieving operational insights.
      40
      1
      Apache 2.0
    • 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
    • A
      license
      B
      quality
      Not graded
      maintenance
      Enables AI assistants to interact with and manage Google Cloud Platform resources including Artifact Registry, BigQuery, Cloud Build, Compute Engine, Cloud Run, Cloud Storage, and monitoring services through a standardized MCP interface.
      1
      MIT