Harness Bridge
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Harness Bridge ask Claude Code to fix the failing auth tests in a worktree and show me the diff"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Harness Bridge
Harness Bridge is a lightweight, harness-agnostic inter-agent proxy and Model Context Protocol (MCP) server for AI coding agents. It enables CLI-based harnesses (such as Claude Code and Antigravity CLI) to interoperate seamlessly, dispatching tasks, executing code in isolated sandboxes, and collaborating across distinct machines and subscription accounts.
Harness Bridge — Proposed Final Architecture
One central broker. Local MCP adapters for agents. Lightweight native workers for execution.
Recommended Architecture • Distributed-Ready
flowchart TD
subgraph MachineA["Machine A — Orchestrator"]
ClaudeA["Claude Code CLI"]
MCPAdapterA["Local MCP Adapter\n(harness-bridge adapter)"]
ClaudeA -->|"MCP over stdio"| MCPAdapterA
end
subgraph CentralBroker["Central Infrastructure — Docker (Zero Host Mounts)"]
MCPServer["MCP Server\n(/sse · /mcp)"]
RelayBus["Relay Bus\n(SQLite WAL · Task Queue)"]
WorkerGW["Worker HTTP/SSE Gateway\n(/api/v1/workers/*)"]
Health["Health Probe\n(/health)"]
MCPServer <--> RelayBus
RelayBus <--> WorkerGW
end
subgraph MachineB["Machine B — Execution"]
WorkerB["Native Worker Runtime\n(harness-bridge worker run / service)"]
HarnessB["Antigravity CLI (agy)"]
StorageB["Local Filesystem & Auth\n(/srv/sources · /srv/data · ~/.gemini)"]
WorkerB -->|"Native subprocess"| HarnessB
HarnessB -->|"Direct access"| StorageB
end
subgraph MachineC["Machine C — Execution (Optional)"]
WorkerC["Native Worker Runtime\n(harness-bridge worker run / service)"]
HarnessC["Claude Code CLI / Other"]
WorkerC -->|"Native subprocess"| HarnessC
end
MCPAdapterA -->|"MCP over HTTP/SSE"| MCPServer
WorkerGW -->|"Server-Sent Events (Task Push)"| WorkerB
WorkerB -->|"HTTP POST (Acks / Results / Heartbeats)"| WorkerGW
WorkerGW -.->|"Server-Sent Events"| WorkerC
WorkerC -.->|"HTTP POST"| WorkerGW1. Component Responsibilities
Component | Runs Where | Responsibility |
MCP Adapter | Agent machine | Exposes broker tools to local AI agents over stdio |
MCP Server | Central Docker Broker | Exposes standard MCP tools over SSE and streamable HTTP ( |
Relay Bus | Central Docker Broker | Manages task queue, leases, sessions, and state machines |
Worker Gateway | Central Docker Broker | Real-time SSE task delivery ( |
Native Worker | Execution machine | Connects outward via SSE; executes tasks with local tools |
Harness CLI | Execution machine | Runs |
2. Communication Protocols
Connection | Protocol | Characteristics |
Claude / Agent → MCP Adapter | MCP over | Standard MCP JSON-RPC protocol; agent sees zero network complexity |
MCP Adapter → Broker | MCP over HTTP/SSE | Remote tool routing over network |
Broker → Worker | Server-Sent Events (SSE) | Event-driven push; worker holds open connection at 0% idle CPU |
Worker → Broker | HTTP POST | Task acknowledgements, progress heartbeats, and result payloads |
Worker → Harness CLI | Native subprocess execution | Direct host execution with access to local files, tools, and auth |
Note: The worker never needs to speak MCP. Agents communicate through MCP; machines communicate through the relay protocol; execution happens locally.
3. Installation Experience
Central Broker
Run the decoupled broker with zero host volume mounts:
./install.sh --docker
# or manually via Docker:
docker run -d \
--name harness-bridge \
--restart unless-stopped \
-p 8000:8000 \
-v harness-bridge-data:/home/bridge/.harness-bridge \
sukumar1210/harness-bridge:latestOrchestrator Machine (Local Agent MCP Setup)
harness-bridge setup --forceExecution Machine — Foreground
harness-bridge worker run --server http://<broker-ip>:8000Execution Machine — Persistent OS Service (Optional)
Install and manage as a native user service (systemd --user on Linux, launchd on macOS):
# Install and auto-start user service
harness-bridge worker service install --server http://<broker-ip>:8000
# Service lifecycle commands
harness-bridge worker service status
harness-bridge worker service stop
harness-bridge worker service start
harness-bridge worker service restart
harness-bridge worker service uninstall4. Architectural Invariants
01: No Docker host mounts: The broker never accesses execution-machine filesystems. It remains 100% portable and decoupled from host directories, disk structures, and UIDs.
02: No mandatory OS services: Workers can run interactively in the foreground (
harness-bridge worker run) or as managed user services (harness-bridge worker service install).03: No agent polling: SSE event-driven task push eliminates polling latency, CPU waste, and agent context exhaustion.
04: No unnecessary MCP servers: Only agent-facing machines require MCP adapters. Execution machines only run the lightweight native worker daemon.
05: Native execution: Workers have direct access to local host tools, CLIs, local repositories (
/srv/sources), datasets (/srv/data), and user credentials (~/.gemini).06: Independent scaling: Scale execution machines horizontally without modifying the broker.
5. Implementation Details
Worker Authentication & Identity: Automatic hardware- and PID-derived machine identity (
worker_id) with optional bearer tokens (HARNESS_BRIDGE_TOKEN).Sliding Leases & Heartbeats: 45-second sliding task leases with automatic heartbeats, reconnection recovery, and graceful re-queuing on worker disconnection.
Task Acknowledgement & Idempotence: Explicit task state machine transitions (
pending→leased→acknowledged→running→completed/failed).Durable State: SQLite WAL-backed relay bus retains task status and lease records across network interruptions and container restarts.
Zero Exposed Host Credentials: Host credentials and OAuth tokens remain strictly local on the execution machine.
Final Design Decision: 1 Broker + N Adapters + N Native Workers
1 Central Broker: Handles state, queueing, and MCP routing with zero host mounts.
N MCP Adapters: Provides stdio MCP interfaces to local AI agents.
N Native Workers: Executes tasks natively with local tools and credentials.
Related MCP server: native-agent-router
Features
Standard Model Context Protocol (MCP) Server: Exposes standard tools (
bridge_list_harnesses,bridge_dispatch_task,bridge_apply_diff,bridge_get_session,bridge_close_session) that any MCP-compliant agent can invoke directly.Dedicated Native Drivers: Built-in, headless drivers for Claude Code (
claude) and Antigravity CLI (agy) with conversational continuity across turns via native session resumption flags (--resume/--conversation).Workspace Sandboxing via Git Worktrees: Ephemeral git worktrees (
.worktrees/<session_id>) prevent concurrent file clobbering. Review generated diffs safely before applying them withbridge_apply_diff.Kernel Buffer & Protocol Deadlock Prevention: Asynchronous execution via
proc.communicate()wrapped with timeouts eliminates 64KB Linux pipe buffer deadlocks. All server logs route strictly tostderrto preserve clean JSON-RPC framing.Distributed Loop Protection: Injects
HARNESS_BRIDGE_TRACE_IDandHARNESS_BRIDGE_HOP_COUNTinto child processes to prevent recursive agent fork bombs.Self-Updating: Built-in
harness-bridge updatecommand syncs with GitHub Releases and updates in-place via pre-compiled.whldistribution assets.
Quick Start & Installation
One-Shot Installer (Recommended)
Bootstrap Harness Bridge in a single command. The installer automatically detects your environment, offers a choice between Docker and Local CLI, and registers the MCP server in your installed coding harnesses (Claude Code, Antigravity):
Linux & macOS:
curl -fsSL https://raw.githubusercontent.com/sukumar1210/harness-bridge/main/install.sh | bashWindows (PowerShell):
irm https://raw.githubusercontent.com/sukumar1210/harness-bridge/main/install.ps1 | iexIn interactive terminals, the installer prompts between Docker (Recommended) and Local installation. In automated or CI/CD environments, it auto-detects the runtime (or accepts --docker / --local / -y flags).
Manual Installation Options
If you prefer installing manually without running scripts:
Option 1: Docker (Central Broker — Zero Host Volume Mounts)
Pull and run the pre-built multi-architecture broker container from Docker Hub with zero host mounts:
docker run -d \
--name harness-bridge \
--restart unless-stopped \
-p 8000:8000 \
-v harness-bridge-data:/home/bridge/.harness-bridge \
sukumar1210/harness-bridge:latest
# Connect your agent harnesses to the broker
claude mcp add --transport sse -s user harness-bridge http://localhost:8000/sse
agy mcp add harness-bridge http://localhost:8000/sse
# Start the native worker on your execution machine to run tasks
harness-bridge worker run --server http://localhost:8000The central broker manages task leases, state, and queues without mounting host filesystems. Native workers connect outward via SSE and execute tasks with local tools.
See the Docker Guide for custom port mappings, Docker Compose, and production deployment options.
Option 2: Local Host CLI (pip / venv)
Install the CLI into your user environment:
# Install via pip
pip install harness-bridge
# Register into Claude Code and Antigravity (uses on-demand stdio)
harness-bridge setupOption 3: From Source (uv)
Clone the repository for local development:
git clone https://github.com/sukumar1210/harness-bridge.git
cd harness-bridge
uv sync
# Register local editable build
uv run harness-bridge setupRe-running Setup
If you reinstall Claude Code, update your Antigravity configuration, or switch between Docker and local runtimes, re-run setup at any time to repair harness registrations:
./setup.sh
# or on Windows:
.\setup.ps1
# or via CLI:
harness-bridge setupMulti-Device & Network Access
By default, local CLI installations run on-demand via standard MCP stdio (zero open ports, zero idle RAM). If you want other devices across your local network (LAN) to connect to Harness Bridge:
Via Docker: Run the container with
-p 8000:8000(exposed by default in Docker mode). Other devices on the LAN can connect tohttp://<HOST-IP>:8000/sse.Via Local Host CLI: Launch the server explicitly in network mode:
harness-bridge serve --transport unified --host 0.0.0.0 --port 8000
Manual Registration by Harness
Harness Bridge exposes a standard Model Context Protocol (MCP) server over standard I/O (stdio). You can also register it manually in any MCP-compliant harness or IDE:
1. Claude Code
Register Harness Bridge directly using the claude CLI:
claude mcp add harness-bridge -- harness-bridge serveAlternatively, add it directly to your project or user configuration (~/.claude.json):
{
"mcpServers": {
"harness-bridge": {
"command": "harness-bridge",
"args": ["serve"]
}
}
}2. Antigravity CLI (agy)
Register Harness Bridge using the agy CLI:
agy mcp add harness-bridge harness-bridge serveOr configure it in your Antigravity MCP settings (~/.gemini/antigravity-cli/mcp_config.json):
{
"mcpServers": {
"harness-bridge": {
"command": "harness-bridge",
"args": ["serve"]
}
}
}3. Cursor
In Cursor:
Navigate to Cursor Settings > Features > MCP Servers.
Click + Add New MCP Server.
Fill in:
Name:
harness-bridgeType:
commandCommand:
harness-bridge serve(or~/.local/bin/harness-bridge serveif not in global PATH)
4. Windsurf (Codeium Cascade)
Add the server configuration to ~/.codeium/windsurf/mcp_config.json:
{
"mcpServers": {
"harness-bridge": {
"command": "harness-bridge",
"args": ["serve"]
}
}
}5. Claude Desktop
Add to your claude_desktop_config.json (~/Library/Application Support/Claude/claude_desktop_config.json on macOS or %APPDATA%\Claude\claude_desktop_config.json on Windows):
{
"mcpServers": {
"harness-bridge": {
"command": "harness-bridge",
"args": ["serve"]
}
}
}6. Generic MCP Clients / Zed / Goose
Any client supporting JSON-RPC stdio transport can connect to Harness Bridge:
Executable:
harness-bridge(or$HOME/.local/bin/harness-bridge)Arguments:
["serve"]Transport:
stdio
CLI Usage
# List available harnesses on system PATH
harness-bridge list
# Check current version
harness-bridge version
# Check for updates from GitHub Releases
harness-bridge update --check
# Self-update to the latest release
harness-bridge update
# Run a one-shot task directly
harness-bridge run --target agy "Inspect README.md and explain the architecture"
# Start the MCP server manually
harness-bridge serve
# Start native worker daemon in foreground
harness-bridge worker run --server http://localhost:8000
# Install and manage persistent background worker service (systemd/launchd)
harness-bridge worker service install --server http://localhost:8000
harness-bridge worker service status
harness-bridge worker service stop
harness-bridge worker service start
# Run local MCP adapter proxying stdio to remote broker over SSE
harness-bridge adapter --server http://localhost:8000Architecture & System Internals (For Developers)
Subdirectories & System Boundaries
Python Subsystem (
harness_bridge): Core implementation including CLI, drivers, session management, workspace sandboxing, and FastMCP server.CLI (
harness_bridge/cli): Typer/Rich command-line interface and MCP stdio server launcher.Core (
harness_bridge/core): Domain exceptions, schemas, async process runner, harness configuration, and self-updater.Drivers (
harness_bridge/drivers): Headless execution adapters and registry for Claude Code and Antigravity CLI.Server (
harness_bridge/server): FastMCP stdio server exposing JSON-RPC tools for agent discovery and dispatch.Session (
harness_bridge/session): Multi-turn conversational session lifecycle, tracing, and hop limit circuit breakers.Workspace (
harness_bridge/workspace): Ephemeral git worktree sandboxing, diff extraction, and patch application.
Platform Scripts (
scripts): Zero-dependency installation scripts (install.sh,install.ps1) and commit validation tooling.Technical Design Specifications (
docs/designs): Canonical architectural RFCs and feature milestone specifications.
Architectural Invariants
Stdio Transport Protocol Purity: During
harness-bridge serve, standard output (stdout) is strictly reserved for JSON-RPC 2.0 frames. All diagnostics, progress spinners, and log messages route strictly tostderr.Subprocess Pipe Deadlock Immunity: Cross-platform process execution in
run_command_safebinds stdin toDEVNULLand reads output viaproc.communicate(), eliminating 64KB OS pipe deadlocks.Process Group Termination: Child subprocesses are spawned in detached process groups (
process_group=0on POSIX) and terminated recursively withSIGTERM/SIGKILLescalation on timeout.Workspace Sandboxing Integrity: Tasks executed under
worktreeisolation operate strictly within ephemeral.worktrees/{session_id}directories and dedicatedbridge/session-{session_id}branches, never modifying the primary working tree until explicitly merged viabridge_apply_diff.Distributed Delegation Recursion Ceiling: Inter-agent delegation propagates
HARNESS_BRIDGE_TRACE_IDand incrementsHARNESS_BRIDGE_HOP_COUNT, raisingMaxHopsExceededErrorif recursion depth reachesmax_hops(default: 10).
System Side Effects
Child Subprocess Execution: Spawns headless external AI coding harness CLIs (
claude,agy) and git processes.Repository Worktree & Branch Mutation: Creates and removes
.worktrees/{session_id}directories and mutates local git branches (bridge/session-*).Harness MCP Configuration Writes: Reads and updates configuration files across user directories (
~/.claude.json,~/.gemini/antigravity-cli/mcp_config.json,~/.gemini/config/mcp_config.json).Network Egress: Issues HTTPS requests to
api.github.comfor release checks and updates, downloading.whlassets when upgrading.
Development Verification
Run tests:
uv run pytest -v tests/Run lint & formatting:
uv run ruff check .anduv run ruff format .
Contributing
Contributions, issues, and feature requests are welcome!
Vote on upcoming roadmap capabilities or propose new ideas in our Feature Voting & Roadmap Hub or browse the Live Ideas Leaderboard.
See CONTRIBUTING.md for local development setup, git hooks (
pre-commit), testing guidelines, and PR workflow.Please review our Code of Conduct.
To report security concerns, refer to SECURITY.md.
License
MIT © Sukumar Rastogi
Available Tools
6 toolsbridge_apply_diffA
Apply the code changes generated by a worker in an isolated git worktree branch into the main repository. After applying, call bridge_close_session(session_id, cleanup_worktree=True) to clean up the temporary worktree.
Args: session_id: Session ID whose worktree branch should be applied. repo_root: Path to the target git repository (defaults to current directory).
Inputs: session_id (required), repo_root. Returns: object
bridge_cancel_sessionBDestructiveIdempotent
Cancel an active or running task session and terminate its subprocess group.
Args: session_id: Session ID to cancel.
Inputs: session_id (required). Returns: object
bridge_close_sessionBDestructiveIdempotent
Close a session and clean up temporary worktrees.
Args: session_id: Session ID to terminate. repo_root: Path to target repository. cleanup_worktree: Whether to remove the worktree folder on disk (default: True).
Inputs: session_id (required), repo_root, cleanup_worktree. Returns: object
bridge_dispatch_taskA
Dispatch a coding task or conversational turn to a target AI agent harness (e.g. 'claude' or 'agy'). Use this tool to delegate dev work (feature implementation, bug fixes, refactoring), code and security reviews, or technical exploration and architectural prototyping to another agent.
Args: harness: Target harness name ('claude', 'agy', or 'antigravity'). prompt: Task instructions or follow-up prompt. session_id: Optional existing session ID for conversational resumption. workspace_mode: Workspace isolation mode. Defaults to 'inherit' (executes directly in the same repository and directory). Set to 'worktree' when delegating risky refactors, speculative implementations, parallel experiments, or tasks requiring an isolated branch diff review before applying. When using 'worktree', always review the resulting diff, apply it via bridge_apply_diff if approved, and clean up the temporary worktree when done using bridge_close_session(session_id, cleanup_worktree=True). timeout_seconds: Execution timeout in seconds (default: 300). repo_root: Path to target git repository (defaults to current directory). detach: If True, dispatches the task asynchronously in the background and returns the session_id immediately to prevent client timeouts on long turns. Poll or retrieve output via bridge_get_session.
Inputs: prompt (required), harness (required), detach, repo_root, +3 more. Returns: object
bridge_get_sessionBRead-onlyIdempotent
Retrieve tracking details, output, diff, and token usage for an active or past session.
Args: session_id: Session ID to inspect.
Inputs: session_id (required). Returns: object
bridge_list_harnessesARead-onlyIdempotent
List all registered agent harnesses, their binary names, and installation status on system PATH.
Inputs: no named parameters. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Most tools target clearly distinct operations (list harnesses vs. dispatch task vs. apply diff). The main ambiguity is between bridge_cancel_session and bridge_close_session, which both terminate sessions; descriptions differentiate them (subprocess termination vs. worktree cleanup) but an agent could still misselect. The dispatch description's embedded workflow references to apply_diff and close_session help tie the set together.
All six tools use a uniform bridge_ prefix followed by a verb_noun pattern (list_harnesses, dispatch_task, cancel_session, apply_diff, get_session, close_session). No mixed conventions or stylistic deviations.
Six tools is tightly scoped to the dispatch-and-manage-session domain, with each tool covering a distinct lifecycle step. Nothing feels redundant or missing at this size.
The surface covers the full dispatch lifecycle: discover harnesses, dispatch (sync or detached), inspect output/diff, apply results, cancel, and clean up. The one notable gap is the lack of a list/inspect-active-sessions tool, so an agent that loses a session_id from a detached dispatch has no recovery path.
Maintenance
Related MCP Connectors
Control plane for autonomous software labor. Agents claim objectives over MCP with audit trail.
Task management your AI agents can actually run. One line becomes a context-ready task over MCP.
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
Work management where AI agents are first-class members: tasks, projects, memory over hosted MCP
Related MCP Servers
- AlicenseAqualityDmaintenanceDelegate coding tasks to external AI coding agents in isolated git worktrees with independent verification, enabling any MCP client to orchestrate multi-agent workflows.5MIT
- AlicenseAqualityCmaintenanceEnables orchestrator agents to route coding tasks to native CLI worker agents via MCP, providing tools for agent discovery, task submission, waiting, inspection, and cancellation.53MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI coding agents to spawn, parallelize, and synchronize multi-agent programming swarms through a stdio MCP interface. Provides tools for DAG-scheduled task dispatch, isolated Git worktree execution, atomic file locking, shared blackboard memory, and clean merging of completed agent work back to the main repository.1MIT
- AlicenseNot gradedqualityBmaintenanceEnables an orchestrating agent to delegate tasks to Codex, Claude, or Gemini worker CLIs running in isolated git worktrees, then wait on jobs, inspect per-file diffs, and merge or discard the resulting changes before anything touches the working tree.1MIT