Skip to content

Google maps a private path to internal Cloud Run MCP servers

A new Google Cloud walkthrough shows how Gemini Enterprise can reach internal Model Context Protocol servers on Cloud Run without public exposure.

Draftship Editorial4 min read

Google published a walkthrough on Nov. 20, 2026 showing how to connect Gemini Enterprise to internal Model Context Protocol servers on Cloud Run without exposing them to the public internet. The post, by Neeraj Agrawal, a Forward Deployed Engineer at Google Cloud, treats Cloud Run MCP server security as three problems, each with its own mechanism: Egress Agent Gateway, Private Service Connect and a Private Cloud DNS zone scoped to one hostname. A companion GitHub repository holds a Python StreamableHTTP server, a Dockerfile, smoke tests and setup scripts.

The three failures Google names

Google says teams build custom MCP servers to reach internal APIs, databases and workflows, and that Cloud Run fits because it scales automatically, handles TLS certificates and integrates with Cloud IAM. Production adds friction in three places.

Internal-only ingress. Security policy usually requires blocking public traffic. With internal ingress enabled, Google says default public calls from Gemini Enterprise are rejected at Google's edge with an HTTP 404.

Two identity checks. Cloud Run IAM must confirm the request came from the authorized Gemini Enterprise instance, and the application must validate the signed-in user's OAuth 2.0 access token before acting for that person.

Shared VPC DNS. Hundreds of Cloud Run services can share one central VPC, where a wildcard *.run.app private zone made for a single MCP server can override resolution and break routing for the rest.

Two bridges and one narrow DNS zone

Cloud Run is serverless, so there is no VM with an internal IP to route to. The post describes two hops. A regional Egress Agent Gateway in Agent-to-Anywhere mode attaches to a Private Service Connect network attachment in your subnet, which the post places in us-central1 or europe-west1. Traffic then reaches Google's serverless Cloud Run frontend privately, either through Subnet Private Google Access on 199.36.153.8/30 or a global PSC endpoint for Google APIs on 240.0.0.10, the latter for locked-down VPCs where the 0.0.0.0/0 route is deleted.

DNS is the awkward part. Without a private zone, .run.app resolves to public addresses and calls time out with HTTP 502, because a PSC network attachment does not route to the internet. Google's answer is a private zone for the MCP service's exact FQDN, peered only with the gateway. Cloud DNS uses longest-suffix matching, so other Cloud Run services keep resolving, and the gateway keeps the hostname in the TLS SNI and Host header so Cloud Run picks the right container.

Two headers on every call

Gemini Enterprise sends both. X-Serverless-Authorization holds a Google-signed OIDC ID token for the project's Gemini Enterprise service agent; Cloud Run IAM checks it against the Cloud Run Invoker role at the edge and strips it before the request reaches the container. Authorization: Bearer carries the user's OAuth 2.0 token untouched, so middleware inside the MCP server can check the caller and enforce per-user permissions. Google's sample middleware returns 401 on a missing or invalid token and skips the check on /health.

Five steps, in order

Deploy with internal-only ingress and IAM authentication, then grant the Cloud Run Invoker role to the Gemini Enterprise service agent. Enable Private Google Access on the subnet, create the PSC network attachment and the Egress Agent Gateway, grant its service accounts networking and DNS peering permissions and apply an outbound authorization policy. Create the FQDN-scoped zone and peer it with the gateway. Bind the gateway under Security Configuration in the Gemini Enterprise console, register the Custom MCP Server data store with the Cloud Run endpoint and OAuth 2.0 client credentials, and turn on Agent Gateway egress and Actions mode. Then reload custom actions, run a test prompt and check Cloud Logging to confirm initialization, discovery and execution calls went through the gateway with both checks passing.

Limits and open questions

The post is a how-to, not a launch notice, so it does not say whether any of this is generally available, and it gives no pricing or latency figures. It assumes Gemini Enterprise as the client and does not state whether other MCP clients can use the same path. Even with scripts, the work is real infrastructure: IAM bindings, DNS peering and a gateway policy, plus verification in logs rather than a single console toggle.

What this suggests for app builders

For teams putting agents in front of private systems, the difficult part of an MCP server is now identity and network placement, not the server code, which the post keeps short. Smaller apps with a few AI features are a long way from needing a PSC attachment. On Draftship, apps come with a built-in database, user sign-in and hosting, and the guide to adding AI to your app covers model calls inside a hosted app rather than private VPC routing. Draftship is not affiliated with Google.

Primary sources

This article was drafted with AI assistance from the primary sources listed below and checked automatically against them. An editor hasn't reviewed it yet.