AI Bridge MCP

AI Bridge MCP

Enables multi-agent coordination for Claude Code and Claude.ai through file-based JSON communication, eliminating the human bottleneck of message relaying.

Category
访问服务器

README

AI Bridge MCP

MIT License

Multi-agent coordination for Claude Code. File-based. No database. No WebSocket. Just structured JSON on disk.


The Problem

You're running Claude Code in a terminal. You have Claude.ai open for strategy. Maybe a second Claude Code instance for parallel work. And you — the human — become the bottleneck:

  • Copy-pasting terminal output into Claude.ai
  • Relaying directives back: "Claude.ai says to try X"
  • Losing context when you forget to forward a message
  • No shared record of what was decided or why

Your job should be strategic oversight, not message relay.

The Solution

A shared MCP server that both agents connect to. The coding agent writes structured checkpoints. The advisory agent reads them and writes guidance back. Everything goes through files on disk — no servers, no databases, no infrastructure.

┌─────────────────────┐                          ┌─────────────────────┐
│   Advisory Agent     │                          │    Coding Agent     │
│  (Claude.ai / chat)  │                          │  (Claude Code / CLI)│
└──────────┬──────────┘                          └──────────┬──────────┘
           │                                                │
           │  write_guidance()                              │  write_checkpoint()
           │  read_checkpoints()                            │  read_guidance()
           │  read_raw_log()                                │  ack_guidance()
           ▼                                                ▼
     ┌─────────────────────────────────────────────────────────┐
     │                    BRIDGE_DIR (on disk)                  │
     │                                                         │
     │  bridge-checkpoints.jsonl    ← append-only status log   │
     │  bridge-guidance.json        ← current directive        │
     │  bridge-guidance-agent1.json ← per-agent targeting      │
     │  bridge-meta.json            ← session state            │
     │  CONSTITUTION.md             ← governance rules         │
     └─────────────────────────────────────────────────────────┘
                              ▲
                              │
                     ┌────────┴────────┐
                     │     Human       │
                     │   (overseer)    │
                     └─────────────────┘

Quick Start

1. Clone and install

git clone https://github.com/robertjorndorff-collab/ai-bridge-mcp.git
cd ai-bridge-mcp
npm install

2. Add to your project's .mcp.json

{
  "mcpServers": {
    "ai-bridge": {
      "command": "node",
      "args": ["/path/to/ai-bridge-mcp/src/index.js"],
      "env": {
        "BRIDGE_DIR": "/path/to/your-project/bridge"
      }
    }
  }
}

BRIDGE_DIR is where checkpoint and guidance files are stored. Both agents must point to the same directory.

3. Connect both agents

  • Claude Code: Picks up .mcp.json automatically from your project root
  • Claude.ai: Add as an MCP integration in settings (same server, same BRIDGE_DIR)

That's it. Both agents can now communicate through the bridge.

Environment Variables

Variable Required Default Description
BRIDGE_DIR Yes . (cwd) Directory for bridge data files
CONSTITUTION_FILE No ../CONSTITUTION.md (relative to BRIDGE_DIR) Path to your governance document

Tools

Constitution Governance

Tool Description
read_constitution Read the full governing document. Required at session start. Marks it as read in session metadata. If skipped, every tool response includes a warning.
check_section Look up a specific section by number, name, or keyword (e.g., §7.7, Red X, deploy). More efficient than re-reading the entire document.

Coding Agent Tools

Tool Description
write_checkpoint Write a structured status update: what happened, what was found, what's next, any blockers. Supports tags for filtering (deploy, test, blocker, etc.).
read_guidance Read the latest directive from the advisory agent. Call before every major action. Supports per-agent targeting via agent_id.
ack_guidance Confirm receipt of guidance. The advisory agent can verify delivery via get_bridge_status.

Advisory Agent Tools

Tool Description
read_checkpoints Read recent checkpoints. Filter by count, timestamp, tag, or agent ID. Returns clean structured data.
write_guidance Write a directive with optional questions, approved actions, and priority level (normal, urgent, blocker). Supports per-agent targeting.
read_raw_log Read the raw terminal session log with ANSI codes stripped and noise filtered. For deep investigation when checkpoints aren't enough.

Shared Tools

Tool Description
get_bridge_status Quick overview: last checkpoint, pending guidance, constitution status, per-agent guidance state.
reset_bridge Archive current session and start fresh. Preserves history in bridge-archive/.

Multi-Agent Setup

Running multiple coding agents? Each one needs a unique ID so guidance can be targeted:

AGENT_ID=agent1 claude   # Terminal 1
AGENT_ID=agent2 claude   # Terminal 2
AGENT_ID=agent3 claude   # Terminal 3

Set CLODE_AGENT_ID (or any env var your hooks use) so the bridge can route per-agent guidance to the right terminal. The advisory agent targets specific agents with:

write_guidance(target_agent: "agent1", directive: "Focus on the API refactor")
write_guidance(target_agent: "agent2", directive: "Run the test suite")

Each agent reads only its own guidance (or broadcast guidance targeted to "all").

Auto-Read Hooks

Claude Code supports hooks — shell commands that fire on specific events. Use the included hooks/bridge-hook.js to auto-inject guidance whenever the user sends a message:

Setup

  1. Copy hooks/bridge-hook.js into your project
  2. Add to .claude/settings.local.json:
{
  "hooks": {
    "UserPromptSubmit": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "node path/to/bridge-hook.js"
          }
        ]
      }
    ],
    "PreToolUse": [
      {
        "matcher": "mcp__ai-bridge__write_checkpoint",
        "hooks": [
          {
            "type": "command",
            "command": "node path/to/bridge-hook.js"
          }
        ]
      }
    ]
  }
}

See examples/settings.local.json for a complete example.

How it works

  • UserPromptSubmit: Every time the human sends a message, the hook reads the bridge for new guidance and injects it into context
  • PreToolUse: Before writing a checkpoint, the hook checks for guidance first (so the agent can incorporate it)
  • Deduplication: The hook tracks the last-seen guidance timestamp in .bridge-last-seen-{agentId} to avoid re-injecting
  • Stale detection: If the last-seen file is >1 hour old (session restart), it clears automatically

Important limitation

Hooks only fire on user action (message sent, tool called). There is no push mechanism — if the advisory agent writes guidance while the coding agent is idle, it won't be seen until the user next interacts. Mitigate this by having agents poll read_guidance() before going idle.

Constitution Enforcement

The bridge optionally enforces a governance document (any markdown file). Three levels:

  1. Soft (default) — Warning in tool responses when constitution isn't read
  2. Medium — First checkpoint must include constitution-read tag or it gets flagged
  3. Hard — Tools refuse to execute until read_constitution() is called

The constitution file is referenced by path, never copied into the bridge directory. Use check_section() to look up specific rules mid-session without re-reading the whole document.

Writing a constitution

Any markdown file works. The check_section tool searches by ## Article and ### § headers. Structure your rules with headers like:

## Article I — Chain of Command
### §1.1 Role Boundaries
...
## Article II — Code Quality
### §2.1 Error Handling
...

See AXIS PRAXIS for a real-world example used in production.

Checkpoint Protocol

The coding agent should write checkpoints at natural milestones:

Trigger Example Tags
Session start session-start, constitution-read
Plan submitted plan, needs-approval
Major finding diagnosis, evidence
Code committed commit, deploy
Build/deploy result build, deploy, success / failure
Test result test, pass / fail
Blocker or escalation blocker, needs-guidance
Session end session-end, handoff

Guidance Protocol

The advisory agent writes structured directives:

{
  "from": "Advisory Agent",
  "directive": "Refactor the auth module to use JWT instead of sessions",
  "questions": ["What's the current session storage mechanism?"],
  "approvals": ["Modify auth middleware", "Add jsonwebtoken dependency"],
  "priority": "urgent",
  "target_agent": "agent1"
}

The coding agent reads guidance before major actions, acknowledges receipt, and answers questions in its next checkpoint. The advisory agent verifies delivery via get_bridge_status.

Data Files

All stored in BRIDGE_DIR:

File Format Purpose
bridge-checkpoints.jsonl JSON Lines Append-only checkpoint log
bridge-guidance.json JSON Current broadcast guidance (overwritten each time)
bridge-guidance-{agent}.json JSON Per-agent targeted guidance
bridge-guidance-history.jsonl JSON Lines All guidance ever written
bridge-meta.json JSON Session state (counts, timestamps, ack status)
bridge-archive/ Directory Archived sessions from reset_bridge

Raw Terminal Capture (Optional)

For the read_raw_log tool, launch your coding agent with:

script -q /path/to/your-project/bridge/session.log claude

This records the full terminal session. The advisory agent can search it with grep filters, ANSI codes auto-stripped.

Why File-Based?

  • Zero infrastructure — No database, no Redis, no WebSocket server
  • Works offline — Just files on disk
  • Inspectablecat bridge-checkpoints.jsonl shows you everything
  • Portable — Point BRIDGE_DIR at any project. Works with any stack.
  • Version-controllable — Add bridge files to .gitignore or commit them for audit trails
  • Multi-agent native — Per-agent guidance files scale to any number of agents

Origin

Built at 3 AM during a session where the human spent two hours copy-pasting terminal output between Claude Code and Claude.ai. The human should oversee. The machines should talk to each other.

License

MIT


R.J. Orndorff LLC · 2026

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选