Build and Deploy a Remote MCP Server to Google Cloud Run in Under 10 Minutes

Written by: Aman Soni

December 15, 2025

8 mins Read

Build and Deploy a Remote MCP Server to Google Cloud Run in Under 10 Minutes

The Model Context Protocol (MCP) has revolutionized how AI applications access context and tools. While local MCP servers run on your machine, remote MCP servers offer significant advantages: they’re accessible anywhere, scalable, and can be shared across teams. In this guide, you’ll learn how to build and deploy a secure remote MCP server to Google Cloud Run in under 10 minutes.

What is the Model Context Protocol?

MCP (Model Context Protocol) is an open-source standard for connecting AI applications to external systems. Think of it as a universal adapter that allows AI assistants like ChatGPT and Claude to securely connect to various data sources and tools.

https://modelcontextprotocol.io/introduction

Remote vs. Local MCP Servers

Local MCP servers run directly on your machine, which works well for personal use but has limitations:

  • Not accessible from other devices
  • Difficult to share with team members
  • Can’t scale with demand

Remote MCP servers are deployed to the cloud and offer:

  • Access from anywhere with internet connectivity
  • Familiar OAuth-style authorization flows
  • Automatic scaling based on usage
  • Team collaboration capabilities

Why Google Cloud Run?

Google Cloud Run is an ideal platform for hosting MCP servers because it:

  1. Scales to zero: Pay only when your server receives requests
  2. Supports multiple languages: Deploy Node.js, Python, Java, .NET, and more
  3. Handles containerization: Build from source or deploy pre-built containers
  4. Provides built-in security: IAM-based authentication out of the box
  5. Offers fast deployment: From code to production in minutes

Prerequisites

Before you begin, ensure you have:

1. A Google Cloud Platform account

2. Google Cloud CLI installed

3. Basic familiarity with Node.js or Python

4. A text editor or IDE

Step 1: Set Up Your Google Cloud Environment

First, authenticate and configure your Google Cloud project:

Authenticate with Google Cloud
gcloud auth login

    Create a new project (or use an existing one)
    gcloud projects create my-mcp-server –name=”My MCP Server”

    Set the project as default
    gcloud config set project my-mcp-server

    Enable required APIs
    gcloud services enable run.googleapis.com
    gcloud services enable cloudbuild.googleapis.com

    This sets up the foundation for deploying to Cloud Run.

    Step 2: Create Your MCP Server

    You can build an MCP server using the official SDK. Here’s a simple example using Node.js:

    Initialize Your Project

    Create project directory
    mkdir weather-mcp-server
    cd weather-mcp-server

    Initialize Node.js project
    npm init -y

    Install MCP SDK
    npm install @modelcontextprotocol/sdk

    Create the Server Code

    Create a file named index.js:

    import { Server } from ‘@modelcontextprotocol/sdk/server/index.js’;

    import { StdioServerTransport } from ‘@modelcontextprotocol/sdk/server/stdio.js’;

    import {

      CallToolRequestSchema,

      ListToolsRequestSchema,

    } from ‘@modelcontextprotocol/sdk/types.js’;

    // Create MCP server instance

    const server = new Server(

      {

        name: ‘weather-server’,

        version: ‘1.0.0’,

      },

      {

        capabilities: {

          tools: {},

        },

      }

    );

    // Define available tools

    server.setRequestHandler(ListToolsRequestSchema, async () => ({

      tools: [

        {

          name: ‘get_weather’,

          description: ‘Get current weather for a location’,

          inputSchema: {

            type: ‘object’,

            properties: {

              location: {

                type: ‘string’,

                description: ‘City name or zip code’,

              },

            },

            required: [‘location’],

          },

        },

      ],

    }));

    // Handle tool execution

    server.setRequestHandler(CallToolRequestSchema, async (request) => {

      if (request.params.name === ‘get_weather’) {

        const location = request.params.arguments.location;

        // In production, call a real weather API

        return {

          content: [

            {

              type: ‘text’,

              text: `Current weather in ${location}: 72°F, partly cloudy`,

            },

          ],

        };

      }

      throw new Error(`Unknown tool: ${request.params.name}`);

    });

    // Start server

    async function main() {

      const transport = new StdioServerTransport();

      await server.connect(transport);

      console.log(‘Weather MCP server running’);

    }

    main().catch(console.error);

    Add HTTP Transport for Remote Access

    For Cloud Run deployment, you’ll need HTTP transport. Create `server.js`:

    import express from ‘express’;

    import { Server } from ‘@modelcontextprotocol/sdk/server/index.js’;

    const app = express();

    const PORT = process.env.PORT || 8080;

    // Your MCP server logic here (same as above)

    const mcpServer = new Server(/* … */);

    // Endpoint for SSE (Server-Sent Events)

    app.get(‘/sse’, async (req, res) => {

      res.setHeader(‘Content-Type’, ‘text/event-stream’);

      res.setHeader(‘Cache-Control’, ‘no-cache’);

      res.setHeader(‘Connection’, ‘keep-alive’);

      // Handle MCP protocol over SSE

      // Implementation details depend on your MCP SDK version

    });

    app.listen(PORT, () => {

      console.log(`MCP server listening on port ${PORT}`);

    });

    Step 3: Create a Dockerfile

    Create a `Dockerfile` in your project root:

    FROM node:20-slim

    WORKDIR /app

    COPY package*.json ./

    RUN npm ci –only=production

    COPY . .

    EXPOSE 8080

    CMD [“node”, “server.js”]

    Step 4: Deploy to Cloud Run

    Now comes the magic. Deploy your MCP server with a single command:

    gcloud run deploy weather-mcp-server \

      –source . \

      –platform managed \

      –region us-central1 \

      –allow-unauthenticated \

      –port 8080

    For a secure deployment (recommended), require authentication:

    gcloud run deploy weather-mcp-server \

      –source . \

      –platform managed \

      –region us-central1 \

      –no-allow-unauthenticated \

      –port 8080

    Cloud Run will:

    1. Build your container automatically
    2. Deploy it to a managed service
    3. Provide you with a public HTTPS URL

    The entire process typically takes 2-3 minutes.

    Step 5: Secure Your MCP Server

    Security is critical for remote MCP servers. Follow these best practices:

    Use IAM Authentication

    By deploying with `–no-allow-unauthenticated`, you ensure only authorized users can access your server. Grant access using IAM roles:

    Grant a user access to invoke your service

    gcloud run services add-iam-policy-binding weather-mcp-server \

    --region=us-central1 \

    --member="user:colleague@example.com" \

    --role="roles/run.invoker"

    Create a Dedicated Service Account

    Instead of using the default service account, create one with minimal permissions:

    Create service account

    gcloud iam service-accounts create mcp-server-sa \ --display-name="MCP Server Service Account"

    Deploy with the service account

    gcloud run deploy weather-mcp-server \

    --source . \

    --service-account=mcp-server-sa@my-mcp-server.iam.gserviceaccount.com \

    --no-allow-unauthenticated

    Add Cloud Armor Protection

    For public-facing services, protect against DDoS and abuse:

    1. Deploy Cloud Run behind a Load Balancer
    2. Enable [Cloud Armor security policies](https://cloud.google.com/armor)
    3. Configure rate limiting and IP filtering

    Step 6: Connect to Your Remote MCP Server

    Once deployed, you’ll receive a URL like: https://weather-mcp-server-abc123-uc.a.run.app

    Configure Claude Desktop

    Add your remote server to Claude Desktop’s configuration:

    • macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
    • Windows: `%APPDATA%\Claude\claude_desktop_config.json`

    {
    "mcpServers": {
    "weather": {
    "url": "https://weather-mcp-server-abc123-uc.a.run.app/sse",
    "transport": "sse"
    }
    }
    }

    Test the Connection

    Restart Claude Desktop and verify the connection:

    1. Look for your server in the available tools
    2. Try invoking a tool: “What’s the weather in San Francisco?”
    3. Check Cloud Run logs for requests

    Real-World Use Cases

    Remote MCP servers on Cloud Run enable powerful scenarios:

    Team Collaboration
    Deploy a shared MCP server that connects to your company’s internal databases, allowing the entire team to query data through Claude.

    Multi-Region Deployment
    Deploy the same MCP server to multiple regions for low-latency access worldwide.

    Integration with Google Services
    Build MCP servers that leverage Google Cloud services like BigQuery, Cloud Storage, or Vertex AI.

    Scheduled Operations
    Combine with Cloud Scheduler to perform automated tasks at specified intervals.

    Conclusion

    Deploying a remote MCP server to Google Cloud Run combines the power of the Model Context Protocol with the scalability and reliability of Google Cloud’s serverless platform. With automatic scaling, built-in security, and pay-per-use pricing, Cloud Run provides an ideal hosting environment for MCP servers.

    Whether you’re building internal tools for your team, creating public APIs for the AI community, or experimenting with cutting-edge AI workflows, remote MCP servers on Cloud Run offer a production-ready solution that’s both powerful and easy to manage.

    The entire process from setup to deployment takes less than 10 minutes, yet provides enterprise-grade infrastructure that scales with your needs.

    Product Manager at Economize with over 3 years of experience, focused on FinOps strategies and cloud cost optimization. Dedicated to helping organizations streamline cloud expenses and drive financial efficiency.

    More Like this


    Maximize Cloud Efficiency and Optimize Costs

    Get started free in our sandbox or book a personalized call with our experts

    Table of Contents