Skip to main content

One post tagged with "Cloud Run"

View All Tags

How to Set Up a GCP MCP Server on Cloud Run

Β· 3 min read

This post walks you through deploying a Model Context Protocol (MCP) server on Google Cloud Run, enabling AI agents to securely interact via streamable HTTP endpoints. It includes FastMCP for local development, deployment steps, and secure authentication options.


🧩 What is MCP?​


MCP (Model Context Protocol) is an open standard that structures how AI agents (MCP clients) securely interact with external services (MCP servers).


It supports two transports:


  1. Streamable HTTP via Server‑Sent Events (SSE)
  2. Standard input/output (stdio)

With this protocol, AI tools operate in real-time, structured workflows.


☁️ Why Use GCP for MCP?​


Google Cloud Run supports MCP servers using streamable HTTP, making it an ideal choice for secure, scalable hosting with built-in HTTPS and IAM-based access control.


🧱 Setup Overview​


  1. Create or select a Google Cloud project.
  2. Enable billing and the Cloud Run Admin API.
  3. Use Cloud Shell or your local machine to build and deploy the MCP server container.
  4. Authenticate MCP clients using IAM roles or OIDC tokens.

βš™οΈ Full Instructions​


Rather than replicating the entire deployment guide, please refer to the official Google documentation:


πŸ‘‰ Host MCP Servers on Cloud Run (GCP Docs)


This guide includes:


  1. Local and remote MCP server hosting options
  2. Detailed steps for deploying container images or source code
  3. Authentication methods (IAM, OIDC, Cloud Service Mesh)
  4. Configuration of MCP clients to connect to your Cloud Run-hosted server

πŸ”§ Local Development with FastMCP​


Use FastMCP for local testing and custom MCP server creation.


Project structure:


mkdir mcp-on-cloudrun && cd mcp-on-cloudrun
uv init --name "mcp-on-cloudrun" --bare --python 3.10
uv add fastmcp==2.6.1
touch server.py test_server.py Dockerfile

Basic server.py example:


from fastmcp import FastMCP

mcp = FastMCP("GCP Example")

@mcp.tool()
def add(a: int, b: int) -> int:
return a + b

if __name__ == "__main__":
mcp.run(transport="streamable-http", port=8080)

πŸ‘‰ Full Code


πŸ” Client Authentication Options​


For security:


  1. Use gcloud run services proxy for local dev.
  2. Use IAM roles or OIDC tokens for production.
  3. Refer to the authentication section of GCP's MCP server guide.

πŸ“Œ Summary​


You now know how to:


  1. Use GCP Cloud Run to host an MCP server.
  2. Use FastMCP to scaffold tools locally.
  3. Connect clients with authentication and real-time streaming.

🧠 For end-to-end steps, visit:
πŸ“– https://cloud.google.com/run/docs/host-mcp-servers


πŸ”š Call to Action​


Choosing the right cloud platform depends on your organization’s unique needs. To stay ahead with expert insights, practical tips, and emerging trends in cloud and AI, subscribe to our newsletter.


Prefer watching? Follow our video series on cloud comparisons to see platforms in action.


πŸš€ Ready to take the next step? Contact us today and let us help your organization launch, scale, or optimize your cloud journey with confidence.


πŸ’¬ Comment below:


Which tool is your favorite? What do you want us to review next?