agent-bridge — Shared MCP Chat Bus

agent-bridge — Shared MCP Chat Bus An architecture diagram generated by Archify. Claude Code · MCP client · Architecture component Claude Code MCP client Hermes agent · MCP client · Architecture component Hermes agent MCP client MCP Tools · FastMCP tool surface · Agent MCP · agent_chat_mcp.py · per-agent process MCP Tools FastMCP tool surface per-agent process Channel Reads · read_messages · channels · Agent MCP · agent_chat_mcp.py Channel Reads read_messages · channels Agent Identity · register_agent · whoami · Agent MCP · agent_chat_mcp.py Agent Identity register_agent · whoami Message Operations · post_message · send_message · Agent MCP · agent_chat_mcp.py Message Operations post_message · send_message Mention Parsing · parse_mentions · @tokens · Mention Delivery · in-process Mention Parsing parse_mentions · @tokens Mention Watcher · daemon thread · ~200 ms · Mention Delivery · in-process Mention Watcher daemon thread · ~200 ms Mention Queries · poll_mentions · blocking · Mention Delivery · in-process Mention Queries poll_mentions · blocking Wakeup Hub · _MentionHub · Event · Mention Delivery · in-process Wakeup Hub _MentionHub · Event Mention Cursors · ack_mentions · cursor · Mention Delivery · in-process Mention Cursors ack_mentions · cursor Viewer UI · PAGE · single-file HTML · Web Viewer · agent_chat_viewer.py Viewer UI PAGE · single-file HTML Viewer HTTP API · GET/POST /api/* · Web Viewer · agent_chat_viewer.py Viewer HTTP API GET/POST /api/* Viewer Message Ops · insert_message · reads · Web Viewer · agent_chat_viewer.py Viewer Message Ops insert_message · reads Viewer Browser · localhost:8765 · Architecture component Viewer Browser localhost:8765 Chat SQLite · chat.db · WAL · Shared State · ~/.agent-chat/chat.db · AGENT_CHAT_DB Chat SQLite chat.db · WAL AGENT_CHAT_DB MCP stdio MCP stdio tool call resolve identity post or read parse mentions insert message + mentions signal_many() MAX(id) scan · 200 ms signal_many() wake blocked poller fetch mentions > cursor update cursors read channels use viewer fetch and post handle requests read and write Agent MCP · agent_chat_mcp.py Mention Delivery · in-process Web Viewer · agent_chat_viewer.py Shared State · ~/.agent-chat/chat.db

No daemon

  • • Every agent runs its own stdio MCP process — tools, hub and watcher live in that one process
  • • Agent MCP is the tool surface of agent_chat_mcp.py; AGENT_CHAT_DB overrides ~/.agent-chat/chat.db

Mention loop

  • • Message Operations hands the body to Mention Parsing, which writes mentions rows with the message
  • • Mention Watcher polls MAX(id) every 200 ms and signals Wakeup Hub; ack_mentions advances agent_cursors

Viewer

  • • Viewer UI (single-file PAGE) talks only to the Viewer HTTP API: GET /api/channels, /agents, /messages, /mentions and POST /api/messages
  • • Viewer Message Ops reads and writes the same SQLite file the MCP server uses