Skip to content
stage

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 endHowNotes
stdiostage mcpFinds the server like the CLI (STAGE_URL, the private socket, then http://127.0.0.1:7380). Can read local files (imagePaths).
HTTPPOST /mcp on the running serverStreamable 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, --http registers /mcp at 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 list

To 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}:

SourceApplies 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 machinestdio MCP, which runs as the agent's child process
Per-call MCP metadataOpenCode (2.3.0 sends native caller identity per call, also over shared connections)
Stage-Caller-Session: <connectionId>:<externalSessionId> headerHTTP MCP, which never reads an environment
callerSession parameter with connectionId and externalSessionIdany 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 callerSession that 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

AreaTools
Contextget_context, list_projects, list_models, get_preferences
Projectsget_project, list_project_groups, get_project_group, get_project_events, create_project, update_project, preview_membership, set_membership
Connections and machineslist_connections, list_machines, get_machine, list_harnesses, get_harness_status
Harness actionslist_actions, run_action
Journalsread_journal, get_journal_entry, append_note
Taskslist_tasks, get_task, create_task, update_task, delete_task, archive_task, start_task, stop_task, duplicate_task, wait_task, get_opening_prompt
Acceptanceget_completion_preview, complete_task, reopen_task
Interactionlist_requests, respond_request, send_message
Treeslist_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
Scheduleslist_schedules, get_schedule, create_schedule, update_schedule, delete_schedule, run_schedule, preview_schedule
Snippetslist_snippets, get_snippet, create_snippet, update_snippet, delete_snippet, delete_attachment
Sessionsadopt_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_tasks rows carry treeId, needs, readiness, adopted and lastWordPreview. Open tasks by default; closed: true|all adds archived tasks and members of done or archived trees.
  • list_trees returns active trees by default (status done, archived or all for others).
  • get_task returns the task's events, session, available session links, finalReply, its tree, handoff and currentHandoffs. stage task show prints the final reply and the session's web or native link when available.
  • imagePaths reads local files (PNG, JPEG, GIF, WebP, up to 8) and uploads them; CLI and stdio only. Over any transport, images takes inline {name?, mimeType, data} (base64, up to 10 MB each). On update_task and update_schedule, attachmentIds is the exact set to keep ([] removes all); new uploads are added after it.
  • list_tasks filters by scheduleId, from, to and completedFrom; list_trees by completedFrom; list_schedules by dueWithin; list_projects by archived.
  • update_task with executionConfig: null clears the stored config so harness defaults apply.
  • stop_task interrupts a task's running session.
  • wait_task polls the task every 3s until its state is in until (default needs_input done failed interrupted cancelled) or timeoutSeconds passes (default 600, max 3600). CLI task wait defaults to --timeout 10m and exits 3 on timeout.
  • preview_schedule returns the next three fire times of a cron in a zone.

Acceptance and interaction

ToolDetails
get_completion_previewthe evidence Stage would accept, blockedReason, the dependents it releases, and revision and evidenceVersion
complete_tasktaskId, revision and evidenceVersion from the preview, requestId, optional note. A changed preview fails: preview again. Releases dependents; auto ones launch
reopen_tasktaskId, revision, requestId; unclaimed dependents wait again
list_requestswhat a task's session waits on: approvals, questions, input, with options
respond_requesttaskId, requestId, and option, text or answers; optional expectedStateRevision
send_messagetaskId, text, optional delivery (send, steer, queue) and expectedStateRevision
get_session_activitytaskId, optional attempt and limit. Bounded items, plan and changed files
queued_messagestaskId, 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 with append_note.
  • First answer wins: pass the task's stateRevision as expectedStateRevision when answering a task that needs input. If the user, another agent or the harness answered first, Stage sends nothing and returns 409 already_answered with 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_context returns your session, cwd, resolved Stage project, owning task and current tree, and steeringTreeId, the tree your task steers (Steer a tree). It includes workspaceId when the task has a pin or saved workspace. A named external session may have no tracked task.
  • list_projects returns logical project summaries and available destinations. Choose a destination and pass its connectionId and workspaceId when 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_models takes connectionId and optional workspaceId. Use the same pair to load workspace-specific options and send the advertised values in executionConfig.
  • list_actions and run_action target one connection, task or project. A project target also requires onConnectionId and workspaceId. 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, then set_membership with its previewToken); 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.options like any other option: a worktree ({"id":"worktree","value":true}), and on T3 its baseRef and branch. list_models lists them with their kind (choice, boolean or text) and dependsOn (T3's baseRef and branch apply only with worktree true). Claude Code and OpenCode pick the worktree's base and branch; Codex has none. The old workspaceType, baseRef, branch, base and baseTaskId arguments were removed.
  • startLocal with startTz schedules a one-shot start.

Journals

ToolDetails
read_journalpreviews 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_entryone entry in full
append_noteup 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 requestId and identical content.
  • Refresh membership with get_context or get_task first. Write your own progress to the task (taskId) and shared conclusions to the tree (treeId with sourceTaskId).
  • Adding a note to closed work never reopens or schedules it.
  • New tasks and adopted sessions take initialNote; schedules take notes as 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 toolEffect
needs on create_taskwait for those tasks (joins their tree, or starts one)
treeIdjoin a tree (a parallel root without needs)
create_treebuild a tree from existing tasks with the needs between them (a task in another tree moves)
add_to_tree, remove_from_tree, set_needsedit membership and needs; removing a task splices it out (its dependents take over its needs)
get_treemembers with needs, dependents and readiness, edges and levels
startMode on update_treeshared policy: auto launches members once their needs are completed in Stage; manual marks them ready and notifies
startMode on a taskinherit (default), or auto/manual as a per-task exception
start_treestart every ready member
status on update_treedone, archived or open (reopen)
set_tree_steerer, end_tree_steeringgive 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_eventsthe 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_treehow long a member's needs-input notification waits for the steerer to answer (0 off, at most 3600, default 300)
escalate_to_userthe 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_task on a blocked task returns a conflict naming the prerequisites that need completion.
  • archive_task closes a standalone task; a tree member closes with its tree. Neither works while a task is launching, running or needs input.
  • delete_task and delete_tree only 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: false on create_task or update_task turns 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_task returns handoff and currentHandoffs (one per need), and currentSteering ({attempt, brief}, the steering brief a steerer's launch appended, or null). stage task show prints handoff on|off for tasks with needs, the current attempt's records and a steering brief line.

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 for add_to_tree, update_tree and 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_tasks with originSession (CLI stage task ls --origin-connection ID --origin-session ID) lists a creator session's tasks.