Deploy on Cloud Run (serverless) with Google Cloud Storage for files and Memcached (Memory Store) for async callback caching.
This guide covers running openapi-mcp-sdk on Google Cloud Platform.
The codebase supports GCP-specific variables for compatibility with existing deployments;
this guide documents both that approach and the recommended explicit configuration.
Internet → Cloud Run (openapi-mcp-sdk server)
│
├── Google Cloud Storage (file downloads)
└── Memorystore Memcached (async callback cache, VPC-internal)
# Core
MCP_PORT=8080
MCP_ENV=production
MCP_BASE_URL=https://mcp.example.com
MCP_CALLBACK_URL=https://mcp.example.com/callbacks
MCP_OPENAPI_ENV= # dev, test, sandbox (alias of test), or empty for production
# Storage
MCP_STORAGE_BACKEND=gcs
MCP_STORAGE_BUCKET=my-cloud-run-service # name of the GCS bucket
# Cache
MCP_CACHE_BACKEND=memcached
MCP_CACHE_HOST=10.x.x.x # Memorystore VPC-internal IP
MCP_CACHE_PORT=11211
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: mcp-openapi-com
spec:
template:
metadata:
annotations:
run.googleapis.com/vpc-access-connector: projects/MY_PROJECT/locations/REGION/connectors/MY_CONNECTOR
run.googleapis.com/vpc-access-egress: all-traffic
spec:
containers:
- image: gcr.io/MY_PROJECT/openapi-mcp-sdk:latest
ports:
- containerPort: 8080
env:
- name: MCP_PORT
value: "8080"
- name: MCP_BASE_URL
value: "https://mcp.example.com"
- name: MCP_STORAGE_BACKEND
value: "gcs"
- name: MCP_STORAGE_BUCKET
value: "mcp-openapi-com"
- name: MCP_CACHE_BACKEND
value: "memcached"
- name: MCP_CACHE_HOST
value: "10.x.x.x"# Build
gcloud builds submit --tag gcr.io/MY_PROJECT/openapi-mcp-sdk
# Deploy
gcloud run deploy mcp-openapi-com \
--image gcr.io/MY_PROJECT/openapi-mcp-sdk \
--region europe-west1 \
--platform managed \
--allow-unauthenticated \
--port 8080-
Create a bucket (name it after the service for legacy compatibility, or use any name + set
MCP_STORAGE_BUCKET):gsutil mb -l europe-west1 gs://mcp-openapi-com
-
Grant the Cloud Run service account write access:
gsutil iam ch serviceAccount:MY_SA@MY_PROJECT.iam.gserviceaccount.com:objectAdmin \ gs://mcp-openapi-com
-
Set the env vars:
MCP_STORAGE_BACKEND=gcs MCP_STORAGE_BUCKET=mcp-openapi-com
Downloaded files are stored at gs://MCP_STORAGE_BUCKET/<request_id>/<filename> and
served via the /status/{id}/files/{name} endpoint.
Memcached is used to share async callback results across multiple Cloud Run instances (which are stateless and ephemeral).
-
Create a Memorystore Memcached instance inside the same VPC.
-
Set:
MCP_CACHE_BACKEND=memcached MCP_CACHE_HOST=10.x.x.x # discovery IP from Memorystore console MCP_CACHE_PORT=11211 -
Connect Cloud Run to the VPC via a Serverless VPC Access connector so it can reach the private IP.
Tip: Redis (Memorystore for Redis) is a simpler alternative with better support for persistence. Use
MCP_CACHE_BACKEND=redisandMCP_CACHE_URL=redis://IP:6379.
Remove legacy dependency — pymemcache ties the app to a VPC-internal Memcached instance with hardcoded IPs (see memory_store.py). Replace with an in-process dict for dev and a Redis client (redis-py) for production via MCP_CACHE_URL env var.
pymemcache
Remove legacy dependency — google-cloud-storage ties file storage to GCS. Replace with a storage-agnostic solution (local filesystem for dev, pluggable via MCP_STORAGE_BACKEND env var).
google-cloud-storage
Remove legacy dependency — pymemcache is tied to the Google Cloud VPC-internal Memcached instance (hardcoded IPs X.X.X.X / X.X.X.X). Replace with an environment-agnostic cache abstraction: use a simple in-process dict for local/dev, and allow plugging in Redis (e.g. via redis-py + MCP_CACHE_URL env var) or any other backend for production.
pymemcache