Open source - MIT - Node.js 22+ - local MCP server

One router for every coding agent

Stop switching tools by hand. Harness Router gives your MCP host one code tool and routes each task through the best configured account, CLI, local model, or API fallback.

npx -y harness-router
harness-router dashboard --watch
Route health
model priority, subscription routes, metered fallback, and breaker state
subscription
claude-opus-4-7 / claude_code
ok - breaker closed - quota assumed available
subscription
gpt-5.4 / codex
ok - shared state - 2 calls this session
metered
gpt-5.4 / api.openai.com
fallback - used after local routes dry up
Ready to route: claude-opus-4-7::claude_code, claude-opus-4-7::cursor, gpt-5.4::codex, gemini-2.5-pro::opencode

Three surfaces, one routing policy

Every surface reads the same model-first config and shared SQLite state. Full README

MCP host

Claude Desktop, Claude Code, Cursor, Codex, or another MCP host calls one code tool. Harness Router chooses the route and returns the selected agent response.

// MCP tool call code({ prompt: "Refactor the auth callback", mode: "single", hints: { model: "claude-opus-4-7" } }) code({ prompt: "Compare two migration plans", mode: "fanout", models: ["gpt-5.4", "claude-opus-4-7"] })

Model-first config

Put the model outcome first, then list the subscription and metered routes that can serve it. Adding another CLI does not change the host surface.

# ~/.harness-router/config.yaml priority: - claude-opus-4-7 - gpt-5.4 models: claude-opus-4-7: subscription: - harness: claude_code - harness: cursor - harness: opencode metered: base_url: https://api.anthropic.com/v1 api_key: "${ANTHROPIC_API_KEY}"

Inspectable state

The dashboard and MCP resources show route reachability, quota assumptions, breaker state, and recent dispatch decisions without adding more MCP tools.

$ harness-router dashboard --watch subscription [ok] claude-opus-4-7::claude_code quota: assumed available breaker: closed metered [ok] gpt-5.4::api.openai.com fallback route breaker: closed resource harness-router://status harness-router://status.json

Agent and API fallback

Use Claude Code, Codex, Cursor, Gemini CLI, opencode, Copilot CLI, generic CLIs, local OpenAI-compatible servers, and hosted APIs behind one policy.

$ harness-router doctor --probe-routes Claude Code CLI installed authed ready OpenAI Codex CLI installed authed ready Cursor agent installed authed ready Gemini CLI installed authed ready opencode installed authed ready API fallback key set reachable

Get started

Requires Node.js 22 or newer and at least one configured route. Use npx for MCP host launch, or install globally for the onboarding, doctor, dashboard, and install commands.

Recommended for MCP hosts
npx -y harness-router
Global CLI
npm install -g harness-router
Onboard
harness-router onboard
Recommended for MCP hosts
npx -y harness-router
Global CLI
npm install -g harness-router
Onboard
harness-router onboard
Recommended for MCP hosts
npx -y harness-router
Global CLI
npm install -g harness-router
Onboard
harness-router onboard

Try it

$harness-router onboard
$harness-router doctor
$harness-router doctor --probe-routes
$harness-router dashboard --watch
$harness-router install --print

FAQ

The questions people ask before putting a router in front of their coding agents.

What is Harness Router?
Harness Router is a local Model Context Protocol (MCP) server for routing coding tasks. Your MCP host calls one code tool, and Harness Router chooses between Claude Code, Codex, Cursor, Gemini CLI, opencode, Copilot CLI, generic CLIs, and API model routes.
How do I install Harness Router?
Run npx -y harness-router for stdio MCP server launch, or install it globally with npm install -g harness-router and run harness-router onboard. Harness Router requires Node.js 22 or newer.
Is Harness Router an AI coding agent?
No. Harness Router is the routing layer in front of coding agents. The selected route, such as Claude Code, Codex, Cursor, opencode, or an API endpoint, does the coding work.
How is Harness Router different from opencode?
opencode is a coding agent you can use directly. Harness Router sits above coding agents and decides which route should handle a task based on model priority, subscription availability, route health, quota state, and metered fallback. opencode can still be one of the routes.
Does Harness Router send code to a hosted service?
No hosted Harness Router service is required. It runs locally and dispatches only to the CLIs, local endpoints, or APIs you configure.
What happens when a route hits a limit?
Harness Router marks that route with a circuit breaker and moves to the next eligible route. The status resource and dashboard show route health, quota assumptions, and recent failures.
Which tools can Harness Router route to?
Harness Router can route to Claude Code, Codex, Cursor agent, Gemini CLI, opencode, GitHub Copilot CLI, generic CLI commands, local OpenAI-compatible endpoints, and hosted OpenAI-compatible APIs.
Why does Harness Router require Node.js 22 or newer?
Harness Router targets Node.js 22 or newer for supported installs, CI, and publish jobs. That is separate from coding-agent CLIs, which may have their own runtime requirements.