multi-cloud-mcp-server
Health Pass
- License — License: MIT
- Description — Repository has a description
- Active repo — Last push 0 days ago
- Community trust — 47 GitHub stars
Code Pass
- Code scan — Scanned 12 files during light audit, no dangerous patterns found
Permissions Pass
- Permissions — No dangerous permissions requested
No AI report is available for this listing yet.
Generic MCP server for GCP and AWS: bring your own project/account, query BigQuery/Athena, inspect Cloud Build/CodeBuild, Cloud Run/ECS/Lambda logs
Multi-Cloud MCP Server
Executive summary
Most companies run their software on a cloud provider, and many use two: Google Cloud Platform (GCP) and Amazon Web Services (AWS). When something goes wrong, an engineer has to check several places in each: the data warehouse to see whether the numbers are right, the build system to see what was deployed, and the running service and its logs to find the error. Each of these has its own web console, so tracking down one problem means a lot of clicking and copying.
AI coding assistants could do this legwork, but only if they can reach those systems safely. An assistant that can run any database command, act with an administrator's permissions or pull back unlimited data is a risk. The risk is higher because the logs and data it reads can contain instructions planted by someone else.
This project is a small server that runs on your own machine and connects an AI assistant to your cloud accounts. It speaks the Model Context Protocol (MCP), the open standard that AI assistants such as Claude Code, Codex, GitHub Copilot, etc. use to call outside tools; an assistant that does this is called an MCP client. Once connected, the assistant can query data, check builds and read logs in GCP and AWS through one set of read-only tools, in every project or account you set up with a short wizard.
Results
- Coverage: 38 tools across 10 services, 4 on GCP and 6 on AWS (listed in Tech stack).
- Read-only: commands that would write data, change tables or export data are refused before they run. The check that enforces this passes 136 adversarial tests, cases written to sneak a write past it, including tricks that behave differently in the two clouds' SQL engines, Google BigQuery and Amazon Athena.
- Cost control: BigQuery charges by the amount of data a query reads. A query that would read more than a per-environment limit (10 GB by default) is refused before it runs, using BigQuery's own free estimate.
- Correct on real data: on a real log group in Amazon CloudWatch Logs holding 586 events, the first version answered "No logs found". The fixed version returns the newest events.
- Verified live: run as a real MCP server against a real GCP project and AWS account. Real queries ran, write attempts were rejected, and failures reached the assistant as proper errors.
- Tests: 457 automated tests, run on every push.
Key design decisions:
- Read-only is enforced twice, by the server and by the cloud permissions you give it. The server's checks are a second line of defence; read-only credentials (see Least-privilege permissions) are the real boundary.
- BigQuery has the final say on what a query does, because a check on the query's text can be fooled. Every query is first dry-run (checked by BigQuery without running it), and BigQuery must classify it as a read (
SELECT). - Failures are reported as errors, not as text, so the assistant can tell an expired login from real data.
- Logs are searched in a time window and read to the end, because CloudWatch returns the oldest events first and can return empty pages.
- Partial results always say so, so the assistant never mistakes part of a list for the whole of it.
- Configuration is checked at startup and read from next to the code, because assistants start the server from any folder, and a typo used to fall back silently to a different set of credentials.
Where to go next: Quickstart to run it in a few minutes, or How it works to see the architecture.
Table of contents
- Quickstart
- How it works
- Tech stack
- Repository structure
- Configuring environments
- Auth modes
- Tool catalog with examples
- Safety and cost controls
- Least-privilege permissions
- Extending with a new service
- Testing
- Troubleshooting
- Security
- License
Quickstart
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
python3 setup_wizard.py # interactive: configure your GCP and/or AWS environments
python3 server.py # runs the MCP server over stdio
Point your MCP client at server.py as the command to run (with the same .venv interpreter). For example, in Codex's config.toml or the mcp.json that GitHub Copilot reads, the command is the absolute path to .venv/bin/python3 and the argument is the absolute path to server.py.
Where the configuration is read from. The server reads the .env that sits next to server.py, not the one in whatever folder the client launches it from. To use a different file, set MULTICLOUD_MCP_ENV_FILE=/absolute/path/to/file.env. Real environment variables take precedence over the file, so an "env": {...} block in your MCP client config can override individual settings.
How it works
The big picture. An MCP client talks to server.py. The server only registers tools for the providers you have configured.

What happens on one tool call.
Tech stack
| Area | Technology |
|---|---|
| Language | Python |
| Protocol | Model Context Protocol (MCP) through FastMCP, over stdio |
| GCP services | Google BigQuery, Google Cloud Build, Google Cloud Run, Google Cloud Logging |
| AWS services | Amazon Athena, Amazon Elastic Container Service (Amazon ECS), AWS Lambda, AWS CodeBuild, Amazon Simple Storage Service (Amazon S3), Amazon CloudWatch Logs |
| Cloud SDKs | Google Cloud client libraries (google-cloud-bigquery, google-cloud-run, google-cloud-logging, google-cloud-storage, google-auth) and boto3 |
| Configuration | python-dotenv |
| Testing | pytest and moto |
| CI | GitHub Actions |
| Diagrams | diagrams with Graphviz, and SVG drawn in Python |
Repository structure
Configuring environments
An "environment" is a named GCP project or AWS account/region you want the server able to talk to. You can configure any number of them under any names you like: dev, prod, client-a-prod, whatever makes sense to you. Run the wizard to add one:
$ python3 setup_wizard.py
=== Multi-Cloud MCP Setup Wizard ===
Loaded 0 GCP environment(s): (none)
Loaded 0 AWS environment(s): (none)
Main menu:
1) Add a cloud environment
2) Remove an environment
3) Set default environment for a provider
4) Save and exit
5) Exit without saving
Choose [1-5]: 1
Provider?
1) gcp
2) aws
Choose [1-2]: 1
--- Add GCP environment ---
Environment name (e.g. 'dev', 'prod', 'client-a-prod'): prod
GCP project ID: my-real-project-id
Region [us-central1]:
Auth method:
1) Application Default Credentials (gcloud auth application-default login)
2) Service account JSON key file
Choose [1-2]: 1
Verifying...
Auth OK.
BigQuery smoke test OK.
Added GCP environment 'prod'.
Re-run the wizard any time to add another environment, remove one, or change which one is the default. It always reloads whatever .env already exists first, so nothing you have already configured is lost, and lines you added to .env by hand are kept. It checks each new environment's credentials as you add it (a live BigQuery or AWS STS call), and refuses names that would clash in .env (client-a and client_a).
Every tool function takes an optional env= argument naming which configured environment to act against (for example env="prod"). If you omit it, the tool falls back to whichever environment the wizard set as the default for that provider. Call the always-available list_environments tool to see what is currently configured and which environment is the default for each provider.
Auth modes
Chosen per environment, in the wizard.
GCP
- Application Default Credentials (ADC): run
gcloud auth application-default loginonce beforehand, or rely on the default service account if this is running inside GCP itself. - Service account JSON key file: point the wizard at a downloaded key file. Useful if you do not have
gcloudinstalled at all. The path is stored in.envasGCP_ENV_<NAME>_CREDENTIALS_PATH.
AWS
- Named profile (recommended): set one up first with
aws configureoraws configure sso. No secrets are ever written to.env, only the profile name. - Access key and secret: pasted directly into
.envfor an environment with no AWS CLI configured at all..envis git-ignored and the wizard sets its file permissions to600, but a profile is still the safer choice when you have one available.
Tool catalog with examples
The examples leave out env, so they act on the default environment.
Google BigQuery
Tools: bq_list_datasets, bq_list_tables, bq_describe_table, bq_query, bq_preview_table. bq_preview_table reads rows directly, which is free and never scans the table the way SELECT * would.
bq_list_datasets()
→ Project: my-real-project-id
part_catalog
analytics
bq_query(sql="SELECT id, name FROM `my-real-project-id.part_catalog.part_level`", max_results=2)
→ [
{"id": "A100", "name": "Bearing"},
{"id": "A101", "name": "Gasket"}
]
[Showing the first 2 rows; more rows are available. Add a LIMIT/WHERE, or raise max_results (max 100).]
bq_query(sql="DROP TABLE part_catalog.part_level")
→ (error) Only read-only queries are allowed ...
Google Cloud Build
Tools: cloudbuild_list_builds, cloudbuild_describe_build, cloudbuild_get_logs. Cloud Build keeps global builds (where default triggers write) separately from builds in each region, and each only returns its own, so these tools search both and say which they searched. region picks another region, or global for global only. Logs are read from the build's Cloud Storage logs bucket.
cloudbuild_list_builds(branch="main", limit=5)
→ [
{"id": "8f2e...", "status": "SUCCESS", "branch": "main",
"createTime": "2026-09-01T10:02:00Z", "finishTime": "2026-09-01T10:06:00Z",
"logUrl": "https://console.cloud.google.com/cloud-build/builds/8f2e..."}
]
Google Cloud Run
Tools: cloudrun_list_services, cloudrun_describe_service, cloudrun_list_revisions, cloudrun_get_logs, cloudrun_get_error_logs. Cloud Run is regional, so the list, describe and revision tools take an optional region (default: the environment's region). The log tools cover Cloud Run services and jobs; the error variant keeps severity>=ERROR.
cloudrun_get_error_logs(service_name="my-service", limit=20, since_minutes=180)
→ [
{"timestamp": "2026-09-01T10:05:12Z", "severity": "ERROR",
"message": "connection refused: upstream timeout"}
]
Amazon Athena
Tools: athena_list_databases, athena_list_tables, athena_describe_table, athena_query, athena_get_query_results, athena_preview_table. Athena queries tables in the AWS Glue Data Catalog and runs asynchronously; athena_get_query_results fetches an earlier query's rows by its ID.
athena_query(sql="SELECT id, amount FROM salesdb.orders LIMIT 2")
→ [
{"id": "1", "amount": "9.99"},
{"id": "2", "amount": "14.50"}
]
AWS CodeBuild
Tools: codebuild_list_projects, codebuild_list_builds, codebuild_describe_build, codebuild_get_logs.
codebuild_describe_build(build_id="my-project:abcd-1234")
→ {
"id": "my-project:abcd-1234", "status": "SUCCEEDED",
"startTime": "2026-09-01 10:00:00+00:00", "endTime": "2026-09-01 10:04:12+00:00",
"sourceVersion": "main",
"phases": [{"phaseType": "BUILD", "phaseStatus": "SUCCEEDED", "durationInSeconds": 42}]
}
Amazon Elastic Container Service (Amazon ECS)
Tools: ecs_list_clusters, ecs_list_services, ecs_describe_service, ecs_list_tasks, ecs_get_logs, ecs_get_error_logs. The log tools find the service's CloudWatch log group from its task definition. On AWS, the *_get_error_logs tools use the CloudWatch filter pattern ?ERROR ?Error ?CRITICAL ?FATAL ?Exception ?Traceback, because CloudWatch has no severity field.
ecs_get_error_logs(cluster="my-cluster", service_name="my-service", since_minutes=240, until_minutes=60)
→ [
{"timestamp": 1767283512000, "logStream": "ecs/app/abc123",
"message": "ERROR something broke"}
]
AWS Lambda
Tools: lambda_list_functions, lambda_describe_function, lambda_list_versions, lambda_get_logs, lambda_get_error_logs. A function's logs are always in /aws/lambda/<function_name>.
lambda_describe_function(function_name="my-function")
→ {
"name": "my-function", "runtime": "python3.12", "memorySize": 256, "timeout": 30,
"handler": "lambda_function.handler", "role": "arn:aws:iam::123456789012:role/lambda-role",
"lastModified": "2026-09-01T10:00:00.000+0000", "envVars": ["STAGE", "LOG_LEVEL"]
}
Amazon Simple Storage Service (Amazon S3)
Tools: s3_list_buckets, s3_list_objects.
s3_list_objects(bucket="my-bucket", prefix="logs/2026/09/", limit=5)
→ [
{"key": "logs/2026/09/01.json", "size": 4021, "lastModified": "2026-09-01 00:05:00+00:00"}
]
AWS Security Token Service (AWS STS)
Tools: aws_whoami, which shows the account and identity an environment resolves to.
aws_whoami()
→ Environment: prod
Account: 123456789012
ARN: arn:aws:iam::123456789012:role/my-role
Region: us-east-1
Always available
Tools: list_environments.
list_environments()
→ GCP environments:
dev (default) - project: my-dev-project, region: us-central1
prod - project: my-real-project-id, region: us-central1
AWS environments:
staging (default) - region: us-east-1
Safety and cost controls
bq_query and athena_query pass every statement through these checks:
- What counts as read-only. One statement starting with
SELECT,WITH,SHOW,DESCRIBE,EXPLAINorVALUES, with no write, DDL or export keyword anywhere in it (INSERT,MERGE,DROP,CREATEincluding CTAS,UNLOAD,EXPORT DATA, ...). Comments and quoted text are blanked out first, using each dialect's own quoting rules. - BigQuery cost cap setting.
GCP_ENV_<NAME>_MAX_BYTES_BILLED, set in the wizard. Queries also run withmaximum_bytes_billed, so the cap holds even if the estimate was low. - Athena cost cap setting. Athena's scan limit belongs to the workgroup, not the query. Create a workgroup with a per-query data-scanned cutoff and enforced output location, and set
AWS_ENV_<NAME>_ATHENA_WORKGROUPto it. Athena always writes result files to its output location, soathena_queryis read-only with respect to your data but does create result objects there. - Tool annotations. Every tool is marked
readOnlyHint=trueanddestructiveHint=false, so clients can show that and skip per-call confirmation. - Output limits. Lists stop at 200 items, cells at 2,000 characters, Cloud Build logs at the last ~200 KB, and log searches after 100 pages (each says so when it stops).
The SQL check works on the text of the query, which has two known trade-offs: a column or table named like a blocked keyword (call, load, set, ...) must be quoted (`set` / "set") to pass, and pass-through functions that run a SQL string on another database (BigQuery's EXTERNAL_QUERY) are refused outright, because the check cannot read the inner SQL.
Least-privilege permissions
Give the credentials this server uses only what the tools need.
GCP (grant to the user or service account behind ADC / the key file):
| Tools | Role |
|---|---|
| Google BigQuery | roles/bigquery.dataViewer on the datasets to expose, plus roles/bigquery.jobUser on the project (needed to run queries; it does not allow writing data) |
| Google Cloud Run | roles/run.viewer |
| Google Cloud Logging | roles/logging.viewer |
| Google Cloud Build | roles/cloudbuild.builds.viewer, plus roles/storage.objectViewer on the Cloud Build logs bucket (for cloudbuild_get_logs) |
AWS (attach to the profile's role/user). The tools only call these actions:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "ReadOnlyForMultiCloudMcp",
"Effect": "Allow",
"Action": [
"athena:ListDatabases", "athena:ListTableMetadata", "athena:GetTableMetadata",
"athena:StartQueryExecution", "athena:GetQueryExecution", "athena:GetQueryResults",
"athena:StopQueryExecution",
"glue:GetDatabase", "glue:GetDatabases", "glue:GetTable", "glue:GetTables", "glue:GetPartitions",
"codebuild:ListProjects", "codebuild:ListBuildsForProject", "codebuild:BatchGetBuilds",
"ecs:ListClusters", "ecs:ListServices", "ecs:DescribeServices", "ecs:ListTasks",
"ecs:DescribeTasks", "ecs:DescribeTaskDefinition",
"lambda:ListFunctions", "lambda:GetFunction", "lambda:ListVersionsByFunction",
"logs:FilterLogEvents", "logs:GetLogEvents",
"s3:ListAllMyBuckets", "s3:ListBucket"
],
"Resource": "*"
}
]
}
Scope Resource down where you can. Athena also needs S3 access that this policy does not grant: s3:GetObject/s3:ListBucket/s3:GetBucketLocation on the buckets holding the data being queried, and s3:PutObject (plus the same read actions) on the Athena results location only. Keep results in a dedicated bucket and do not grant s3:PutObject anywhere else: that is what stops a CTAS or UNLOAD from writing data even if one got past the SQL guard. sts:GetCallerIdentity (used by aws_whoami) needs no permission.
Extending with a new service
Every tool module follows the same shape: a register(mcp) function that defines its tool functions as closures decorated with @cloud_tool(mcp) (from providers/tools.py), each resolving its environment through CONFIG.resolve_gcp(env) or CONFIG.resolve_aws(env). To add a new service:
- Create
providers/gcp/<service>_tools.pyorproviders/aws/<service>_tools.pyfollowing that shape. - Add it to the relevant import list and registration loop in
server.py. - Write a test file under
tests/gcp/ortests/aws/using thegcp_config/aws_configfixtures described below.
Never hardcode a project ID, account ID, or region anywhere. Everything should flow through the resolved environment object.
Testing
The test suite mocks every cloud call, so it runs with no real GCP or AWS credentials and makes no real cloud API calls (AWS tests run against moto's in-memory AWS simulation, or against faithful fakes where moto doesn't model the behavior under test, such as CloudWatch's oldest-first paging, ECS's paging, and Cloud Build's global/regional split). The one exception: the subprocess wizard tests run the wizard's real credential check, which makes a harmless BigQuery call if Application Default Credentials exist on your machine.
pip install -r requirements-dev.txt
python3 -m pytest tests/ -v
tests/conftest.py provides two fixtures used throughout: gcp_config(module) and aws_config(module), which each monkeypatch a tool module's CONFIG to a fake, single-environment AppConfig. AWS tests wrap their body in moto's @mock_aws decorator and use fake static keys, so the real providers/aws/auth.py code path runs end to end against moto's simulated AWS rather than mocking authentication away. GCP has no equivalent in-memory emulator, so GCP tests mock at the client-class boundary instead (bigquery.Client, run_v2.ServicesClient, and so on).
tests/test_errors.py drives tools through a real in-memory MCP client/server session to prove failures arrive as isError=true and that a slow tool doesn't block the event loop. tests/test_sql_guard.py is the adversarial suite for the read-only SQL check. Tests never read or write the repo's real .env: an autouse fixture points MULTICLOUD_MCP_ENV_FILE at a temp file.
tests/test_server.py and tests/test_setup_wizard.py run the real scripts as subprocesses in an isolated temporary working directory, since both have import-time or interactive side effects that are not safe to exercise by importing them directly inside the test process.
Live smoke test
The mocked suite proves the code is correct in isolation, but it can't catch things like a mistyped project ID, an API that isn't enabled, or an expired credential. live_check.py covers that gap: it reads your real .env and makes one real, read-only call per configured environment (an actual credential fetch plus a lightweight BigQuery call for GCP, an actual sts:GetCallerIdentity for AWS), so it exercises the exact same auth code path the real tools use, without needing you to have any specific resources (datasets, buckets, functions) already set up.
python3 live_check.py # check every configured environment
python3 live_check.py --env prod # check only one environment by name
python3 live_check.py --provider aws # check only one provider
It reads the same .env as the server.
Troubleshooting
- "No cloud providers configured" on startup: run
python3 setup_wizard.py. - "Invalid configuration: ..." on startup: the message names the exact
.envkey to fix. - Server finds no config when launched from an MCP client: see Where the configuration is read from in Quickstart.
- "Query would process N bytes, over this environment's limit": filter on a partition/clustering column, select fewer columns, or raise the BigQuery cost cap setting (see Safety and cost controls).
- "Query rejected: contains write/DDL keyword(s) ...": see the trade-offs under Safety and cost controls.
- Log tools return nothing: they search the last 60 minutes by default; pass
since_minutes(up to 43200) to look further back. - "Unknown GCP/AWS environment '...'": the error message lists what is actually configured; use one of those names, or add a new one with the wizard.
- AWS profile issues:
aws sts get-caller-identity --profile <name>to test outside the wizard.
Security
To report a vulnerability, see SECURITY.md.
License
Released under the MIT License.
Reviews (0)
Sign in to leave a review.
Leave a reviewNo results found