Reference

Package exports

Subpath imports, config fields, and programmatic createApp usage.

Subpath exports

SubpathImportUse
bitmcpdefineTool, defineConfig, createApp, resultCore runtime and CLI config
bitmcp/reactuseApp, AppShellView hooks and shell
bitmcp/serverserver card, UI envelope helpersCustom deployments
bitmcp/oauthjwtOAuthProvider, customCustom OAuth providers
bitmcp/oauth/supabasesupabase()Supabase OAuth
bitmcp/oauth/auth0auth0()Auth0 OAuth
bitmcp/oauth/better-authbetterAuth()Better Auth OAuth
bitmcp/auth/api-keyAPI key auth pluginDev HTTP gate
bitmcp/analytics/posthogposthog()Tool-call analytics
bitmcp/taskstaskResult, clientSupportsTasksOptional MCP tasks extension
bitmcp/deploydeploy adaptersCustom platform wiring
bitmcp/tsconfig/react.jsontsconfig presetApp TypeScript config

Peer dependencies: react and @modelcontextprotocol/ext-apps for bitmcp/react; posthog-node and @posthog/mcp for analytics.

defineConfig fields

FieldDescription
name, versionServer identity (defaults from package.json)
deploy"node", "vercel", or "cloudflare"
cacheTtlMsView resource cache TTL
stateKeyEnvEnv var name for MRTR state key (default built-in)
requireStateKeyForce state key in non-production
authOAuth or API key plugin
analyticsOne or more analytics plugins
serverCardDiscovery metadata or false to disable
http.pathMCP HTTP path (default /mcp)
http.allowedHostsProduction host allowlist
http.allowedOriginsOrigin allowlist
http.corsCORS configuration

Environment variables: Installation.

Programmatic API

For tests and custom servers outside the file-based compiler:

import { createApp } from "bitmcp";

const app = createApp({
  name: "my-server",
  version: "0.0.1",
  tools: [myTool],
});

await app.stdio();
await app.http({ port: 3000 });
const response = await app.fetch(request);
MethodDescription
stdio()Start stdio transport
http(options?)Start Streamable HTTP on Node
fetch(request)Web-standard handler

Load a project from disk with the same discovery rules as the CLI:

const app = await createApp.fromDir("/path/to/project");

bitmcp dev uses loadProject() and watches Views. bitmcp start runs dist/server.js when built.

Tasks extension

When the client advertises io.modelcontextprotocol/tasks, you may return:

import { taskResult } from "bitmcp/tasks";

return taskResult(taskId, data);

For most long-running work, Handles remain the recommended pattern.