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 toolsThe 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.tsare namespaced as<folder>.<export>(forecast.refresh,hello.shout).
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"] |
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 optionspackage.json: scripts that call thebitmcpCLIvercel.json: written by--deploy vercelwrangler.jsonc: written by--deploy cloudflare
Examples in this repo
examples/dashboard— View + structured result + refresh actionexamples/confirm— MRTR confirmation gateexamples/task— handle returned immediately, View polls status