@edjl/gcloud-mcp
v1.0.8
Published
Google Cloud Platform tools for MCP (Model Context Protocol)
Maintainers
Readme
GCloud MCP
A comprehensive Model Context Protocol (MCP) server for Google Cloud Platform tools.
Features
This MCP server provides tools for interacting with various GCP services:
Currently Implemented
Kubernetes/GKE
gcloud_clusters_list- List all GKE clustersgcloud_cluster_describe- Get detailed cluster informationgcloud_workloads_list- List deployments, pods, and servicesgcloud_workload_describe- Get details about specific workloadsgcloud_workload_history- View deployment history and rollout statusgcloud_logs_simple- Quick pod logs retrievalgcloud_deployment_logs- Aggregated deployment logsgcloud_workload_logs- Advanced workload logs with kubectl support
Artifact Registry
gcloud_artifacts_repositories_list- List artifact repositoriesgcloud_artifacts_list- List artifacts/images in a repositorygcloud_artifact_versions- List versions of an artifactgcloud_artifact_describe- Get artifact details and metadata
Cloud Storage
gcloud_buckets_list- List all storage bucketsgcloud_bucket_describe- Get bucket configuration detailsgcloud_bucket_objects_list- List objects in a bucketgcloud_bucket_object_read- Read object contentgcloud_bucket_object_metadata- Get object metadata
Cloud Logging
gcloud_logs_read- Read logs with various filtersgcloud_logs_tail- Stream logs in real-timegcloud_logs_query- Execute advanced log queriesgcloud_logs_sinks_list- List log routing destinations
IAM & Security
gcloud_iam_roles_list- List IAM rolesgcloud_iam_policy_get- Get IAM policy for a resourcegcloud_service_accounts_list- List service accountsgcloud_service_account_keys_list- List service account keys
Secrets Manager
gcloud_secrets_list- List secretsgcloud_secret_versions_list- List secret versionsgcloud_secret_get- Get secret value (with security warnings)
Cloud SQL
gcloud_sql_instances_list- List Cloud SQL instancesgcloud_sql_instance_describe- Get instance detailsgcloud_sql_databases_list- List databasesgcloud_sql_backups_list- List backups
Pub/Sub
gcloud_pubsub_topics_list- List topicsgcloud_pubsub_subscriptions_list- List subscriptionsgcloud_pubsub_topic_describe- Get topic details
Prerequisites
gcloud CLI: Must be installed and in your PATH
- Install from: https://cloud.google.com/sdk/docs/install
Authentication: Must be authenticated with gcloud
gcloud auth loginProject: Must have a default project set
gcloud config set project YOUR_PROJECT_IDkubectl: Required for Kubernetes tools
- Usually installed with gcloud:
gcloud components install kubectl
- Usually installed with gcloud:
Installation
- Clone this repository
- Install dependencies:
npm install - Build the project:
npm run build
Configuration
Add the server to your ~/.cursor/mcp.json:
{
"mcpServers": {
"gcloud-mcp": {
"command": "node",
"args": [
"/absolute/path/to/gcloud-mcp/build/index.js"
]
}
}
}Usage Examples
Kubernetes Workloads
Q: When was the last example-app workload deployed in my-cluster?
1. gcloud_clusters_list
2. gcloud_workload_history cluster: "my-cluster", deployment: "example-app"Artifact Registry
Q: What is the latest version of my-service artifact?
1. gcloud_artifacts_repositories_list
2. gcloud_artifact_versions repository: "my-repo", location: "us-central1", package: "my-service"Cloud Logging
Q: What are the latest error logs from example-app in my-cluster?
gcloud_logs_read resource: "k8s_container", severity: "ERROR", filter: "resource.labels.container_name='example-app' AND resource.labels.cluster_name='my-cluster'"Cloud Storage
Q: List all objects in my-data-bucket
gcloud_bucket_objects_list bucket: "my-data-bucket", recursive: trueError Handling
All tools include comprehensive error handling:
- Not Installed: Clear message if gcloud CLI is not found
- Not Authenticated: Instructions to run
gcloud auth login - No Project: Instructions to set a project
- Permission Errors: Clear messages about required permissions
- Resource Not Found: Helpful error messages with suggestions
Tool Parameters
Most tools support these common parameters:
project: Override the default projectlimit: Control the number of resultsfilter: Apply filters to results
Kubernetes tools require:
cluster: Name of the GKE clusterzoneorregion: Cluster location
Development
Adding New Tools
- Create a new file in
src/tools/<category>/<tool-name>.ts - Implement the
ToolDefinitioninterface - Export as default
- The tool will be automatically loaded with the
gcloud_prefix
Tool Structure
import { z } from 'zod';
import { ToolDefinition } from '../../types.js';
import { executeGCloudCommand } from '../../utils/gcloud.js';
const inputSchema = z.object({
// Define parameters
});
const gcloudToolNameTool: ToolDefinition = {
name: 'tool_name',
description: 'Tool description',
category: 'category',
subcategory: 'subcategory',
version: '1.0.0',
inputSchema,
handler: async (input) => {
// Implementation
}
};
export default gcloudToolNameTool;Roadmap
See ROADMAP.md for planned features including:
- IAM & Security tools
- Secrets Manager integration
- Cloud Run support
- Compute Engine management
- And many more GCP services
License
MIT
