Deploying¶
One script takes an empty Google Cloud project to a running hosted MCP server, and can redeploy it on every merge:
bash out/notebook/mcp/deploy/setup-gcp.sh PROJECT REGION --github OWNER/REPO
It prints the server's URL and the address to add in Claude. Every other container platform works too; see Other platforms.
The deploy files come with hosted mode and need an oryva key. A server that runs over stdio, on each person's own machine, needs no deployment.
Cloud Run in one command¶
deploy/setup-gcp.sh needs the gcloud CLI, signed in to an account that can create resources in
the project. The script:
- enables the APIs it needs and creates an Artifact Registry repository;
- creates two service accounts, one that runs the server and one that deploys it;
- creates every secret, generating the gateway secret itself;
- with a Slack app, creates the smallest Cloud SQL for Postgres instance, with a database and a user;
- builds and deploys the service with Cloud Build, and sets
ORYVA_GATEWAY_URLto the URL Cloud Run gave it; - prints that URL, the address to add in Claude, and what else to paste where.
You can run it again safely: it creates only what is missing. To see every command first, without
running any, pass --dry-run:
bash out/notebook/mcp/deploy/setup-gcp.sh my-project us-central1 --dry-run
--github OWNER/REPO also creates a Cloud Build trigger. It runs deploy/cloudbuild.yaml on every
merge to the default branch that changes the generated code. So when the GitHub Action
regenerates the server from a new spec, merging its pull request redeploys it. Connect the
repository to Cloud Build first (Cloud Build, Repositories, 1st gen), and run the script from a
clone of it.
With a Slack app, the script also reads these optional variables:
SLACK_CONFIG_TOKEN: a Slack app configuration token, from "Your App Configuration Tokens" at https://api.slack.com/apps. With it, the script creates or updates the Slack app fromslack-manifest.jsonand stores its credentials. Without it, the script says how to create the app and asks for them.ORYVA_CHAT_DB: a Postgres URL of your own, used instead of a new Cloud SQL instance.ANTHROPIC_API_KEY: forask. The script asks for it when it is not set.
The image¶
The server's Dockerfile builds an image that runs serve on $PORT, as a user without root.
$PORT is 8080 unless the platform sets it. GET /healthz answers ok for health checks. On
SIGTERM, the server finishes the requests under way and stops.
The image installs the Python SDK from the directory oryva generated it in, so you never have to
publish a private API's SDK. The build context is the nearest directory that holds both the SDK and
the server. oryva works it out from the output paths and writes it into the server's README. With
the default paths it is out/notebook:
docker build -t notebook-mcp -f out/notebook/mcp/Dockerfile out/notebook
If the config generates the MCP server without a python target, the image installs the SDK from
PyPI instead.
Other platforms¶
On any platform that runs containers:
- run the image with the variables below;
- point its health check at
/healthz; - give every instance the same
ORYVA_GATEWAY_SECRETand, with a Slack app, the sameORYVA_CHAT_DB.
| Variable | Secret | |
|---|---|---|
ORYVA_GATEWAY_SECRET |
yes | At least 32 random characters, the same on every instance. |
ORYVA_GATEWAY_URL |
no | The public URL, without a path. |
NOTEBOOK_BASE_URL |
no | The API, when it is not at its default URL. |
ORYVA_GATEWAY_CONNECT_URL |
no | With connect: the connect page, when it is not connect.url. |
SLACK_SIGNING_SECRET |
yes | Slack app: checks that requests come from Slack. |
SLACK_CLIENT_ID |
no | Slack app, with SLACK_CLIENT_SECRET: Sign in with Slack, and /slack/install. |
SLACK_CLIENT_SECRET |
yes | |
SLACK_BOT_TOKEN |
yes | Slack app: for a workspace without /slack/install. |
ORYVA_CHAT_DB |
yes | Slack app: a Postgres URL, which holds its password. |
ANTHROPIC_API_KEY |
yes | Slack app with ask: for Claude. |
ORYVA_CHAT_MODEL |
no | Slack app with ask: the Claude model. |
With a Slack feed, keep one instance running at all times, with CPU between requests. The digests
are sent from inside the server. On Cloud Run that means --min-instances 1 and
--no-cpu-throttling.
The server's own README has the same table for your API. It also has the gcloud commands to
deploy on Cloud Run by hand, with Artifact Registry, Secret Manager and Cloud SQL.