# opentakeoff-mcp Connect **your own AI agent** — Claude Code, Codex, Cursor, Claude Desktop, ChatGPT — to the OpenTakeoff app on your computer. Listed in the [MCP registry](https://registry.modelcontextprotocol.io) as `io.github.Kentucky-ai/opentakeoff`. Existing users of the open-source `opentakeoff-mcp` simply upgrade (1.0.0 follows 0.9.117). The 0.9 tool names (load_plan, measure_polygon, view_sheet, …) keep working; [MIGRATION.md](MIGRATION.md) maps each one to its 1.0 tool. - **Your own AI subscription, no charge from us.** The agent's model runs on your plan; OpenTakeoff charges nothing for that LLM, and the app never takes your AI key. - **Everything the in-app Assistant can do** — all 188 agent tools, with the app's own schemas — and **the same guards**: every call runs in the app through the Assistant's tool runner, acting for you as the add-only agent. What it draws lands as **pencil** for your review; a sheet's **scale** is yours to confirm (an agent may confirm it too with `set_scale confirm:true`, recorded as the agent's, and never over a scale you confirmed); estimate changes wait for **your approval** in the app (`awaiting_approval` with a review link); sheet references and wrong-sheet takeoffs are checked; a confirm-first tool runs only after you say yes. - **Kentucky AI** computer-vision models and the **Plan Indexer** come from your company's Kentucky AI account and update by themselves; they are billed per use to your company, as in the app. Every member may use what the company added; only someone who can add paid features adds them (on the Marketplace). ## Install 1. Open the OpenTakeoff app → **Settings → Account & AI → Connect your own AI agent** → **Connect**. The app writes `~/.opentakeoff/mcp.json` (only you can read it) with where it runs and this install's agent token, so nothing secret goes in a command. Disconnect there at any time; Replace token rotates it. 2. Add the server to your agent (Node 20+): | Client | Install | |---|---| | Claude Code | `claude mcp add --scope user opentakeoff -- npx -y opentakeoff-mcp` (`--scope user`: every folder, not only this one) | | Claude Desktop | double-click `opentakeoff-mcp.mcpb` from the latest release, or the JSON below | | Codex | `~/.codex/config.toml`: `[mcp_servers.opentakeoff]` `command = "npx"` `args = ["-y", "opentakeoff-mcp"]` | | Cursor, any stdio client | `{"mcpServers": {"opentakeoff": {"command": "npx", "args": ["-y", "opentakeoff-mcp"]}}}` | In the desktop app, **Connect Claude Desktop** does this in one click: it opens a small generated `.mcpb` that runs the copy of this server inside the app (or, if you choose, merges the entry into `claude_desktop_config.json`, backed up first). ChatGPT itself connects only to remote MCP servers (an HTTPS URL in developer mode), not to a stdio server on your computer; with a ChatGPT plan, use Codex as above. Point `command` at `npx`/`node` directly, never `npm start`: stdout is the MCP wire. The server finds the app by itself: `$OPENTAKEOFF_URL` if set, else the discovery file, else the app's usual local ports (each checked with `GET /api/mcp/hello`). A restarted app on a new port, or a token replaced in Settings, is picked up on the next call without restarting your agent. | Variable | Use | |---|---| | `OPENTAKEOFF_URL` | the app's address, when it is not found automatically (a hosted workspace) | | `OPENTAKEOFF_AGENT_TOKEN` | the token, when there is no discovery file (a hosted workspace shows it once at Connect) | | `OPENTAKEOFF_HOME` | where `mcp.json` lives (default `~/.opentakeoff`) | | `OPENTAKEOFF_KA_KEY` | a Kentucky AI Marketplace API key for the Kentucky AI tools when you cannot sign in | | `OPENTAKEOFF_MCP_STAGED_TOOLS` | `0` lists every tool at once | | `OPENTAKEOFF_KA_POLL_S` | how often the Kentucky AI catalogue is checked (default 300 s) | ## Staged tools 188 schemas is a lot of context, so tools come in four stages along the takeoff workflow: **setup** (projects, sheets, text, images, schedules, uploads and the read-only lists, plus the project's own setup writes: a sheet's scale, the project's name and info, page rotation and order, bid terms, the company library — on at start), **measure** (takeoffs, analyses, proposals, vision models), **revise** (conditions, edits, RFIs, estimate changes) and **handoff** (verification, estimates, exports). `open_tool_stage {stage}` opens one (instant, idempotent, never closes another; clients that support `tools/list_changed` see the tools appear). A call to a closed stage's tool says which stage to open. ## Resources | URI | What | |---|---| | `takeoff://wiki`, `takeoff://wiki/{page}` | workflow, guards, coordinates, Kentucky AI, generated tool index — readable with the app closed | | `takeoff://projects` | every project this install can see | | `takeoff://sheets` | the sheets of the project the last call named | | `takeoff://project/{project_id}/sheets` | a project's sheets, with whether each has a scale | | `takeoff://project/{project_id}/sheet/{sheet_id}` · `/text` · `/image` | one sheet: metadata, its text, the rendered page (PNG) | ## Local tools | Tool | What | |---|---| | `connection_status` | is the app reachable, connected, acting for whom; which Kentucky AI credential is in use (never a token) | | `upload_documents` | put plan PDFs / attachments from this computer into a project | | `open_tool_stage` | open a tool stage | | `kentucky_status`, `kentucky_sign_in`, `kentucky_sign_out` | the Kentucky AI credential; sign-in is the browser flow the app uses | | `list_kentucky_tools` | the company's Kentucky AI tools (below), with each model's price per call and page | ## Kentucky AI tools update by themselves The company's Kentucky AI tools are not built into this server: they come from its Kentucky AI account (`GET /api/ka/v1/tools`, the platform's catalogue). One tool per model in My models (`_predict`, `_job`, `_batch`), the Plan Indexer (`plan_indexer_submit`, `_status`, `_result`) once the company added it, `list_models` and `usage`, each with the platform's own description and JSON Schema. The server asks again every few minutes (`If-None-Match`; `OPENTAKEOFF_KA_POLL_S`, default 300) and sends `tools/list_changed` when the catalogue changes, so a model the company adds today is a tool in a running agent session today, without an update of this package. They are billed per use to the company, as in the app; a 402/403 says whom to ask (the company owner adds models and pays). A model tool that takes a base64 `image` also takes `sheet_image` {project_id, sheet_id, crop, px} (the app renders the sheet) or `image_path`; one that takes a `pdf` also takes `pdf_path`. A catalogue name that collides with an app tool is listed as `ka_`. Credential: a pasted Marketplace key (`OPENTAKEOFF_KA_KEY`), else the app's sign-in (through the app — the token never leaves it), else this server's own sign-in (`~/.opentakeoff/ka-account.json`, 0600). With none, no catalogue tools are listed and `list_kentucky_tools` says how to sign in. ## Safety - **safewrite**: an export saved with `save_to` overwrites only a file this server wrote (a SHA-256 ledger, plus the open-source server's PDF/DXF/JSON stamps); anything else needs `overwrite: true`. - **seed too common**: `propose_symbol_count` refuses a small seed (< 40 segments) that clears > 50 placements unless you pass `variant_guard`, `exclude` rects or a bigger seed (enforced in the app, for the Assistant too). - **scale warnings**: a proposal whose region has a scale note disagreeing with the sheet's scale comes back with `scale_warnings` (an enlarged plan measured at the sheet scale). ## Develop ```sh npm ci # in mcp/ npm test # unit tests per tool group (fake app) npm run test:e2e # stdio end-to-end against a real OTP_LOCAL app (OTP_PYTHON=) node ../evals/mcp-workflow-bench/run.mjs --out /tmp/otp-mcp-bench # known-answer workflow bench python scripts/catalog_snapshot.py # after changing backend/agent_tools.py (checked by backend tests) npm run build && npm publish dist # the published package: index.js + app/, two dependencies npm run mcpb # the Claude Desktop bundle in dist-mcpb/ ``` `mcp/package.json` also carries the dependencies of the backend's JavaScript engines (`mcp/scripts/*`, installed in the Docker image); the staged `dist/` package lists only `@modelcontextprotocol/sdk` and `pdf-lib`. Publishing from `mcp/` itself is refused. ## Changes See [CHANGELOG.md](CHANGELOG.md).