Deployment
Vercel
Deploy your app to Vercel and verify the /mcp endpoint.
When you finish this guide, your app serves Streamable HTTP at https://your-app.vercel.app/mcp.
Complete the production checklist first.
Prerequisites
- Create a Vercel account
- Install the CLI:
npm i -g vercel - Log in:
vercel login
Prepare the app for Vercel
npx bitmcp create my-app
cd my-app
pnpm installAdd deploy: "vercel" to bitmcp.config.ts and add a vercel.json with rewrites for the MCP endpoint and server card.
Configure bitmcp.config.ts
Set allowedHosts to your Vercel hostname. Use a placeholder on the first deploy, then update after you know the URL:
import { defineConfig } from "bitmcp";
export default defineConfig({
deploy: "vercel",
http: {
path: "/mcp",
allowedHosts: ["your-app.vercel.app"],
},
});{
"buildCommand": "pnpm build",
"rewrites": [
{ "source": "/mcp", "destination": "/api/mcp" },
{ "source": "/mcp/server-card", "destination": "/api/mcp" }
]
}When OAuth is enabled, set MCP_URL to your public MCP endpoint (for example https://your-app.vercel.app/mcp). See Supabase or other auth guides.
Set secrets
Generate a production state key:
openssl rand -hex 32In the Vercel dashboard:
- Open your project → Settings → Environment Variables
- Add
BITMCP_STATE_KEYwith the generated value for Production - Add
MCP_URLwhen OAuth is enabled
Confirmations and ctx.ask require BITMCP_STATE_KEY in production. See environment variables.
Deploy
Link the project on first deploy, then ship:
vercel link
vercelVercel runs pnpm build before serving. After the first deploy, copy your *.vercel.app hostname into allowedHosts in bitmcp.config.ts and redeploy if you used a placeholder.
Verify
curl https://your-app.vercel.app/healthExpect { "ok": true }. Connect an MCP client to https://your-app.vercel.app/mcp and call a tool.
Troubleshooting
- Build fails locally — Run
pnpm buildin the project root and fix compile errors before deploying. /mcpreturns 404 — Confirmvercel.jsonrewrites/mcpto/api/mcpand thatpnpm buildcompleted.- MRTR or confirmation errors — Set
BITMCP_STATE_KEYin Vercel environment variables for Production. - Host rejected — Add your deployment hostname to
http.allowedHostsinbitmcp.config.ts.
Reference
bitmcp build writes gitignored api/mcp.js that re-exports dist/server.js. The same build also emits hashed View HTML under dist/ui/ and dist/manifest.json. See Project structure for the full output map.