Repository navigation
Resilient MCP Broker
The bundled ignis-broker (scripts/ignis-broker.mjs) is a zero-dependency Node.js ESM MCP broker daemon that keeps context overhead minimal and prevents mid-session MCP server crashes or disconnects from breaking long /swarm workflows.
flowchart LR
AGY["Antigravity Agent\n(4 Compact Meta-Tools)"] -->|"stdio JSON-RPC"| BR["mcp-bridge\n(scripts/ignis-broker.mjs mcp-bridge)"]
CLI["Shell / Subagent CLI\n(scripts/ignis-broker.mjs)"] -->|"HTTP + Bearer Token"| DM
BR -->|"127.0.0.1 ephemeral port\nBearer Token (timingSafeEqual)"| DM["Detached ignis-broker Daemon\n(Lazy Auto-Start · Version-Safe)"]
DM -->|"Pooled stdio\n(per-workspace or shared)"| S1["Local stdio MCPs\n(e.g., memtrace, firecrawl)"]
DM -->|"Streamable HTTP / SSE"| S2["Remote HTTP MCPs\n(e.g., Linear, ItsAPlan)"]
Key design properties (see ADR-001, ADR-002, ADR-003):
-
Zero external dependencies: Pure Node.js
>= 20ESM. -
Lazy auto-start & version-safe reuse: Any MCP bridge or CLI call auto-starts the detached daemon on
127.0.0.1(ephemeral port, random Bearer token checked withcrypto.timingSafeEqual). Older in-memory bridges reuse newer same-major daemons (isDaemonVersionAcceptable) instead of killing them on plugin upgrades. -
Concurrent cold-start deduplication: Parallel calls to an idle backend share a single in-flight connection promise (
pendingConnects), and live config edits invalidate pools automatically viaconfigDigest. -
Cross-platform Windows
.cmd/.batsupport: Unwraps npm/Node.cmdshims directly toprocess.execPathwithshell: false, and hardens non-Node.cmd/.batquoting against command injection. - Cross-platform process-tree cleanup: Reaps orphaned backend trees cleanly on eviction or daemon shutdown.
Instead of injecting dozens of external MCP tool schemas into every turn, ignis-swarm_broker exposes 4 compact meta-tools:
| Meta-Tool | Parameters | Purpose |
|---|---|---|
broker_list |
{ server?, filter?, cwd? } |
Omit server to list managed servers; pass server to list compact tool summaries (optional substring filter). |
broker_describe |
{ server, tool, cwd? } |
Fetch the full JSON input schema for one tool on demand. |
broker_call |
{ server, tool, arguments?, cwd?, full? } |
Execute a tool through the resilient supervisor (auto-reconnect + local→global failover + spill-to-file truncation). |
broker_status |
{ cwd? } |
Inspect daemon version, PID, port, uptime, active workspace pools, local config errors, and recent fallbacks. |
Always pass
cwdwhen calling workspace-scoped (perWorkspace: true) servers via MCP so the broker resolves<repo>/.agents/ignis-broker.jsonand anchors the right git repository root.
Useful for shell-only subagents, troubleshooting, or administration. All 14 subcommands:
# Runtime operations
node <plugin-root>/scripts/ignis-broker.mjs status [--cwd <dir>] [--json]
node <plugin-root>/scripts/ignis-broker.mjs list [<server>] [--filter <text>] [--cwd <dir>] [--json]
node <plugin-root>/scripts/ignis-broker.mjs describe <server> <tool> [--cwd <dir>] [--json]
node <plugin-root>/scripts/ignis-broker.mjs call <server> <tool> [--args '<json>' | --args-file <file> | --stdin] [--max-bytes <n>] [--full] [--cwd <dir>] [--json]
node <plugin-root>/scripts/ignis-broker.mjs restart [<server>] [--cwd <dir>] [--json]
node <plugin-root>/scripts/ignis-broker.mjs stop
# Server discovery & registration (never modifies ~/.gemini/config/mcp_config.json)
node <plugin-root>/scripts/ignis-broker.mjs discover-mcp [--from <path>] [--json]
node <plugin-root>/scripts/ignis-broker.mjs register-mcp (--all | --servers a,b) [--from <path>] [--per-workspace a] [--cli-fallback a=cmd] [--json]
node <plugin-root>/scripts/ignis-broker.mjs add-http-mcp <name> <url> [--auth-env VAR] [--header-name Authorization] [--json]
node <plugin-root>/scripts/ignis-broker.mjs unregister-mcp <name> [--json]
node <plugin-root>/scripts/ignis-broker.mjs import-mcp [--from <path>] [--servers a,b] [--dry-run]
# Onboarding state
node <plugin-root>/scripts/ignis-broker.mjs onboarding (--get | --probe | --save '<json>' | --skip | --reset)
# Internal daemon & MCP stdio bridge entrypoints
node <plugin-root>/scripts/ignis-broker.mjs daemon [--port <n>]
node <plugin-root>/scripts/ignis-broker.mjs mcp-bridge-
Local override (checked first):
<repo-root>/.agents/ignis-broker.json(discovered walking up fromcwdto.git, stopping before your home directory). -
Global defaults (fallback):
~/.ignis-broker/servers.json(permissions0o700dir /0o600file). -
Failover: If a local override has invalid JSON or a local backend fails to connect/execute, the broker automatically falls back to the global server definition and surfaces
_meta.fallbackFrom = "local"and_meta.localError(and reports it instatusandSessionStart). Setting"enabled": falselocally disables that server for the repo without falling back.
{
"version": 1,
"defaults": {
"requestTimeoutMs": 120000,
"startupTimeoutMs": 30000,
"idleTimeoutSecs": 900,
"maxWorkspaceInstances": 4,
"maxOutputBytes": 16384,
"maxOutputLines": 200,
"spillTtlHours": 24,
"retryOnTransportError": true
},
"servers": {
"itsaplan": {
"transport": "http",
"url": "https://api.example.com/mcp",
"headers": {
"Authorization": "Bearer ${ITSAPLAN_TOKEN}"
},
"perWorkspace": false,
"enabled": true
},
"memtrace": {
"transport": "stdio",
"command": "memtrace",
"args": ["mcp"],
"perWorkspace": true,
"enabled": true
}
}
}| Key | Default | Description |
|---|---|---|
requestTimeoutMs |
120000 (2m) |
Per-tool-call timeout in milliseconds |
startupTimeoutMs |
30000 (30s) |
Backend handshake startup timeout |
idleTimeoutSecs |
900 (15m) |
Idle backend eviction timeout |
maxWorkspaceInstances |
4 |
Max pooled instances per perWorkspace: true server (LRU evicted) |
maxOutputBytes |
16384 (16 KB) |
Threshold before spilling large tool output to a file |
maxOutputLines |
200 |
Line threshold before spilling large tool output to a file |
spillTtlHours |
24 |
Retention window for spill files under ~/.ignis-broker/spill/
|
retryOnTransportError |
true |
Automatically reconnect and retry once on transport crash/EOF |
-
Secrets: Reference
${VAR_NAME}insideenv,headers, orurlinservers.jsonor.agents/ignis-broker.json. The broker expands values from~/.ignis-broker/.envfirst, then process environment variables, and redacts allenv/headersvalues in diagnostics. -
Spill-to-file truncation: When a tool output exceeds
maxOutputBytesormaxOutputLines(unlessfull: trueis passed), the broker writes the full response to~/.ignis-broker/spill/and returns a compact preview plus_meta: { truncated: true, spillPath: "..." }. Agents can inspect targeted line ranges withread_filewithout flooding their context window.
ignis-swarm v1.0.0 · Repository · ADRs · Issues · MIT License
Getting Started
Engineering Workflow
Broker & Guardrails
Reference