Skip to main content

Module mcp

Module mcp 

Source
Expand description

In-process MCP server forge exposes to every spawned claude subprocess.

The single MCP server is named forge and grouped by submodule:

  • agents - every session reaches every other by its slot: list, tell, ask, whoami and handoff for any caller, plus spawn, despawn, update and capacity for a lead. Tools render as mcp__forge__agents__<name>.
  • documents - the document hand-off: a session hands the person at a client a document that opens in the client’s own viewer. Renders as mcp__forge__documents__hand_off.
  • review - the review-conversation loop (list / get / reply / resolve). Tools render as mcp__forge__review__<name>.
  • cron - the caller’s own durable crons.
  • tasks - the caller’s own project’s live task list.
  • gotify - the caller’s own Gotify subscriptions.
  • slack - the caller’s own Slack subscriptions, reads and held outbound actions.
  • settings - forge’s own configuration (index, get, set, unset), with every write held for the reader’s approval.
  • systemone - the decision tools (ask_noul, ask_choice, ask_score), injected only when [systemone] is configured and enabled.
  • voice - say: one utterance spoken aloud to the person listening to the seat. Renders as mcp__forge__voice__say.
  • vault - the Vaultwarden family: search, read with a reveal, create, update, soft-delete and restore items, compute TOTP codes, move attachments, and manage folders. Every call is held for the reader’s approval. Renders as mcp__forge__vault__<name>.

Tool surface depends on the calling session’s kind:

  • Lead sessions (project leads, including project sessions another agent spawned) see all eight agents__* verbs. A lead is the only role that can spawn, despawn, update or read capacity, because each of those acts on the caller’s own project.
  • Worker sessions see the four shared verbs and none of the lead-only ones. The reach is the same: a worker may address any other session by its slot, its own lead and siblings included. A handoff is shared because a seat is its own to hand over.

Future submodules slot in alongside these (e.g. worktree, memory) without changing the server name or the auto-approve fast-path in forge-sdk::control_dispatch (which matches the mcp__forge__ prefix at the tool-name level).

Re-exports§

use std::collections::BTreeSet; 🔒
use std::sync::Arc; 🔒
use forge_sdk::mcp::server::McpServer; 🔒
use forge_sdk::mcp::server::McpServerBuilder; 🔒
use crate::SessionSlot; 🔒
use crate::mcp::agents::facade::AgentDispatcher; 🔒
use crate::mcp::browser::facade::BrowserFacade; 🔒
use crate::mcp::cron::facade::CronFacade; 🔒
use crate::mcp::documents::facade::DocumentFacade; 🔒
use crate::mcp::gotify::facade::GotifyFacade; 🔒
use crate::mcp::peers::facade::WorkspaceFacade; 🔒
use crate::mcp::review::facade::ReviewFacade; 🔒
use crate::mcp::settings::facade::SettingsFacade; 🔒
use crate::mcp::slack::facade::SlackFacade; 🔒
use crate::mcp::systemone::facade::SystemOneFacade; 🔒
use crate::mcp::tasks::facade::TasksFacade; 🔒
use crate::mcp::vault::facade::VaultFacade; 🔒
use crate::mcp::workers::facade::WorkerFacade; 🔒

Modules§

agents
The agents__* family - one address space for every forge session.
browser
The browser family: the core @playwright/mcp tools, forwarded to the server’s browser fleet.
caller_context 🔒
Shared “who’s calling, and what’s their project context?” helper consumed by both the cross-project and the in-project facades.
cron
Cron MCP - durable scheduled prompts (mcp__forge__cron__*).
deleted 🔒
The record-echo envelope the delete-shaped tool results answer with.
documents
The document hand-off family: one tool a session calls to hand the person at a client a document - markdown, a PDF or plain text - which opens in the client’s own viewer rather than in the conversation.
gotify
Gotify MCP - subscribe to + read from external notifications (mcp__forge__gotify__*).
peers
The cross-project engine the agents__* family drives: the narrow workspace-state surface its cross-project calls need, plus the wire types it shares with the in-project engine.
review
Review-conversation tools (Phase 2).
settings
Settings MCP - forge’s configuration, read and edited through the same catalogue and writer the settings page uses (mcp__forge__settings__*).
slack
Slack MCP - read the conversations the caller’s workspace offers (mcp__forge__slack__*).
systemone
System One MCP - ask the configured decision model one typed question (mcp__forge__systemone__*).
tasks
Task MCP - the project’s live task list (mcp__forge__tasks__*).
terminal
The terminal family: the seat’s own terminal, driven by bytes and keys.
vault
Vault MCP - the Vaultwarden family (mcp__forge__vault__*).
voice
Voice MCP - speak one utterance to the person listening to this seat (mcp__forge__voice__say).
workers
The in-project engine the agents__* family drives: the workers facade, its shared types, and the spawn / despawn / update lifecycle behind them.

Structs§

ForgeServerFacades
The facades one session’s server is composed from: the agents pair plus one per toggleable family.

Enums§

McpFamily
The toggleable MCP families. agents is always on and is not here: a worker without tell/ask cannot report to its lead.
SessionKind
Identifies which kind of session the MCP server is being built for. Drives the tool-surface filter in build_forge_server.

Constants§

TASK_BOARD_INSTRUCTIONS 🔒
What every session is told about the board at session start, through the protocol’s instructions field - the channel that reaches the model without a tool call. Claude Code truncates it at 2048 characters, so the critical half leads; the shipped-text gate (rule 17) covers the wording.

Functions§

build_forge_server
Build the per-session forge MCP server. ONE McpServer named forge carrying the coordination tool groups appropriate for the calling session’s SessionKind:
canonical_mcp_families 🔒
The canonical stored form of a selection: names in wire order, de-duplicated; an empty list means every family, so it is stored as None.
effective_mcp_families 🔒
The effective set: the stored selection resolved, then narrowed by what this forge’s config can actually inject - the same gates the build applies, so the prompt’s withheld lines cannot drift from the tools the session really gets. [systemone] and [tts] off are the config gates that remove a family outright.
resolve_mcp_families 🔒
A stored selection’s resolved set: absent or empty means every family; names are canonicalised into wire order and de-duplicated. Unknown names cannot be written by either tool (both validate), but a hand-edited row could carry one - it is dropped loudly rather than widening or narrowing the surface silently.
withheld_family_lines 🔒
The lines a worker’s prompt carries for the families it was NOT given: one per withheld family, in wire order. All families selected means no lines. This wording ships as the worker’s own instruction (rule 17), so it says what is absent and what to do instead.