Skip to content

Fly.io

Fly.io hosts the MCP server. You'll create an account, install the CLI, create an app, and set the runtime secrets it needs.

  1. Install flyctl: brew install flyctl (or see fly.io/docs/flyctl/install for other methods)
  2. Log in: fly auth login
  1. Run fly apps create and choose a name (e.g. protocol-mcp) and region
  2. Note the app name - you'll use it for secrets and GitHub Actions

The MCP server reads environment variables at runtime. Set them on your Fly app:

Terminal window
fly secrets set \
DATABASE_URL='your_db_url' \
GOOGLE_CLIENT_ID='your_google_client_id' \
GOOGLE_CLIENT_SECRET='your_google_client_secret' \
MCP_SERVER_URL='https://<your-app-name>.fly.dev' \
--app <your-app-name>

fly.toml is pre-configured with min_machines_running = 1 and auto_stop_machines = 'suspend'. This keeps one machine always running so there are no cold starts - the Anthropic MCP proxy has a short connection timeout, and a suspended machine takes 5–8 seconds to wake up, causing 502 errors before the server is ready.

With a single shared-1x-512mb machine running 24/7, expect roughly $3-4/month. Use the Fly.io pricing calculator to estimate cost for your region and machine size.

Fly.io waives monthly bills under $5, so this setup is effectively free.

Generate a token for GitHub Actions to deploy on your behalf:

Terminal window
fly tokens create deploy --app <your-app-name>

Save this token - you'll add it as a GitHub Actions secret in the next section.

After creating the app, go back to your Google Cloud OAuth client and update (if needed):

  • Authorized JavaScript origins: https://<your-app-name>.fly.dev
  • Authorized redirect URIs: https://<your-app-name>.fly.dev/auth/callback

Keep localhost values too if you want to test it locally.

After completing this step you should have the next values:

KeyValueWhere to get itPurpose
FLY_API_TOKENFly.io deploy tokenfly tokens create deploy --app <your-app-name>Github secret
FLY_APP_NAMEFly.io app nameChosen during fly apps createGithub secret