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

  1. Create a Vercel account
  2. Install the CLI: npm i -g vercel
  3. Log in: vercel login

Prepare the app for Vercel

npx bitmcp create my-app
cd my-app
pnpm install

Add 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:

bitmcp.config.ts
import { defineConfig } from "bitmcp";

export default defineConfig({
  deploy: "vercel",
  http: {
    path: "/mcp",
    allowedHosts: ["your-app.vercel.app"],
  },
});
vercel.json
{
  "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 32

In the Vercel dashboard:

  1. Open your project → Settings → Environment Variables
  2. Add BITMCP_STATE_KEY with the generated value for Production
  3. Add MCP_URL when 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
vercel

Vercel 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/health

Expect { "ok": true }. Connect an MCP client to https://your-app.vercel.app/mcp and call a tool.

Troubleshooting

  • Build fails locally — Run pnpm build in the project root and fix compile errors before deploying.
  • /mcp returns 404 — Confirm vercel.json rewrites /mcp to /api/mcp and that pnpm build completed.
  • MRTR or confirmation errors — Set BITMCP_STATE_KEY in Vercel environment variables for Production.
  • Host rejected — Add your deployment hostname to http.allowedHosts in bitmcp.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.