# 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://i0.wp.com/economizecloud.wpengine.com/wp-content/uploads/2025/12/image.png?resize=1024%2C683&ssl=1)

[https://modelcontextprotocol.io/introduction](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:

- Scales to zero: Pay only when your server receives requests
- Supports multiple languages: Deploy Node.js, Python, Java, .NET, and more
- Handles containerization: Build from source or deploy pre-built containers
- Provides built-in security: IAM-based authentication out of the box
- 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 Cloudgcloud 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 defaultgcloud config set project my-mcp-server

Enable required APIsgcloud services enable run.googleapis.comgcloud 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 directorymkdir weather-mcp-servercd weather-mcp-server

Initialize Node.js projectnpm init -y

Install MCP SDKnpm 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:

- Build your container automatically
- Deploy it to a managed service
- 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:

- Deploy Cloud Run behind a Load Balancer
- Enable [Cloud Armor security policies](https://cloud.google.com/armor)
- 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:

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

## Real-World Use Cases

Remote MCP servers on Cloud Run enable powerful scenarios:

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

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

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

Scheduled OperationsCombine 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.

---

*Source: https://www.economize.cloud/blog/build-deploy-mcp-server-google-cloud-run*