pub fn build_forge_server(
facades: ForgeServerFacades,
families: &BTreeSet<McpFamily>,
slot: &SessionSlot,
kind: SessionKind,
) -> McpServerExpand description
Build the per-session forge MCP server. ONE McpServer named
forge carrying the coordination tool groups appropriate for the
calling session’s SessionKind:
SessionKind::Lead→ agents (all seven) + the selected families.SessionKind::Worker→ agents (the shared three) + the selected families.
families narrows the toggleable groups: only the selected ones
register. The agents core is unconditional, and systemone is
doubly gated - the family and a configured client.
review, cron, tasks, gotify and slack are any-caller, so they
register for both kinds - unlike the four lead-only agents__* verbs. What
each acts on is scoped rather than gated on session kind: a review
conversation belongs to a project and branch, crons and subscriptions to
the caller that made them, and tasks to the caller’s project. A review
nudge lands on a worker seat, so the family must be offered to workers
and the nudge must stay usable when it is withheld.
All submodules share the server name so the LLM sees a single
namespace (mcp__forge__<group>__*) and the auto-approve fast-path
in forge-sdk::control_dispatch matches every tool group with one
mcp__forge__ prefix check.
Building two separate McpServer::builder("forge") instances and
pushing both into OptionsBuilder::mcp_server would collide on
the duplicate name and the CLI would reject one - so the right
shape is to combine the (selected) tool sets into a single
builder here.
slot is the calling session’s slot. Each tool holds its own clone
of it, which is safe because a slot is stable across /new and
/resume - those swap the occupant and leave the slot alone.