gcloud MCP server: how a quote gets past its denylist, and how to make your agent ask

The one tool of Google's gcloud MCP server (@google-cloud/gcloud-mcp 0.5.3), checked by running it with Google Cloud SDK 594 on this machine and every API call caught by a local server, never a real project: how a quote in one argument got a denied delete past both its denylist and its allowlist, what the default setup lets an agent read and reconfigure, the read-only switch in gcloud itself that held for writes, and the Claude Code settings that make it ask.

Checked on by running @google-cloud/gcloud-mcp 0.5.3 (npm, the latest on 27 November 2026, run with Google Cloud SDK 594.0.1 on macOS and no Google account) from googleapis/gcloud-mcp and reading its tools/list answer. Each tier is the tool risk checker’s reading, with our reason wherever we changed it. Written by the people who make VariantGate.

The short answer

One tool runs any gcloud command, and a quote in one argument hid a denied delete from its denylist and from an allowlist of only projects list. gcloud's own experimental read-only assertion, set in the server's environment, held for writes, but flags such as --impersonate-service-account still went through. Keep the tool on ask, and sign it in as an account that may do only what the agent needs.

Can run on their own
0
Should ask a person
1

Lethal trifecta: On its own this server can read private data, take in content other people wrote and send data out: all three legs of the lethal trifecta. Check your whole setup

Which gcloud server this is

This page is about Google’s googleapis/gcloud-mcp, published on npm as @google-cloud/gcloud-mcp. Its README says it is in preview and not an officially supported Google product. We ran 0.5.3, the latest on npm, with Node 24 and Google Cloud SDK 594.0.1 on macOS. It offers one tool, run_gcloud_command, which takes a list of arguments and runs gcloud with them, as whatever account gcloud is signed in as. The tool carries no read-only or destructive hint, and the server itself makes no network calls: everything goes through gcloud.

How we ran it without a Google account

We gave gcloud its own empty config folder, a made-up access token in auth/access_token_file, the project demo-project, and endpoint overrides that send Compute, Resource Manager, IAM Credentials and Secret Manager calls to a small server on our own machine. That server logged every request with its Authorization header, so we could see what each tool call would have done to a real project.

The denylist and the allowlist

Before running anything, the server asks gcloud to parse the command (gcloud meta lint-gcloud-commands) and checks the command path it gets back. A denylist is always on: compute ssh, compute start-iap-tunnel, compute connect-to-serial-port, three other SSH commands, interactive and meta. A JSON file passed with --config can add a denylist or replace it with an allowlist, but not both. Plain calls were checked as promised: compute ssh vm1 and meta list-commands were refused, and with the allowlist below, compute instances list and auth print-access-token were refused too.

{ "allow": ["projects list"] }

One quote hid a delete from both lists

The check parses the arguments joined into one string, but the server then runs the original list. A single quote at the end of one argument and another at the end of a later one makes the parser read everything between them as one flag value, while gcloud, given the list, runs it. With the allowlist above, this call was parsed as projects list, passed, and ran compute instances delete:

{
  "name": "run_gcloud_command",
  "arguments": {
    "args": ["--trace-token='a", "compute", "instances", "delete",
             "--quiet", "--trace-token=b'", "projects", "list"]
  }
}

The words projects list, which the check took for the command, became the names of two instances to delete. Our server received both deletes in one batch, with the token:

DELETE /compute/v1/projects/demo-project/zones/europe-west1-b/instances/projects
DELETE /compute/v1/projects/demo-project/zones/europe-west1-b/instances/list

The same call got past a denylist of compute instances delete, and with no config file at all the same trick ran compute ssh, which the default denylist names: it made an SSH key and printed the ssh command it would run (we used --dry-run). The lists are a guide for a model that follows instructions, not a limit on one that has read a hostile issue or web page.

What the default setup lets an agent do

Without a config file, these went straight through:

  • auth print-access-token printed the access token, and config config-helper returned it as JSON.
  • config set api_endpoint_overrides/cloudresourcemanager pointed gcloud at another host, and the next projects list sent the token there. The setting stays in the person’s own gcloud config, so their terminal uses it too.
  • Global flags are never checked, even under an allowlist. projects list --impersonate-service-account=owner-sa@… asked IAM for that account’s token and listed the projects as it, and --access-token-file=/etc/hosts made gcloud crash with the whole file in the error the model reads back.

gcloud’s own read-only assertion held for writes

The server has no read-only mode, but SDK 594 has a hidden, experimental property, core/assert, that gcloud itself checks for the command it actually runs. Google’s help text calls it “not for production use”. With CLOUDSDK_CORE_ASSERT=readonly in the server’s environment, projects list and compute instances list still ran, and these were refused before any request left the machine:

  • the plain delete, and the hidden one above, which gcloud now saw for what it was.
  • auth print-access-token, config config-helper and secrets versions access.
  • config set and config unset core/assert, so the agent could not turn it off, and --assert= was rejected as an invalid choice.
ERROR: (gcloud.compute.instances.delete) Command [gcloud compute instances delete]
violated assertion: --assert=readonly.
Certainty: Certain (confirmed mutating).

It does not cover everything: --impersonate-service-account and --access-token-file=/etc/hosts behaved as before. A command gcloud has not marked as read-only is refused too, so expect some harmless reads to fail.

A safer setup

claude mcp add gcloud -e CLOUDSDK_CORE_ASSERT=readonly -- npx -y @google-cloud/gcloud-mcp@0.5.3

Pin the version, keep the assertion in the server’s environment, and sign gcloud in as an account that holds only the roles the agent needs, such as Viewer on one project. If that account has the Service Account Token Creator role on others, the agent can act as them with one flag. Since the property is experimental, check after each SDK update that a delete is still refused.

Its 1 tool

Hard to undo1 toolAsk a person every time. Consider two people, or deny it if the agent never needs it.

  • run_gcloud_command

    Executes a gcloud command.

    Server gives no read-only or destructive hint

    Our call: Runs any gcloud command the active account may run, deletes included. Its denylist and allowlist check the command gcloud's own parser sees in the joined string, but the server then runs the raw arguments, so one quote inside an argument hid a delete from both. It also printed the access token and changed the endpoint gcloud sends that token to.

Claude Code asks for every call

Claude Code asks before every MCP tool it has no rule for. Added as gcloud, this server’s tools are named mcp__gcloud__<tool>. None of its tools only looks, so there is no allow rule to add: leave it without one and every call asks, including any tool a later version of the server adds.

The command that adds the server:

claude mcp add gcloud -e CLOUDSDK_CORE_ASSERT=readonly -- npx -y @google-cloud/gcloud-mcp@0.5.3

Send the rest to a person, not the terminal

A prompt in the terminal only works while someone is watching it. With this hook, every call of the server becomes a request in your VariantGate inbox, on your phone or in Slack, and Claude Code waits for the answer. The matcher covers the whole server, so a tool added later is sent too. Put the key in VARIANTGATE_KEY, or run the one-command setup for Claude Code first.

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "mcp__gcloud__.*",
        "hooks": [
          { "type": "command", "command": "variantgate hook claude-code", "timeout": 180 }
        ]
      }
    ]
  }
}

Disagree with a tier, or run the server with other flags? Open these tools in the tool risk checker, change what you like, and copy the settings for your own setup. It runs in your browser and starts from its own reading, so a tool we marked as only looking by hand asks there until you change it.

Set it up in Cursor, VS Code, Codex, Gemini CLI and other clients

The same server as the claude mcp add line above, written the way each client reads it, for Claude Desktop, Cursor, VS Code, Windsurf, Codex, Gemini CLI, Cline and Zed. Cursor and VS Code add it in one click: the app shows the settings and asks before it saves them. Set up like this, every tool runs as soon as the model calls it; the next section puts a person in front of the ones that change things. Running it with other flags? Convert your own settings.

claude_desktop_config.json{
  "mcpServers": {
    "gcloud": {
      "command": "npx",
      "args": [
        "-y",
        "@google-cloud/gcloud-mcp@0.5.3"
      ],
      "env": {
        "CLOUDSDK_CORE_ASSERT": "readonly"
      }
    }
  }
}

Any MCP client: put the proxy in front

Claude Desktop, Cursor and most other MCP clients have no hook to send a call to a person. The VariantGate MCP proxy does it in the server’s place: it starts the server and holds every call until someone approves it in the inbox. Run npx -y https://variantgate.com/sdk/variantgate-agent-0.19.0.tgz login once to save a key, then use the settings for your client:

claude_desktop_config.json{
  "mcpServers": {
    "gcloud": {
      "command": "npx",
      "args": [
        "-y",
        "https://variantgate.com/sdk/variantgate-agent-0.19.0.tgz",
        "mcp-proxy",
        "--name",
        "gcloud",
        "--",
        "npx",
        "-y",
        "@google-cloud/gcloud-mcp@0.5.3"
      ],
      "env": {
        "CLOUDSDK_CORE_ASSERT": "readonly"
      }
    }
  }
}

Already have it in Claude Desktop? One command rewrites the file for you, with every call asking, and keeps the old one (setup vscode does the same for VS Code; how it works):

npx -y https://variantgate.com/sdk/variantgate-agent-0.19.0.tgz setup claude-desktop

The same in Claude Code, instead of the hook. The proxy now asks about every call that matters, so an allow rule for the whole server, mcp__gcloud, keeps Claude Code from asking a second time in the terminal:

claude mcp add gcloud -e CLOUDSDK_CORE_ASSERT=readonly -- npx -y https://variantgate.com/sdk/variantgate-agent-0.19.0.tgz mcp-proxy --name gcloud -- npx -y @google-cloud/gcloud-mcp@0.5.3

When the agent should write

Drop the assertion only for a second copy of the server, signed in as an account limited to what the agent changes, and keep that copy on ask. Claude Code’s rules match an MCP tool’s name, never its arguments, so with one tool they cannot let reads run and stop deletes. A person who sees the arguments can: a stray quote before compute instances delete is easy to catch when someone reads the whole list. Outside Claude Code, the VariantGate MCP proxy sends each call to a person with its arguments.

See it before you decide.

The playground runs the whole approval loop in your browser, no account needed. When it fits, the free plan covers 100 requests a month.