fastmcp.cli.apps_dev
Dev server for previewing FastMCPApp UIs locally.
Starts the user’s MCP server on a configurable port, then starts a lightweight
Starlette dev server that:
- Serves a Prefab-based tool picker at GET /
- Proxies /mcp to the user’s server (avoids browser CORS restrictions)
- Serves the AppBridge host page at GET /launch
Startup sequence
- Download ext-apps app-bridge.js from npm and patch its bare
@modelcontextprotocol/sdk/…imports to use concrete esm.sh URLs. - Detect the exact Zod v4 module URL that esm.sh serves for that SDK version
and build an import-map entry that redirects the broken
v4.mjs(which only re-exports{z, default}) tov4/classic/index.mjs(which correctly exports every named Zod v4 function). Import maps apply to the full module graph in the document, including cross-origin esm.sh modules. - Serve both the patched JS and the import-map JSON from the dev server.

