gcp-mcp-server
Provides tools for managing Google Cloud Platform resources including projects, Compute Engine instances, Cloud Storage buckets and objects, BigQuery datasets and queries, Pub/Sub topics and subscriptions, and Cloud Logging logs.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@gcp-mcp-servershow me my running instances in us-east1"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
gcp-mcp-server
Model Context Protocol server for Google Cloud Platform. Built on the MCP
Python SDK (mcp>=1.27) using FastMCP, with tools that touch Resource
Manager, Compute Engine, Cloud Storage, BigQuery, Pub/Sub, and Cloud Logging.
Features
Application Default Credentials (ADC) or explicit service-account JSON auth
Lazy-constructed Google Cloud SDK clients bound to resolved credentials
Blocking SDK calls executed in worker threads via
anyio.to_thread.run_syncTyped tools covering the most common GCP day-to-day operations
Unit tests that mock the SDK clients end-to-end (no real API calls)
Install
git clone https://github.com/asklokesh/gcp-mcp-server.git
cd gcp-mcp-server
python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"Requires Python 3.10 or newer.
Authentication
The server resolves credentials in the following order:
If
GCP_CREDENTIALS_PATHpoints to a service-account JSON file, that file is used.Otherwise, Application Default Credentials (ADC) are loaded via
google.auth.default().
For ADC, the simplest path is:
gcloud auth application-default loginOr point GOOGLE_APPLICATION_CREDENTIALS at a service-account JSON file.
Environment variables
All settings are optional and use the GCP_ prefix:
Variable | Description | Default |
| Project id used when a tool doesn't receive one | unset |
| Path to a service-account JSON file | unset (ADC) |
| Default per-request timeout in seconds |
|
Claude Desktop configuration
Add an entry like this to your Claude Desktop mcpServers config:
{
"mcpServers": {
"gcp": {
"command": "gcp-mcp",
"env": {
"GCP_DEFAULT_PROJECT_ID": "my-gcp-project",
"GCP_CREDENTIALS_PATH": "/absolute/path/to/service-account.json"
}
}
}
}If you prefer ADC, omit GCP_CREDENTIALS_PATH and ensure
gcloud auth application-default login was run as the same user that
launches Claude Desktop.
Tools
Resource Manager / IAM
list_projects()- list visible GCP projectsget_project(project_id)- fetch project metadatalist_service_accounts(project_id)- list IAM service accounts via the IAM REST API
Compute Engine
list_instances(project_id?, zone?)- zonal or aggregated instance listget_instance(project_id, zone, name)- single instance detailsstart_instance(project_id, zone, name)- start a VMstop_instance(project_id, zone, name)- stop a VM
Cloud Storage
list_buckets(project_id?)- list buckets in a projectlist_objects(bucket, prefix?, max_results=100)- list blobsget_object_metadata(bucket, name)- fetch blob metadata
BigQuery
list_datasets(project_id?)- list datasetslist_tables(project_id, dataset)- list tablesquery_bigquery(project_id, sql, dry_run=False)- run a query; dry-run returns schema and estimated bytes
Pub/Sub
list_topics(project_id?)- list topicslist_subscriptions(project_id?)- list subscriptionspublish_message(project_id, topic, data, attributes?)- publish a message.datais UTF-8; prefix withbase64:for binary payloads.
Cloud Logging
read_logs(project_id, filter, max_entries=50)- advanced log filter, e.g.resource.type="gce_instance"
Required IAM roles
The caller's principal needs appropriate roles per surface. Minimal recommended roles:
Surface | Role(s) |
Resource Manager |
|
IAM |
|
Compute |
|
Cloud Storage |
|
BigQuery |
|
Pub/Sub |
|
Cloud Logging |
|
Grant only what the caller actually needs.
Development
Run the test suite:
source .venv/bin/activate
pytest -x --tb=shortLint:
ruff check src/ tests/Tests mock each Google Cloud client with unittest.mock, so no real
GCP APIs are called.
Project layout
src/gcp_mcp/
__init__.py # main entry point
auth.py # ADC / service-account credential resolution
clients.py # lazy SDK client construction
config.py # pydantic-settings config (GCP_ env prefix)
exceptions.py # GCPError, AuthenticationError, APIError, NotFoundError
server.py # FastMCP server + @mcp.tool() definitions
tests/ # unit tests with mocked SDK clients
pyproject.toml
requirements.txtLicense
MIT.
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/LokiMCPUniverse/gcp-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server