Expand description
ai-crew-sync mcp proxy: a local stdio MCP server that forwards every
tool call to the remote bus as one agent in one session.
Why a proxy at all: the bus is stateless Streamable HTTP and any MCP client can talk to it directly. What a direct connection cannot do is give each conversation its own session when several windows open the same repository with the same token — a header set once in a client config is the same header in every window. A stdio server is started by the host once per conversation (that is the MCP norm, and what Claude Code and Codex do), so the process itself is the unit of isolation: it mints the session label, sends it on every forwarded request, and keeps the project/role metadata for exactly that window.
The proxy is host-agnostic. What a host provides is used as an enrichment, never required:
- Conversation identity, in order:
--host-session/BUS_HOST_SESSION(any host that can set per-window environment),CLAUDE_CODE_SESSION_ID(Claude Code exports it to MCP server processes; trusted only once the client names itselfclaude-code, because hosts started from a Claude Code terminal inherit it),ANTIGRAVITY_CONVERSATION_ID(where an Antigravity surface exports it to MCP servers), the conversation id a request carries in_meta(antigravity.google/conversation_idfrom Antigravity,threadIdfrom Codex), and otherwise the process itself — a random id that lives as long as this instance. A known conversation id derives a stable session label, so a resumed conversation reconnects to the same session and a forked one gets a new one. - Start-of-session context goes into the
initializeresult’sinstructions, which every MCP client hands to the model. No hook needed. - Presence is kept by the proxy itself: a heartbeat on connect (with
repo and branch read from the project directory), a periodic
keep-alive,
idleon exit.
Two local tools, configure_session and session_status, never reach the
remote server’s catalogue. They change metadata (project, role, channel)
and, within the same team, the profile; a team change needs a new
conversation, because switching credentials cannot erase what this
conversation has already seen. Every profile change is verified with
whoami before it is committed, in-flight calls to the old context are
cancelled rather than replayed, and claims or locks held by the old
identity are reported, never transferred.
Stdout carries MCP framing only; everything else goes to stderr.
Re-exports§
pub use crate::context::session_for_host as session_for;
Structs§
- Configure
Args - Configure
Result - Empty
Args - Previous
Identity - Proxy
- Proxy
Options - Command-line shape of the proxy.
- Session
Proof - The credential this window proved itself with, when the bus issues them.
- Status
Enums§
- Binding
- Where the conversation id came from, reported by
session_status.
Constants§
- ANTIGRAVITY_
META_ KEY - The
_metakey under which Antigravity names the conversation on everytools/call. - CONFIGURE_
TOOL - SESSION_
PREFIX - Prefix of a session label the proxy mints. Opaque on purpose: the label
is an address,
project/roleare the human-facing part. - STATUS_
TOOL
Functions§
- run
- Run the proxy over stdio until the host closes the pipe.