Project structure

File-based tool folders, discovery rules, and compiler boundaries.

Tool folders

Each tool lives under src/tools/<name>/:

src/tools/hello/
  tool.ts       model-visible tool
  view.tsx      React View compiled to ui:// HTML
  actions.ts    optional app-only backing tools

The compiler discovers folders that contain tool.ts, tool.tsx, or index.ts.

Naming

  • The tool name defaults to the folder name (hello, forecast, delete_rows).
  • Actions in actions.ts are namespaced as <folder>.<export> (forecast.refresh, hello.shout).

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"]

Authors do not set resourceUri, structuredContent, CSP, or appInfo by hand on the happy path.

Config files

  • bitmcp.config.ts: server name, version, deploy, cache TTL, optional Vite options
  • package.json: scripts that call the bitmcp CLI
  • vercel.json: written by --deploy vercel
  • wrangler.jsonc: written by --deploy cloudflare

Examples in this repo

  • examples/dashboard — View + structured result + refresh action
  • examples/confirm — MRTR confirmation gate
  • examples/task — handle returned immediately, View polls status