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.jsoncpnpm 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.tsimportingview.tsxorbitmcp/reactview.tsximportingtool.ts, Node builtins, or server modules
The server graph must not leak into the iframe bundle.
What the compiler emits
| Author file | Output |
|---|---|
tool.ts | Model-visible MCP tool |
view.tsx | Hashed ui://tools/<name>/<hash> HTML shell |
actions.ts | App-only tools with visibility: ["app"] |
preview.ts | Dev fixture catalog only, not in manifest |
resource.ts | Static MCP resource |
template.ts | Parameterized MCP resource template |
prompt.ts | MCP 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
| File | Purpose |
|---|---|
bitmcp.config.ts | Server name, version, deploy, cache TTL, auth |
package.json | Scripts that call the bitmcp CLI |
src/views.css | Optional. Extra @theme tokens or @source paths |
vercel.json | Vercel routing and build configuration |
wrangler.jsonc | Cloudflare Workers routing and build configuration |