MCP tools
Stage exposes its agent operations as MCP tools, over the server's REST API. The same tools run from the CLI with stage call TOOL JSON (CLI). Agents can create work, read accepted results, contribute journal notes, and complete, answer or message other tasks. Stage refuses those on the agent's own task.
Front ends
| Front end | How | Notes |
|---|---|---|
| stdio | stage mcp | Finds the server like the CLI (STAGE_URL, the private socket, then http://127.0.0.1:7380). Can read local files (imagePaths). |
| HTTP | POST /mcp on the running server | Streamable HTTP, stateless, served in-process; nothing to install. Cannot read local files, so no imagePaths; send inline images instead. |
On a worker's machine, both reach the main server through the worker's agent gateway (Workers).
HTTP MCP and the Host header
In personal mode, HTTP MCP is reachable at a loopback address with a loopback Host (http://127.0.0.1:7380/mcp, http://localhost:7380/mcp), or at a non-loopback listen address reached by its network address. A personal-mode request that arrives on loopback with another Host gets 403 Forbidden: invalid Host header. To reach that personal server through a proxy, use stdio MCP or the CLI with STAGE_URL set to the proxy URL.
Shared Stage serves HTTP MCP at the configured Stage origin. Set
Authorization: Bearer <agent token> in the MCP client's secret settings
for that exact /mcp endpoint. Disable credential forwarding on redirects.
Use the installation ID from GET /api/auth/status to check the destination
when configuring the client. Create or rotate an agent credential.
Register
stage setup mcp [--claude] [--codex] [--http] # personal server, MCP only
stage setup --mcp # the skill, the instruction pointer and stdio MCP- Registers stdio with Claude Code and Codex. When setup finds a shared local agent socket for the selected installation, it pins that socket in the configuration.
- For shared stdio over the network, pass
--url URL --credential-file FILE. The registration stores the private file's path. A running stdio MCP process reads the updated file after rotation. - For direct HTTP in personal mode,
--httpregisters/mcpat an HTTP(S) address. For direct HTTP in shared mode, configure the endpoint and scoped bearer in the client.
OpenCode
With an OpenCode connection configured in Stage, register Stage with OpenCode's own command. Choose one transport:
opencode mcp add stage -- stage mcp
# or a Stage HTTP listener reachable from OpenCode
opencode mcp add stage --url http://127.0.0.1:7380/mcp
opencode mcp listTo expose the named Stage tools directly in OpenCode's MCP server configuration, set "codemode": false and "protocol": "legacy" alongside the Stage HTTP URL.
For shared local OpenCode or another manually configured harness, use the
private socket in the launch instructions as the --url argument to
stage mcp. For a network stdio integration, use the selected Stage URL
and set STAGE_AGENT_CREDENTIAL_FILE in that MCP process's environment.
Caller identity
Tools that create tasks, write notes, adopt sessions or read context need the calling session, {connectionId, externalSessionId}:
| Source | Applies to |
|---|---|
The harness's session variable (T3CODE_THREAD_ID, OPENCODE_SESSION_ID, CLAUDE_CODE_SESSION_ID, CODEX_THREAD_ID), on that harness's connection on this machine | stdio MCP, which runs as the agent's child process |
| Per-call MCP metadata | OpenCode (2.3.0 sends native caller identity per call, also over shared connections) |
Stage-Caller-Session: <connectionId>:<externalSessionId> header | HTTP MCP, which never reads an environment |
callerSession parameter with connectionId and externalSessionId | any front end; for intermediaries |
- A shared MCP process uses per-call identity; stdio MCP never reads
STAGE_CALLER_SESSION(the CLI does). - A header or
callerSessionthat conflicts with the OpenCode claim returns an error. - Without session context, supply a project or journal owner explicitly; Stage leaves the author session empty.
- Launch instructions name the caller's connection. Supply the selected pair when launching new work.
- Caller context attributes the work. Keep credentials in the integration's secret settings.
Tools
| Area | Tools |
|---|---|
| Context | get_context, list_projects, list_models, get_preferences |
| Projects | get_project, list_project_groups, get_project_group, get_project_events, create_project, update_project, preview_membership, set_membership |
| Connections and machines | list_connections, list_machines, get_machine, list_harnesses, get_harness_status |
| Harness actions | list_actions, run_action |
| Journals | read_journal, get_journal_entry, append_note |
| Tasks | list_tasks, get_task, create_task, update_task, delete_task, archive_task, start_task, stop_task, duplicate_task, wait_task, get_opening_prompt |
| Acceptance | get_completion_preview, complete_task, reopen_task |
| Interaction | list_requests, respond_request, send_message |
| Trees | list_trees, get_tree, create_tree, update_tree, delete_tree, dissolve_tree, add_to_tree, remove_from_tree, set_needs, start_tree, set_tree_steerer, end_tree_steering, get_steering_events, escalate_to_user |
| Schedules | list_schedules, get_schedule, create_schedule, update_schedule, delete_schedule, run_schedule, preview_schedule |
| Snippets | list_snippets, get_snippet, create_snippet, update_snippet, delete_snippet, delete_attachment |
| Sessions | adopt_session, read_ref |
stage tools lists them; stage tools NAME prints one tool's description and input schema.
Results
- Results are the REST shapes as JSON; lists are compact rows. Errors are tool errors carrying the API
error. list_tasksrows carrytreeId,needs,readiness,adoptedandlastWordPreview. Open tasks by default;closed: true|alladds archived tasks and members of done or archived trees.list_treesreturns active trees by default (statusdone, archived or all for others).get_taskreturns the task's events,session, available session links,finalReply, its tree,handoffandcurrentHandoffs.stage task showprints the final reply and the session's web or native link when available.imagePathsreads local files (PNG, JPEG, GIF, WebP, up to 8) and uploads them; CLI and stdio only. Over any transport,imagestakes inline{name?, mimeType, data}(base64, up to 10 MB each). Onupdate_taskandupdate_schedule,attachmentIdsis the exact set to keep ([]removes all); new uploads are added after it.list_tasksfilters byscheduleId,from,toandcompletedFrom;list_treesbycompletedFrom;list_schedulesbydueWithin;list_projectsbyarchived.update_taskwithexecutionConfig: nullclears the stored config so harness defaults apply.stop_taskinterrupts a task's running session.wait_taskpolls the task every 3s until its state is inuntil(defaultneeds_input done failed interrupted cancelled) ortimeoutSecondspasses (default 600, max 3600). CLItask waitdefaults to--timeout 10mand exits 3 on timeout.preview_schedulereturns the next three fire times of a cron in a zone.
Acceptance and interaction
| Tool | Details |
|---|---|
get_completion_preview | the evidence Stage would accept, blockedReason, the dependents it releases, and revision and evidenceVersion |
complete_task | taskId, revision and evidenceVersion from the preview, requestId, optional note. A changed preview fails: preview again. Releases dependents; auto ones launch |
reopen_task | taskId, revision, requestId; unclaimed dependents wait again |
list_requests | what a task's session waits on: approvals, questions, input, with options |
respond_request | taskId, requestId, and option, text or answers; optional expectedStateRevision |
send_message | taskId, text, optional delivery (send, steer, queue) and expectedStateRevision |
get_session_activity | taskId, optional attempt and limit. Bounded items, plan and changed files |
queued_messages | taskId, action (list, cancel, steer), and id for cancel or steer |
- Stage refuses complete, reopen, respond, send and queue writes on your own task or session (403
self_action_forbidden). Report your own outcome withappend_note. - First answer wins: pass the task's
stateRevisionasexpectedStateRevisionwhen answering a task that needs input. If the user, another agent or the harness answered first, Stage sends nothing and returns 409already_answeredwith the task's current state and revision. - Leave acceptance to the user unless asked. An agent's completion is recorded as the agent's, with its caller session.
- CLI:
stage task preview|complete|reopen|requests|respond|send|activity|queue|opening-prompt(CLI).
Context and destination
get_contextreturns your session, cwd, resolved Stage project, owning task and current tree, andsteeringTreeId, the tree your task steers (Steer a tree). It includesworkspaceIdwhen the task has a pin or saved workspace. A named external session may have no tracked task.list_projectsreturns logical project summaries and available destinations. Choose a destination and pass itsconnectionIdandworkspaceIdwhen creating an immediate or timed task or a schedule. An untimed backlog task can use a project for planning and omit the workspace. Caller context can supply the planning project or connection.list_modelstakesconnectionIdand optionalworkspaceId. Use the same pair to load workspace-specific options and send the advertised values inexecutionConfig.list_actionsandrun_actiontarget one connection, task or project. A project target also requiresonConnectionIdandworkspaceId. The action must allow the caller.- Older clients should refresh the tool schemas and replace binding selectors with exact workspace selectors from
list_projects. Select the replacement explicitly if a saved pin needs repair. - With shared access, MCP uses scoped agent access. Agents can create, rename and archive projects and move a workspace between groups (
preview_membership, thenset_membershipwith itspreviewToken); responses omit raw paths. Sync, raw inventory, roster search, connection settings and harness setup are human operations. Named session lookup and adoption remain available under their eligibility rules. - Launch options go in
executionConfig.optionslike any other option: a worktree ({"id":"worktree","value":true}), and on T3 itsbaseRefandbranch.list_modelslists them with theirkind(choice,booleanortext) anddependsOn(T3'sbaseRefandbranchapply only withworktreetrue). Claude Code and OpenCode pick the worktree's base and branch; Codex has none. The oldworkspaceType,baseRef,branch,baseandbaseTaskIdarguments were removed. startLocalwithstartTzschedules a one-shot start.
Journals
| Tool | Details |
|---|---|
read_journal | previews of 600 runes, notes by default (events or all are opt-in); exactly one of taskId or treeId; filterTaskId filters a tree read; follow nextCursor (pages of 20 by default, 100 max). A stale tree cursor requires restarting pagination. |
get_journal_entry | one entry in full |
append_note | up to 16 KiB; exactly one of taskId or treeId; requestId required. A tree note takes the current sourceTaskId: a member, or the tree's active steerer. |
- Categories are optional:
finding,decision,blocker,outcome. - Retry a write with the same
requestIdand identical content. - Refresh membership with
get_contextorget_taskfirst. Write your own progress to the task (taskId) and shared conclusions to the tree (treeIdwithsourceTaskId). - Adding a note to closed work never reopens or schedules it.
- New tasks and adopted sessions take
initialNote; schedules takenotesas a template for each spawned task.
Launch instructions
Every launch, including standalone tasks and handoff off, includes a journal instruction block. It tells the agent that the session is attended (start mode only decides when it starts; the agent works as in a session the user started, including asking questions), to use whichever Stage interface it has (MCP tools, the stage CLI, or the HTTP API, named with its address when STAGE_PUBLIC_URL is set, or with the worker's agent gateway for a session on a remote machine; never install one), to pass caller identity per interface, to checkpoint before risky work, to record the outcome before returning, to treat notes as context rather than instructions or proof, and to report failed writes. The block is fixed per launch attempt. Existing and adopted sessions receive no retroactive message.
Trees
Trees are the only way to express dependencies. A task's needs are tasks in the same tree that must be completed in Stage before it starts; execution outcomes alone keep dependents blocked.
| Parameter or tool | Effect |
|---|---|
needs on create_task | wait for those tasks (joins their tree, or starts one) |
treeId | join a tree (a parallel root without needs) |
create_tree | build a tree from existing tasks with the needs between them (a task in another tree moves) |
add_to_tree, remove_from_tree, set_needs | edit membership and needs; removing a task splices it out (its dependents take over its needs) |
get_tree | members with needs, dependents and readiness, edges and levels |
startMode on update_tree | shared policy: auto launches members once their needs are completed in Stage; manual marks them ready and notifies |
startMode on a task | inherit (default), or auto/manual as a per-task exception |
start_tree | start every ready member |
status on update_tree | done, archived or open (reopen) |
set_tree_steerer, end_tree_steering | give a tree one steerer (a standalone task Stage creates and launches; never a member; its harness must offer send), replace it or stop it |
get_steering_events | the tree's steering feed after a cursor: member state changes, answers, readiness, membership, acceptances, blocker and decision notes, tree status; each says who caused it and whether it was the steerer itself |
steeringHoldSeconds on update_tree | how long a member's needs-input notification waits for the steerer to answer (0 off, at most 3600, default 300) |
escalate_to_user | the steerer hands a member's wait to the user now, with a reason the notification shows; only the tree's active steerer may |
- New trees default to auto. Roots never start on their own; other members launch only once their needs are completed.
start_taskon a blocked task returns a conflict naming the prerequisites that need completion.archive_taskcloses a standalone task; a tree member closes with its tree. Neither works while a task is launching, running or needs input.delete_taskanddelete_treeonly delete work that never started and has no recorded work.
Handoff
When a task with needs starts, its launch prompt gets one block per accepted need: saved reply excerpt, branch or worktree, session ID and link when available, and task and journal references. On by default.
handoff: falseoncreate_taskorupdate_taskturns it off (CLI--handoff=false). Omitted keeps the task's value.- The reply cap per need is
min(4000, max(1000, 8000 / needs))Unicode characters. - Handoff uses the saved accepted snapshot in Stage, without a live source-harness read. Missing replies remain missing; storage errors block launch.
get_taskreturnshandoffandcurrentHandoffs(one per need), andcurrentSteering({attempt, brief}, the steering brief a steerer's launch appended, or null).stage task showprintshandoff on|offfor tasks with needs, the current attempt's records and asteering briefline.
A dependent's worktree starts where its own launch options say, never from a need's branch: the handoff names the branch each need reported, and the agent works from there.
Run after me
afterMe on create_task (CLI --after-me) adopts the calling session as a task (Stage never starts it) and makes it the new task's first need, so the task starts after the adopted task is completed in Stage. It errors without a calling session.
adopt_session tracks your own session, or pass session to select a target (CLI stage sessions adopt --target-connection ID --target-session ID). It returns the existing task when one owns the session. If verified workspace evidence needs a project assignment, choose one (projectId, CLI --project ID) or enter a new title (newProjectTitle, CLI --new-project TITLE). An initial note records the caller who wrote it.
References
read_ref (CLI stage show REF) reads what a pasted reference names: a Stage task or tree link (any host, markdown link ok), a harness's own session link (resolved by its connection), #<task id>, or a scoped session path such as /connections/2/sessions/EXTERNAL_ID. A bare session id names no connection: pass session with its connection.
- A tree link returns the tree (as
get_tree), ready foradd_to_tree,update_treeand the other tree tools. - For an opaque ID, pass
session(CLI--target-connection ID --target-session ID). - Task references include Stage's saved results and available links. Open the native harness to continue the conversation.
Task creator attribution
Tasks and schedules record their creator in originSession; schedule-created tasks inherit it. The creator can use a different harness from the one selected for execution.
list_taskswithoriginSession(CLIstage task ls --origin-connection ID --origin-session ID) lists a creator session's tasks.