MCP Server
Daintree's local Model Context Protocol server: enabling it, per-client connect config, workspace binding, the API key, the three tiers (the Core and Full in-app tool sets and the external tier), agent panes, and the audit log.
What the MCP server is
Daintree runs a local Model Context Protocol server, and it inverts the usual relationship. Most MCP servers are tools your agent connects to. Here Daintree is the server. An external client (Claude Code, Codex, or anything that speaks Streamable HTTP) connects to it on 127.0.0.1 and drives the running habitat: launching agents into worktrees, creating worktrees from recipes, prompting agents and waiting for their replies, cleaning up what it created. Daintree's own assistant connects to the same server through internal sessions, and so can the agents Daintree launches in a project's worktrees, when that project turns on Agent integrations.
The selection rule for the external surface follows from that inversion: keep what only Daintree can do, and drop what the caller can already do for itself. Git plumbing, forge work, file reads and project queries are the caller's job, in its own shell. Worktree lifecycle, recipe execution, agent orchestration and live habitat context have no shell equivalent, so those are what the server exposes.
The server is loopback-only, opt-in, and disabled by default. In a window on a remote host, agents use the host's server on its loopback. The default port is 45454. The primary transport is Streamable HTTP at /mcp. A legacy SSE endpoint at /sse still answers for in-app and older callers, but it was deprecated by the MCP spec in revision 2025-03-26 and clients vary in whether they attach the auth header to its separate POST leg: no external client should be pointed at it.
Plugin agent tools share the port under their own /mcp/plugin/ routes, with per-plugin credentials and their own access setting; the tiers on this page never reach them. See Plugin MCP tools.
Enable the server
Open Settings (Command-, Control-, Control-, ) and switch to the MCP server tab. Turn on Enable MCP server. Turning on the Daintree Assistant's Daintree control also turns the server on, because the assistant reaches Daintree only through it; while that is on, the switch carries the badge Kept alive by Daintree Assistant.
The server reports one of four runtime states: disabled, starting, ready, or failed. Directly under the switch, a status line reads Server is starting…, Running on port with the exact URL a client should use, or MCP server failed to start with the last error. Below that sit two lists you can expand: External clients, the API-key clients currently connected, and Internal connections, Daintree's own assistant sessions with their session and request counts.
The rest of the tab is three sections: Connection (the client picker, the client config, Port and API key), Audit log, and Turn outcomes.
The Port row takes any port from 1024 to 65535 and defaults to 45454. If that port is taken, Daintree tries the next ten in sequence (up to 45464 for the default) and says which one it used. The URL in the status line always reflects the port that was actually bound, so re-copying the config after a fallback is enough to fix a stale client.
Turning the server off while external clients are connected asks first: Stop MCP server? lists them, and Stop sharing disconnects them while Keep running backs out.
Connect a client
The Connection section has a Client picker with three options. Pick the client you are connecting and press Copy MCP config: the snippet arrives in that client's own format. The URL displayed on the tab and the URL inside the copied snippet come from one computation, so the two cannot drift.
| Client | Format | Where it goes |
|---|---|---|
| Claude Code | JSON | .mcp.json in your project, or ~/.claude.json for every project |
| Codex | TOML | ~/.codex/config.toml |
| Other client | Plain transport details | Entered by hand in any Streamable HTTP client |
The Claude Code snippet is the shape claude mcp add --transport http … --header writes:
{
"mcpServers": {
"daintree": {
"type": "http",
"url": "http://127.0.0.1:45454/mcp",
"headers": {
"Authorization": "Bearer daintree_<your-key>"
}
}
}
} The Codex snippet uses a literal http_headers table rather than an environment variable, because Daintree cannot reach an external Codex process's environment, and rotating the key from this tab would strand an exported variable:
[mcp_servers.daintree]
url = "http://127.0.0.1:45454/mcp"
http_headers = { Authorization = "Bearer daintree_<your-key>" } Other client copies the transport-level truth instead of a config file, for clients whose config schema Daintree has not verified:
Transport: Streamable HTTP
URL: http://127.0.0.1:45454/mcp
Header: Authorization: Bearer daintree_<your-key> Cursor's and VS Code's config schemas are deliberately not claimed as verified here. If you are connecting one of those, use the Other client values and enter them in whatever form that client expects.
In a window on a remote host, the tab shows the host's server but not its key, so copy the config on the host itself.
Connected external clients appear under External clients, keyed by a hash of the bearer token and labelled with the client's user agent, the last four characters of its key, its request count and when it was last active. Each row has a Disconnect button that ends all sessions using that bearer. Clients sharing the copied global key are disconnected together. The key itself is unchanged, so they can authenticate again; rotate it to revoke their old credential.
Scoping a client to one workspace
When a project is open, Copy config for this project sits beside Copy MCP config and adds one header: Daintree-Workspace-Id. The plain config follows focus, landing every call in whichever Daintree window you focused last. The scoped one binds, so every call routes to that workspace whichever window is in front, and two agents driving two projects cannot retarget each other. A client that needs another workspace's id can look it up with workspace.list, which lists every project and scratch workspace Daintree knows, open or not.
Clients that cannot set an extra header can use the workspaceId query parameter on the MCP URL. When both are supplied they must agree; blank, repeated, or conflicting selectors are rejected. Binding works only on /mcp: a selector sent to /sse is refused rather than silently ignored.
A binding is fixed at the handshake and immutable for the session's life; to target another workspace, start a new session, and a workspace id arriving later that disagrees with it is refused rather than ignored. Only external API-key sessions bind with this header. An agent pane Daintree launched is bound to the workspace it launched in without one, and the assistant's own sessions are pinned to the window that started them.
An unreachable workspace is not a handshake failure. If the bound workspace has no window open, or is open in two, the handshake completes on the id alone. Calls that need the project's view then fail with a retriable SESSION_BINDING_GONE naming it, rather than being routed elsewhere. No client SDK retries a failed initialize, so refusing there would cost the client its Daintree tools for the whole session.
Background workspace limits
A bound session can address a project you are not looking at without switching your foreground project, and some calls work even when that project has no open view at all: the idle waits, skills.search and skills.load, mcp.surface, terminal.readLastMessageOwned, and terminal.getStatus when it names its terminals with terminalIds (answered from the terminal host, with the fields it cannot observe listed in unavailableFields). Everything else needs the view and fails with SESSION_BINDING_GONE until the project is open again.
A bound session can read its own state from the daintree://workspace/current/binding resource: whether the bound workspace has a live view, when eviction last took one, and whether you asked to keep it resident. It can subscribe to be told when that changes. Views stay protected from eviction while a request is in flight, but a quiet bound session holds nothing; turn on Keep workspace resident in Settings > Project > General > Agent integrations to prefer keeping a project loaded for an orchestrator. Low memory can still unload it.
Workspace-bound external sessions cannot request host confirmation: confirm-gated operations are withheld from discovery and refused at dispatch, even if you subsequently focus that project, because nobody may be watching the bound view when the dialog would appear. For work that needs approval, use the app directly or a separate unbound client session while the intended project is focused.
See the selector validation, dispatch and confirmation policy, and in-flight view protection for the precise contract.
API key and the trust boundary
Daintree generates an API key on the first server start, in the format daintree_<32-hex>. It is stored in the app's electron-store and survives restarts. The API key row shows it masked, with a button to reveal it and Copy. The server validates incoming bearer tokens by comparing precomputed SHA-256 hashes with crypto.timingSafeEqual. A missing or wrong token returns 401 Unauthorized with WWW-Authenticate: Bearer realm="Daintree MCP" and, while audit capture is on, writes a pre-auth audit record (repeats within a second are folded into one record with a count). A 401 is never attributed to a session, so it does not count toward the abuse policy: an unauthenticated caller cannot revoke someone else's session by naming it.
To rotate, use Rotate key… on the Rotate API key row and confirm. Rotation invalidates every external client holding the previous key at once, so re-copy the config into each one afterwards.
On top of the loopback bind, the transport enforces DNS-rebinding protection: Host must be 127.0.0.1:<port> or localhost:<port>. Origin is optional; when present, it must be http://127.0.0.1:<port> or http://localhost:<port>. Other values are refused, and so is a request that repeats Authorization, Host, Origin, Mcp-Session-Id or the workspace header. These checks supplement authentication; localhost is not isolation from other programs running as your user.
Authorization tiers
Every session resolves to exactly one of three tiers. Two are the in-app tool sets, Core and Full, used by the Daintree Assistant and by agent panes a project connects to the server; the third is for external API-key clients.
| Tier | Who gets it | What it grants |
|---|---|---|
core | The Daintree Assistant's default, a project's agent panes when the project is set to Core, and the fallback baseline for any in-app session | Orchestration: create worktrees and wait on them, launch and prompt agents, read, wait on, interrupt and close terminals, and delete worktrees (with confirmation). |
full | Opt-in, per assistant or per project | Core plus recipes and workflows, project checks, forge and git reads, CopyTree, worktree resources, plain terminals, skills, diagnostics and the plugin-authoring loop. |
external | API-key bearers | A separately curated allowlist of orchestration tools. A peer of the tool sets, not a rung above full: a test keeps it from reaching past what an agent pane at Full can call. |
The exact tool lists for all three, and how they differ between the assistant and an agent pane, are on Tool surface and budgets.
Git and forge writes, file reads, UI navigation and layout, settings reads and writes, screenshot capture, fleet arming and bulk kills are on no tier. They were removed from MCP in 0.39, when Core and Full replaced the old three-rung ladder. Older saved settings read in place: workbench and action as core, system as full.
How each kind of session lands in a tier, how a session widens, when Daintree asks before acting, and the boundaries that exist only over MCP are on Authorization & Approval.
Agent panes
A project's Agent integrations setting (Settings > Project > General) decides whether the agents Daintree launches in that project's worktrees get the server: Off (the default for new projects), Core or Full. At Core, a call to a Full tool asks you instead of failing. A pane types into, interrupts, closes and deletes only what it created or was handed with Hand to orchestrator, and keeps that ownership across reconnects. See Agent panes for the details.
Audit log
Every dispatch writes a record to a ring buffer while Capture audit log is on (the default). Records kept caps it at 500 entries by default, configurable between 50 and 10,000. Records carry the tool id, session, tier, a redacted argument summary, the result, a severity and a duration, plus fields such as errorCode, confirmationDecision, authorization and turnId where they apply. Grant lifecycle events share the buffer and carry a discriminator so they can be filtered apart. The log outlives the server: turning MCP off does not hide what already happened.
The viewer filters by tool id, by text in the arguments, by result and by time range (the last 5 minutes, hour or 24 hours). Show unauthorized jumps to tier rejections, and Group by turn gathers an assistant turn's calls under its outcome. Below the list are Refresh, Copy all as JSON (Copy shown as JSON while a filter is active), Export as NDJSON, and Clear audit log…, which asks before it deletes.
After at least 50 records, the viewer flags latency drift, failure clusters, cross-tool p95 outliers and first-seen tool and tier combinations, in a banner above the list and on the rows concerned. Treat these as diagnostic signals, not proof that an action was unsafe.
A second copy of the viewer sits on Settings > Daintree Assistant, under Privacy > Advanced diagnostics. That copy deliberately drops external-tier records: it is there to account for what the in-app assistant did, so it never shows external client traffic. It adds a per-tool latency table, with n, p50 and p95 columns and a separate row per outcome. The speed band is tagged against the p95 alone: Instant under 200 ms, Fast under 1000 ms, Standard up to 5000 ms, Slow beyond that. A p95 of zero carries no band. Read the MCP server tab's own Audit log section for external traffic.
Turn outcome diagnostics
When an assistant session moves from active to passive, Daintree classifies the turn against a priority waterfall of eleven outcomes: answered, hedged, refused, no docs found, tier rejected, MCP not ready, agent stuck, tool error, resume stale, reasoning loop, and unknown. Every tool call inside the turn carries the same turn id, so the audit log can be filtered or grouped per turn. The Turn outcomes section shows how each turn ended and which tools the sessions behind those outcomes used; a tool listed against an outcome was used in that session, which does not mean it caused it.
The two worth acting on are tier rejected, which means a tier or grant denial ended the turn and the assistant probably needs a wider tool set, and reasoning loop, which fires when the same tool and argument summary repeat three or more times inside one turn.
Runtime state, restart and the abuse cap
If the HTTP server closes unexpectedly, a supervisor restarts it with exponential backoff: a 500 ms base, a 2× multiplier, capped at 15 seconds, with ±250 ms of jitter per attempt. Thirty seconds of stable uptime resets the counter. After five consecutive failures the supervisor parks the server in failed and shows the last error under the switch.
Sessions that go 30 minutes without activity are reaped, which revokes their grants with reason session-ended. The next call re-authenticates and mints a fresh session; most clients reconnect without you noticing. An idle /sse stream carries a heartbeat comment every 15 seconds, so a client's own body timeout does not cut it first; the heartbeat does not count as activity for the 30-minute timer.
There is also an abuse policy, off by default and with no control in Settings. When it is on (and audit capture is on), the server counts tier-mismatch denials per session in a 60-second window. Five denials revokes the session and notifies the renderer; an assistant session shows Session ended with Start new session. Reconnecting mints a fresh one: it is a brake on a misconfigured or looping client, not a lockout.
Troubleshooting
- 401 with a config you just copied. Some clients drop or misplace the
Authorizationheader on Streamable HTTP. Re-copy the snippet for your specific client from the picker rather than adapting another client's. Check the key has not been rotated since you pasted it. TIER_NOT_PERMITTED. The tool exists but this session's tier does not reach it. For the assistant, switch the Tool set to Full in Settings > Daintree Assistant > Security and start a new session, or allow the tool from the banner. For an agent pane, the call asks you instead, unless the tool is above Full or reserved to the assistant. For an external client, the tool is off the curated allowlist and nothing widens it. Do that work in the caller's own shell instead.USER_REJECTED. You declined the confirmation, or closed the dialog. Nothing ran.RESOURCE_NOT_OWNED. An*Ownedtool was pointed at something the session did not create. An API-key client owns only what it created in the current MCP session; to keep ownership across reconnects, run the orchestrator as an agent pane with Agent integrations on.- An agent pane has no Daintree tools. Check that the MCP server is on and the project's Agent integrations is not Off, then relaunch the agent: the setting applies to newly launched agents.
- Connection refused, or a 404. Daintree may have bound a fallback port. Read the URL from the status line and re-copy the config.
- Wrong transport. Point external clients at
/mcp./sseis legacy and its header handling across clients is unreliable. - A confirm-gated call refused with
CONFIRMATION_REQUIRED. No Daintree window was open to show the dialog. Open the app and retry. SESSION_BINDING_GONE. A scoped client whose workspace has no reachable view, or an ambiguous route. Reopen the project, or close the duplicate window, and retry; nothing client-side changes. Status for named terminals can still be read meanwhile.- Loopback rejected. The transport requires an allowed loopback
Hostand validatesOriginwhen present. Proxies and container setups that rewrite them will be refused.
Related pages
- Authorization & Approval: how sessions get a tier, agent panes, widening, host confirmation and the security boundaries over MCP.
- Tool surface and budgets: the external tool roster, the Core and Full lists, the payload caps, forge over MCP, resources and prompts.
- Daintree Assistant: the in-app client that uses the Core and Full tool sets.
- Project settings: Agent integrations: the per-project tool set for agent panes.
- Security & Privacy: the process-level model this server sits inside.
- Code Forge: provider setup for the
forge.*tools. - Recipes: what
recipe.runandworktree.createWithRecipeexecute. - Plugin MCP tools: plugin-contributed MCP servers and agent tools, which are a separate surface from this one.