Remote MCP server
A remote MCP server over streamable HTTP, behind a bearer token, at an HTTPS address your agent connects to. About $10.22 a month.
What you build
The server is stateless: each request gets a fresh MCP server, so a restart
loses nothing. The example tool, time_in, returns the time in a zone. Replace
it with yours in src/server.js.
Auth is a bearer token. That suits a server you and your own agents use. Claude's connector directory and other public clients expect OAuth; that is a separate recipe, not this one.
What Gagarin creates
| Name | Kind | Size | Holds |
|---|---|---|---|
auth | external | none | AUTH_TOKEN |
mcp | service | s | the server, at a public HTTPS address |
The commands
Run from this directory, with Docker running.
gg init mcpdemo
gg resource add mcpdemo/auth external --env-file .env.auth
gg ship mcpdemo/mcp:8080 --deps auth
gg domain add mcpdemo/mcpMake .env.auth with echo "TOKEN=$(openssl rand -hex 32)" > .env.auth and
add it to .gitignore. Gagarin publishes it as AUTH_TOKEN; the server
refuses to start with a token shorter than 32 characters.
Then connect, with the address gg domain add printed:
claude mcp add --transport http mine https://<address>/mcp --header "Authorization: Bearer <token>"What it costs
About $10.22 a month: one size-s container. The external, the address and the traffic are free. Rates: https://gagarin.cloud/pricing
What can go wrong
gg shipfails before it builds: Docker is not running.docker infosays.- Every call answers 401: the header is missing or the token differs from the
one in
.env.auth. The header isAuthorization: Bearer <token>, one space. gg logs mcpdemo/mcpsaysAUTH_TOKEN is not set: the deploy left out--deps auth. Rungg deps add mcpdemo/mcp auth.- A new token:
gg resource rotate mcpdemo/auth --env-file .env.auth. The service restarts holding it, and every client needs the new one.
Run it locally
cp .env.example .env # put a 32+ character token in it
docker compose up --buildClean up
gg destroy mcpdemoGagarin emails the project owner a button to approve the deletion.