droid-mcp is an MCP server that lets an AI assistant drive Factory Droid on your machine. You connect an MCP client to it, and the assistant can start Droid sessions, run turns, answer permission prompts, manage long-running daemon sessions, and reach the hosted Factory API and the Context API through tools.
Paste this into your coding agent:
Read https://raw.githubusercontent.com/prathamdby/droid-mcp/main/SETUP.md and follow it to set up droid-mcp on this machine. Ask me the questions it lists first.
The server exposes operations in seven families. The available operations depend on the installed providers.
| Prefix | What the tools cover |
|---|---|
daemon_ |
The long-running droid daemon: sessions, automations, worktrees, and MCP servers. |
droid_ |
Session-scoped SDK methods served by the daemon. |
session_ |
The local turn loop, prompts, and per-session administration. |
rest_ |
The hosted Factory API: computers, Environments, hosted sessions, wiki, CI, billing, organization, and service accounts. |
context_ |
The Context API on a Prem origin: spaces, documents, files, and stored session records. |
server_ |
server_info. |
skill_ |
skill_read. |
Call server_info for the active installation's operation counts, including counts by family.
By default the server runs the compact profile. tools/list advertises 16 tools:
- The turn loop as first-class tools:
server_info,skill_read,session_create,session_stream,session_events,session_interrupt,session_close,session_list, and the three prompt answers. tools_searchfinds installed operations by keyword, family, or read-only hint, andtools_describereturns the full description and input schema of up to 20 of them.tool_callruns one operation by name with its arguments. It uses the same handler, validation, autonomy cap, and{ code, message }failures as the operation's own tool in the full profile.batchruns up to 20 operations in order in one call. An argument{ "$from": "<step id>", "path": "/json/pointer" }takes part of an earlier step's result, so intermediate results never return to the client.- A result larger than
maxBytes(16 KB by default) returns a preview and aref.result_readreads the stored result by byte range or by JSON Pointer, so no data is lost. Refs expire 15 minutes after their last use and only the key that created a ref can read it.
If select fails after an operation completes, tool_call or the batch step returns invalid_select with a ref to its full result. Read that ref instead of repeating the operation. Byte offsets for result_read must fall on UTF-8 character boundaries; use nextOffset to page, or expect invalid_offset for an offset inside a character.
--profile full advertises one tool per installed operation. Tools carry MCP hints (readOnlyHint, destructiveHint, idempotentHint, openWorldHint) to help the client decide when to confirm an action.
node --experimental-strip-types scripts/measure.ts prints the initialize and tools/list sizes for both profiles.
It also serves a droid skill and a droid prompt that teach the assistant the turn loop, so you do not have to explain it yourself.
A turn works like this.
session_createstarts a Droid child process for a working directory and an autonomy level. The server rejects any autonomy level above the cap reported byserver_info. Setworktree: trueto run in a new git worktree. Ephemeral worktrees are removed on close.worktreeLifecycle: "persistent"keeps the checkout.session_streamsends the prompt. Omitdeliveryto wait up towaitMs(20 seconds by default, 300 seconds at most) and receive events.delivery: "detach"returns at once with adroid://sessions/{id}URI and no event dump.delivery: "block"holds the call until the turn ends, a prompt the client cannot answer, or 5 minutes. On the 2025 protocol revisions, a client that advertises elicitation gets that prompt as a form. A 2026-07-28 client gets the pending prompt in the result and answers with the session tools, because that revision does not allow the server to start a request.- If the turn is still running, read the session resource or call
session_eventswith the cursor it returned. The cursor is the next sequence number, one past the last event, so pass it back unchanged and events do not repeat. A client that openssubscriptions/listenfor that URI is notified when it changes. Call until the status iscompleted,failed, orinterrupted. Arunningresult keeps the session; close it when you are done.session_runcloses the session itself unless it returnsrunning, in which case poll, answer prompts, and thensession_close. - While the turn runs, prompts such as
pending_permission,pending_question, andpending_optionsappear, each with a deadline. Answer them with the matching tool, unless the client already answered a form. session_closestops the process. Sessions idle for 30 minutes are closed automatically.
- Node.js 24 or newer. The server runs its TypeScript directly with Node's type stripping, so there is no build step.
- The
droidCLI on yourPATH. - A Factory API key in
FACTORY_API_KEY. Droid itself needs this key, and so do therest_*andcontext_*tools. - pnpm, to install dependencies.
Release surface checked on 2026-11-13: Droid CLI 1.9.0
and Droid SDK 0.10.0 are current.
The SDK declares 165 wire methods and protocol 1.269.0.
CLI versions and wire protocol versions are separate.
The daemon client adopts the peer's protocol version and retries once on a mismatch.
droid_list_skills, droid_list_tools, droid_list_mcp_tools, and
droid_list_mcp_registry are not advertised. tool_call and batch return unknown_tool
with supported replacements: session_list_skills or daemon_list_skills,
session_list_tools, session_list_mcp_tools or daemon_list_mcp_tools, and
daemon_list_mcp_registry, respectively. These replacements require a session id.
tools_describe lists removed names in unknown without discarding valid descriptions.
Other methods rejected as unimplemented return daemon_method_unsupported with
the method and peer protocol version. Transport failures retain their codes;
malformed replies and schema failures remain daemon_protocol_error.
See the Factory changelog.
Follow the setup guide for prerequisites, credentials, workspace selection, and verification. pnpm start defaults to stdio. Use pnpm start --http --port 7337 for a loopback HTTP endpoint, with a bearer key supplied through DROID_MCP_KEYS. See Hosting for services and TLS.
For an HTTP client that accepts this configuration format:
{
"mcpServers": {
"droid": {
"type": "http",
"url": "http://127.0.0.1:7337/mcp",
"headers": { "Authorization": "Bearer <the key you generated>" }
}
}
}Call server_info to confirm the tool profile, installed providers, and autonomy ceiling. Call skill_read before starting a session. The setup guide describes how to verify the client can complete a turn.
If you run the server on another machine, put a TLS proxy in front of it and keep the key required. See Hosting.
Run pnpm start --help for the flags and environment variables supported by your checkout. HTTP defaults to an ephemeral port if you omit --port. Repeat --workspace-root for each approved workspace; when omitted, only the launch directory is admitted. See the setup guide for provider configuration.
- Keep the MCP keys secret. Anyone who has a key can drive Droid on the host.
- The server binds to localhost by default. Do not expose the port without TLS and a required key.
- HTTP rejects requests from an
Originother than the listener's own origin. There is no CLI origin allowlist. - The REST and Context tools redact secrets from results and errors. A minted service-account key value is never returned, and secret values sent to the organization secrets tool are never echoed back.
--max-autonomybounds localsession_createandsession_run, the permission outcomes those sessions offer, and any authority field a generated tool sends explicitly (autonomyLevel,autonomyMode,subagentAutonomyLevel, andskipPermissionsUnsafe: true).daemon_initialize_sessionanddroid_initialize_sessioncopy an omittedautonomyLevelorautonomyModefrom onedaemon_get_default_settingssnapshot onto that request. A snapshot value inside the cap is kept. A snapshot value above the cap is sent as the cap. A missing level is sent asoff, and a missing mode asnormal. When the cap is belowhigh, an omittedskipPermissionsUnsafeis sent asfalse. The snapshot is read for that request only; persistent defaults are left unchanged. Initialize has nosubagentAutonomyLevelfield.daemon_load_sessionanddroid_load_sessionsend no saved authority, and work already queued on that session can be running. Usesession_createandsession_runwhen the cap has to bound the work.daemon_initialize_sessioncopies an omittedautonomyLevel,autonomyMode, and, when--max-autonomyis belowhigh,skipPermissionsUnsafefrom onedaemon_get_default_settingssnapshot onto that request. A lower observed default is kept. A missing field becomesoff,normal, orfalse. The call does not change persistent defaults.daemon_load_sessionanddroid_load_sessionopen a saved session at the authority stored with it. List and message reads do not show that authority, anddaemon_initialize_sessionhas nosubagentAutonomyLevelfield. Use localsession_createorsession_runwhen the work must stay inside--max-autonomy.
| Command | What it does |
|---|---|
pnpm start |
Serve MCP over stdio; add --http for /mcp |
pnpm run doctor |
Probe an existing daemon; add --http to probe an HTTP listener |
pnpm typecheck |
Run tsc --noEmit |
pnpm lint |
oxlint, with the anti-slop plugin in tools/oxlint |
pnpm fmt:check |
Check formatting with oxfmt |
pnpm test |
Run every test project that needs no model |
pnpm codegen |
Regenerate the pinned Factory SDK codecs |
pnpm codegen:check |
Fail if a generated file is stale |
The unit and proofs test projects do not need a live model.
Codegen uses TypeScript 6's compiler API. TypeScript 7 replaces that API and is
not a drop-in upgrade. Node type definitions stay on the Node 24 runtime baseline.
Optional tool inputs must be omitted when unused; null is accepted only where
the schema explicitly allows it, such as clearing an Environment's setup script.
The CLI entry point lives in src/products/, alongside configuration, product assembly, and the HTTP and stdio transports. src/mcp/ owns the MCP protocol, src/presentation/ owns tool profiles and dispatch, and src/guidance/ owns the embedded skill. The generated SDK codecs live in src/factory-dialect/. See the module roster for the rest of the source tree.
MIT. See LICENSE.