Getting Started

Project structure

Add tool folders and see what pnpm build emits.

Each tool lives under src/tools/<name>/. The compiler discovers folders that contain tool.ts, tool.tsx, or index.ts.

Folder to output

src/
  tools/hello/
    tool.ts
    view.tsx
    actions.ts
    preview.ts
  resources/inbox/
    resource.ts
  prompts/triage/
    prompt.ts

dist/
  server.js
  ui/
  manifest.json

Platform files (when configured for a host):
  vercel.json
  wrangler.jsonc

pnpm build emits dist/server.js, hashed View HTML under dist/ui/, and dist/manifest.json. The same dist/server.js runs on Node, Vercel, and Cloudflare.

Resources and prompts use sibling trees under src/resources/ and src/prompts/. See Resources and Prompts.

Add a tool folder

src/tools/hello/
  tool.ts       model-visible tool
  view.tsx      React View compiled to ui:// HTML
  actions.ts    optional app-only backing tools
  preview.ts    dev-only fixture input (never shipped)

The tool name defaults to the folder name (hello, get-forecast, delete-rows). Actions in actions.ts are namespaced as <folder>.<export> (get-forecast.refresh, get-posts.refresh).

Reference

Compiler boundaries

These imports fail the build:

  • tool.ts importing view.tsx or bitmcp/react
  • view.tsx importing tool.ts, Node builtins, or server modules

The server graph must not leak into the iframe bundle.

What the compiler emits

Author fileOutput
tool.tsModel-visible MCP tool
view.tsxHashed ui://tools/<name>/<hash> HTML shell
actions.tsApp-only tools with visibility: ["app"]
preview.tsDev fixture catalog only, not in manifest
resource.tsStatic MCP resource
template.tsParameterized MCP resource template
prompt.tsMCP prompt

Authors do not set resourceUri, structuredContent, CSP, or appInfo by hand on the happy path. .bitmcp/ holds generated View types and the Tailwind IntelliSense entry.

Config files

FilePurpose
bitmcp.config.tsServer name, version, deploy, cache TTL, auth
package.jsonScripts that call the bitmcp CLI
src/views.cssOptional. Extra @theme tokens or @source paths
vercel.jsonVercel routing and build configuration
wrangler.jsoncCloudflare Workers routing and build configuration