Configuration

bitmcp.config.ts, HTTP options, and environment variables.

bitmcp.config.ts

import { defineConfig } from "bitmcp";

export default defineConfig({
  name: "bitmcp-app",
  version: "0.0.1",
  deploy: "node",
  cacheTtlMs: 60_000,
  stateKeyEnv: "BITMCP_STATE_KEY",
  requireStateKey: undefined,
  http: {
    path: "/mcp",
    cors: true,
    allowedHosts: ["example.com"],
    allowedOrigins: ["https://example.com"],
  },
  vite: {
    resolve: { alias: { "@app": "./src" } },
  },
});

Name and version can also come from package.json when omitted.

requireStateKey defaults to true when NODE_ENV=production.

deploy defaults to "node". "vercel" makes bitmcp build write api/mcp.js. "cloudflare" uses dist/server.js as the Worker entry. Scaffold with create-bitmcp --deploy vercel or --deploy cloudflare so the matching vercel.json or wrangler.jsonc is created.

Environment variables

VariableDescription
BITMCP_ROOTProject root for CLI runtime
BITMCP_STATE_KEYShared HMAC key for MRTR requestState
MCP_TRANSPORTstdio or http
MCP_PORTHTTP listen port
MCP_HOSTHTTP bind host
MCP_PATHHTTP path (must match exactly, default /mcp)
NODE_ENVproduction requires a state key unless overridden

Defaults

Production HTTP listens on 127.0.0.1:3000/mcp.

Preview listens on port 8787 by default.