Articles

Migrate a Val Town MCP server to Gregale without breaking existing clients

Move a public Streamable HTTP MCP endpoint off Val Town, compare tool schemas and results with two client versions, then switch callers.

Updated

Move the tools to a new HTTPS endpoint, verify the same tool contract on both supported client versions, then update the URLs your clients actually use. Keep the old val serving until those checks pass. This guide covers a public, stateless MCP server over Streamable HTTP.

Get the runnable compatibility checks on GitHub · Download the checks

Val Town locks redirect edits on December 10, 2026 and ends hosted execution on January 10, 2027. Treat those as two separate deadlines. If you want the old .val.run address to redirect, test the cutover before December 10. You can also skip redirects and update callers directly.

Quick start

  1. Export the val and list its callers. Save a baseline from the old MCP URL with a harmless tool call.
  2. Deploy a new endpoint on Gregale without touching the old one. MCP hosting requires Hobby or higher.
  3. Compare the tool's name, input schema, output schema and exact result across both URLs. Test with the actual clients you support. Update one caller first, then the rest.

What we verified

Two separate local instances of the Gregale Node starter returned the same catalog entry and result for the harmless add tool. The check pinned the modern SDK to 2026-07-28 without fallback and used the older SDK with 2025-11-25. Both returned text 5 and structured output {"sum":5} for {"a":2,"b":3}. Changing the saved input schema made the comparison fail. A local redirect was rejected.

We deployed the same starter to a disposable Gregale app on Scale with CLI v0.1.18-rc.390 on December 4, 2026. The deploy's per-replica protocol check qualified the replica and promoted it. Both SDK clients then returned the same schema and result from the app's stable URL as from a local copy, and the comparison passed. If the CLI reports that a candidate was not promoted, keep the old endpoint serving and do not switch callers.

We did not migrate a hosted val or exercise a Val Town redirect. The sample compares one tool, not every capability in the starter.

1. Capture the contract before moving code

Write down the exact MCP URL, including the path. Look for it in agent configs, SDK constructors, scripts and documentation. For example, mcpkit's manual external checker defaults to a Val Town URL and exposes an override. An external caller can need a URL update even if the server itself ports cleanly. This guide does not migrate that conformance server.

For each tool callers rely on, capture the name, input schema, structured output contract if declared, and one deterministic result. Use synthetic inputs and avoid tools that send messages, change data, or trigger billing. If your existing clients use resources or prompts, capture those too. OAuth, private endpoints, persistent data, sessionful servers and the older HTTP+SSE transport are out of scope. Don't change a private tool to public to follow this example.

2. Put the same tool behind the new endpoint

Start with the official-SDK Node starter and keep the old server live:

sh
git clone https://github.com/gregale-dev/mcp-server-node.git
cd mcp-server-node
git checkout 2d7a93e30de5afd429f423328742b97ad90e2550
npm ci
npm test
npm start

The local endpoint is http://127.0.0.1:8080/mcp. For your own port, copy the tool definitions and handlers into the starter, keep their schemas and result fields, and replace any Val Town-only dependencies. The starter declares /mcp, Streamable HTTP and compatibility mode in gregale-mcp.json. Leave legacy: true if you still serve the 2025 Streamable HTTP clients. This does not add support for the older HTTP+SSE transport.

The starter is public by default. Use the following command only for the harmless sample or a server you have explicitly chosen to keep public. Substitute a new app name on a Hobby-or-higher account. Use the endpoint printed by the CLI when the deploy succeeds:

sh
gregale mcp server deploy --path . --name my-mcp-migration --size small

3. Compare the old URL and the new URL

In a separate directory, clone the checks repo and run npm ci with Node.js 22 or later. The fixture expects the sample's add tool. Adapt the expected tool name, schema and result in the scripts for your server.

sh
OLD_MCP_URL='https://YOUR-OLD-SERVER.val.run/mcp'
NEW_MCP_URL='https://YOUR-NEW-SERVER.gregale.app/mcp'

npm run --silent check -- "$OLD_MCP_URL" > old.json &&
npm run --silent check -- "$NEW_MCP_URL" > new.json &&
npm run --silent compare -- old.json new.json

Use your original path in OLD_MCP_URL, even if it's /. For a local rehearsal, use two copies of the starter: node smoke.mjs ../mcp-server-node. The two SDK clients must negotiate their expected version and agree on the selected tool's schema and result per URL. The final comparison then catches differences between URLs. If your real val only supports one protocol, adapt the check to cover what you actually promise; report separately if the new endpoint adds a version.

4. Switch one caller before the rest

Point one existing client directly at the new URL and repeat its actual workflow. If the result matches, update the remaining callers and documentation. If it fails, switch that caller back while the old endpoint is still serving and resolve the difference before touching redirects.

Only consider a Val Town redirect for an old .val.run URL that callers can't all update. Turning it on immediately stops the old val from handling requests. Path and query are preserved by default; for example, forwarding an old /rpc path does not automatically map it to the new /mcp. Rehearse the exact mapping on a disposable val. Check that each client follows the redirect, keeps the POST method and sends the correct MCP headers and body. Some clients reject cross-origin redirects by default; an address-bar check doesn't tell you if tool calls will work. Keep the direct URL as the default, and don't relax authentication or redirect protections for this sample.

Questions

When does Val Town stop letting me edit redirects?

December 10, 2026. Hosted execution ends January 10, 2027. Verify direct client calls before you turn on a redirect; a redirect immediately stops traffic to the original val.

Will existing MCP clients follow a cross-origin redirect?

Not necessarily. Update the URL in the client configuration when you can. If you need a redirect, test the actual client against a disposable Val Town endpoint first.