Securely connect Gemini Enterprise to internal Cloud Run MCP servers
Brief
The guide describes a private network path and two-layer authentication for Gemini Enterprise calls to internal Cloud Run MCP servers.
Architecture and authentication
- An Egress Agent Gateway connects through a PSC Network Attachment to the VPC, then reaches Cloud Run through Private Google Access or a global PSC endpoint for Google APIs.
- A Private Cloud DNS zone scoped to the MCP server's exact hostname avoids overriding DNS for other Cloud Run services in a Shared VPC.
- Cloud Run IAM checks the service agent's X-Serverless-Authorization token; application middleware can validate the user's OAuth 2.0 Bearer token.
Setup and reference implementation
- The five-step setup covers restricting Cloud Run ingress, provisioning the gateway and network attachment, configuring scoped DNS, registering the MCP server in Gemini Enterprise, and checking calls in Cloud Logging.
- The linked GitHub repository includes a Python StreamableHTTP MCP server with OAuth 2.0 validation middleware, setup scripts, and instructions for both routing options.
Generated by AI from the original article. Check the source for full details.