Skip to main content

Overview

Deploy the MCP Server with LangGraph to Google Cloud Run for fully managed, serverless hosting on Google Cloud Platform.
Serverless GCP: Auto-scaling from 0 to 100+ instances with pay-per-use pricing.

Quick Start

One-Command Deployment

This automated script will:
  1. Enable required GCP APIs
  2. Create service account
  3. Configure Secret Manager
  4. Build Docker image
  5. Deploy to Cloud Run
  6. Output the service URL

Manual Deployment

Benefits

Serverless

Scale to zero when idle. Auto-scale to 100+ instances under load.

Pay-Per-Use

Only charged during request processing. No idle costs.

Automatic HTTPS

Free SSL certificates and automatic certificate renewal.

Secret Manager

Integrated with Google Cloud Secret Manager for secure configuration.

Fast Deployment

Deploy in 2-3 minutes with automatic rollback on failure.

Global

Deploy to regions worldwide for low latency.

Prerequisites

  1. Google Cloud account with billing enabled
  2. gcloud CLI installed: Install Guide
  3. Docker (optional, for local testing)

Configuration

Secret Manager Setup

Store API keys securely:
Or manually:

Service Configuration

Edit cloudrun/service.yaml:

Deployment

Initial Deployment

Update Deployment

Rollback

Monitoring

View Logs

Cloud Console

Access metrics in Cloud Console:
  • Request count and latency
  • CPU and memory utilization
  • Instance count over time
  • Error rates

Scaling

Configure Autoscaling

Strategies:
  • Pros: Lowest cost
  • Cons: 1-2s cold start
  • Use: Dev, low-traffic apps
  • Pros: No cold starts
  • Cons: Higher baseline cost
  • Use: Production, latency-sensitive
  • Pros: Balance cost and latency
  • Cons: Some cold starts during spikes
  • Use: Most production workloads

Security

Network Security

VPC Access

Connect to private resources:

Authentication

Cost Optimization

Estimated costs: $5-30/month for typical usage (10K requests/day)
Optimization tips:
  1. Scale to zero when idle (--min-instances 0)
  2. CPU throttling for cost savings
  3. Right-size resources (start with 1 CPU, 1Gi memory)
  4. Request bundling to reduce request count charges
  5. Caching to reduce LLM API calls

Troubleshooting

Causes:
  • Container startup timeout
  • Health check failures
  • Insufficient memory
Solutions:
Cause: Service account lacks permissionsSolution:
Solutions:
  • Use --min-instances 1 or higher
  • Enable startup CPU boost (default in service.yaml)
  • Optimize Docker image size

Complete Guide

This page provides comprehensive Cloud Run deployment instructions. For additional deployment options:

Production Checklist

Pre-deployment security and compliance checklist

Monitoring Setup

Configure observability for Cloud Run

Next Steps

Deploy Now

Follow quick start guide above

Configure Monitoring

Set up observability and alerts

Production Checklist

Pre-deployment security checklist

Compare Platforms

Choose the right deployment option

Ready to deploy? Run cd cloudrun && ./deploy.sh --setup to deploy to Google Cloud Run!