# Openfusion

> Frontier-grade answers from any mix of models — a local MCP server bringing OpenRouter's Fusion panel architecture to any MCP client. Bring your own keys.

- **Type:** MCP server
- **Install:** `agentstack add mcp-hashangit-openfusion`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [hashangit](https://agentstack.voostack.com/s/hashangit)
- **Installs:** 0
- **Category:** [Integrations](https://agentstack.voostack.com/c/integrations)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [hashangit](https://github.com/hashangit)
- **Source:** https://github.com/hashangit/openfusion

## Install

```sh
agentstack add mcp-hashangit-openfusion
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

Frontier-grade answers from any mix of models — now in your own MCP server.

  
  
  
  
  
  
  

---

OpenRouter showed that **synthesizing the outputs of several models consistently beats any single frontier model** — and that you don't even need expensive models to get there. In [their Fusion announcement](https://openrouter.ai/blog/announcements/fusion-beats-frontier/), a panel of cheap models fused together **outperformed solo frontier models** on deep-research tasks, landing within striking distance of top-tier models at a fraction of the cost.

**The catch:** you had to use OpenRouter.

**OpenFusion removes that catch.** It's a local [MCP](https://modelcontextprotocol.io/) server that brings the exact same Fusion architecture to **any** MCP-capable coding agent or client — Claude Code, Cursor, Cline, Zed, Codex, Gemini CLI, Continue, and [18+ others](./INSTALL.md). Bring your own keys for any provider; OpenFusion runs entirely on your machine.

> ### ✨ The Fable 5 opportunity
> OpenRouter's headline finding: a budget panel of cheap models, fused, landed **within ~1% of Claude Fable 5** on deep research — at roughly half the price. **OpenFusion lets you build that budget panel yourself, with the cheapest models from any providers you like.** Fable-5-class answers, at budget-panel cost, from the agent you already use.

## Quick start

Zero to your first fusion in ~5 minutes. Requires **Node.js 22+**.

**1. Install:**

```bash
npm install -g openfusion-mcp
```

**2. Set up your project** — register OpenFusion with your MCP client and install the agent skill:

```bash
openfusion-setup
```

The interactive installer detects your client (Claude Code, Cursor, Cline, Zed, Codex, Gemini CLI, ZCode, …), writes its MCP config, and drops the `openfusion` skill into the right place. Then **restart your client** so it spawns the server.

**3. Launch the dashboard.** It auto-opens at `http://localhost:9077` when your client first starts OpenFusion — or run it standalone anytime:

```bash
openfusion-ui          # always-on dashboard (no client needed)
```

Add **2–5 candidate models** + a **judge** + an **API key** per provider (use **Test** to validate each; keyless providers like `rapid-mlx`/`ollama-cloud` need none). The **● Configured** badge turns green and `fusion` works immediately — no restart.

**4. Use the skill.** The installed `openfusion` skill teaches your agent *when* and *how* to call fusion: do the legwork first (read, search, reproduce), then bring a prepared dossier and call it once:

```
fusion({
  prompt:  "Should I use a queue or a streaming pull for this worker?",
  context: ""
})
```

Your agent now has a council of models on demand.

> Prefer `npx` over a global install, or building from source? See **[Install](#install)** below.

## How it works

OpenFusion is a **fusion engine, not an agent**. It doesn't browse, doesn't call tools, doesn't do research itself — you give it the prompt (and any context you've gathered), and it does one thing very well:

```
your prompt ──► fan out to 2–5 candidate models (parallel, single-shot)
                   │  Promise.allSettled + per-candidate timeout
                   ▼
              survivors (≥2 required)
                   │
                   ▼  judge step 1: structured analysis
              { consensus · contradictions · partial coverage · unique insights · blind spots }
                   │
                   ▼  judge step 2: synthesis (candidates + analysis only)
              one consolidated answer  ◄── returned to your agent
```

The two-step judge is the magic. OpenRouter found that **~¾ of the performance lift comes from the synthesis step itself**, not just model diversity — splitting "analyze the candidates" from "write the final answer" is what makes the output measurably better than any single contributor. Both steps use the same judge model you configure.

Every fusion is logged to a local SQLite database and visualized in a glass-morphic dashboard — per-model cost, tokens, and latency, with each fusion expandable into its constituent calls.

## Why you'd use it

- **Complex reasoning & architecture decisions** where a second (and third) opinion genuinely helps.
- **Deep research & source synthesis** across multiple perspectives.
- **Cross-model verification** for high-stakes answers where independent agreement builds confidence.
- **Budget-conscious quality** — a panel of cheap models, fused, can beat a single expensive one.

And when *not* to: routine coding, simple lookups, single-turn Q&A. Fusion is 2–3× slower and costlier than one call, so the shipped [`SKILL.md`](./skill/SKILL.md) teaches your agent to reach for it selectively.

## Install

Requires **Node.js 22+**. Published to npm — no clone or build needed.

**Quick start (3 steps):**

1. **Register OpenFusion with your MCP client:**
   ```bash
   npx openfusion-setup        # interactive: picks your client, writes its config, installs the agent skill
   ```
2. **Restart your MCP client** so it loads OpenFusion. The client spawns the server, which on first run prints a banner and **opens the dashboard** at `http://localhost:9077`.
3. **Configure in the dashboard:** add 2–5 candidate models + a judge + an API key per provider (use **Test** to validate each; keyless providers like `rapid-mlx`/`ollama-cloud` need none). The **● Configured** badge turns green and `fusion` works immediately.

That's it — the `fusion` + `open_dashboard` tools are now available to your agent.

---

### Detailed paths

**One-command (recommended):** `npx openfusion-setup` writes the correct snippet for your client (Claude Code, Cursor, Cline, Zed, Codex, Gemini CLI, ZCode, Claude Desktop, …) and installs the skill.

**Manual registration:** point your MCP client at `npx -y openfusion-mcp`. See **[INSTALL.md](./INSTALL.md)** for exact recipes for 18+ clients. (Claude Code and ZCode also auto-load the repo's [`.mcp.json`](./.mcp.json) when you open the project.)

**From source** (if you cloned):
```bash
pnpm install && pnpm build     # tsc -> dist/ ; vite -> ui-dist/
node dist/index.js             # start the server + dashboard
# then register with `node /abs/path/to/openfusion/dist/index.js` in your client
```

> **Native build note:** `better-sqlite3` compiles a native addon at install. On most platforms a prebuilt binary is fetched automatically. If install fails, run `npm rebuild better-sqlite3` (requires Python 3 + a C++ toolchain — Xcode CLT on macOS, `build-essential` on Linux). If the addon is missing at runtime, OpenFusion prints a clear fix-it message instead of a cryptic stack trace.

### Where data lives

OpenFusion stores config, encrypted keys, and the SQLite DB under `OPENFUSION_HOME` — defaulting to your OS data dir (`~/Library/Application Support/openfusion` on macOS, `~/.local/share/openfusion` on Linux). The **path is printed on every startup**, so you always know where your config/secrets are. Set `OPENFUSION_HOME` to override (e.g. for a separate profile), and restart the server after changing it — two servers with different `OPENFUSION_HOME`s see different configs.

### Configure

1. Open **http://localhost:9077** (or start the dashboard anytime with `npx openfusion-ui`, or `node dist/ui-only.js` from source).
2. Add **2–5 candidate models** (provider + model each), pick a **judge**, and enter an **API key** per referenced provider. Use **Test** to validate each before saving. Keyless providers need no key — currently **`rapid-mlx`** (Apple-Silicon local inference via the rapid-MLX OpenAI-compatible server) and **`ollama-cloud`** (Ollama's hosted endpoint) ship built in; the model picker auto-discovers their available models.
3. The **● Configured** badge turns green → the `fusion` tool works immediately (no restart).

Keys are AES-256-GCM encrypted at rest (`secrets.enc` + a chmod-600 machine-bound `master.key`); the dashboard binds to `127.0.0.1` only.

## Tools

| Tool | Input | Returns |
|------|-------|---------|
| `fusion` | `{ prompt, context? }` | one consolidated answer (+ progress notifications) |
| `open_dashboard` | `{}` | opens `http://localhost:9077` |

## The dashboard

  

Glass-morphic, OpenFusion-branded · KPIs · fusions-per-day · cost-by-model · token-usage-by-model · expandable activity log

Every fusion writes **one activity row + N+2 sub-call rows** (each candidate + the two judge steps) — so you can see exactly which model said what, cost how much, and took how long. That's the "activity as a dimension" powering the charts.

## Tech

TypeScript (ESM, ES2022, NodeNext) · [`@earendil-works/pi-ai`](https://www.npmjs.com/package/@earendil-works/pi-ai) (provider layer) · [`@modelcontextprotocol/sdk`](https://modelcontextprotocol.io/) v1 · [`better-sqlite3`](https://github.com/WiseLibs/better-sqlite3) · Express 5 (loopback-only) · React + Vite + Tailwind + recharts · Vitest.

## Scripts

```bash
npx openfusion-setup       # interactive installer (writes client config + installs skill)
npx openfusion-mcp         # run the MCP server + dashboard
pnpm build                 # tsc -> dist/ ; vite -> ui-dist/ (from source)
pnpm test                  # 216 tests, deterministic (pi-ai faux providers — no real API calls)
node dist/index.js         # MCP server (stdio) + dashboard (from source)
node dist/ui-only.js       # standalone always-on dashboard
```

## Updating

```bash
git pull && pnpm install && pnpm build   # from source; or just re-run npx for the published version
```

Then **restart the server** so it loads the new code — a running process won't pick up changes. Config schema upgrades are automatic on load (a one-time notice prints to stderr, e.g. `config upgraded from v1 → v2`). You won't lose your candidates/judge/keys.

> **Client tool-call timeouts:** a fusion with several candidates + a judge can take ~30–90s (sometimes more). Some MCP clients enforce a tight tool-call ceiling (e.g. 60s). If a `fusion` call appears to fail from the client side, the server likely **completed and logged it anyway** — check the **Playground** (its history rail loads any past run) or the **Errors** tab in the dashboard (`http://localhost:9077`) for the result.

## Project layout

```
src/        server (fusion engine, MCP, REST API, config, SQLite) — see ARCHITECTURE.md
ui/         React dashboard (Vite + Tailwind + recharts)
skill/      SKILL.md — agent guidance, shipped with the package
specs/      speckit design record (spec / plan / contracts / tasks)
public/     logo + banner
```

## Contributing

Contributions welcome — see **[CONTRIBUTING.md](./CONTRIBUTING.md)**. The project has a [constitution](./.specify/memory/constitution.md) of seven design principles that changes must respect. AGENTS.md has the coding guidelines.

## Acknowledgements

- **[OpenRouter](https://openrouter.ai)** for the [Fusion research and architecture](https://openrouter.ai/blog/announcements/fusion-beats-frontier/) that this project implements locally.
- **[pi-ai](https://github.com/earendil-works/pi)** (Mario Zechner / earendil-works) for the excellent multi-provider LLM abstraction.
- The **[Model Context Protocol](https://modelcontextprotocol.io/)** team for the open standard this plugs into.

## License

[MIT](./LICENSE) © Hashan Wickramasinghe

---

  Frontier-grade fusion. Any providers. Your machine. No lock-in.

  
    
  
  &nbsp;

## Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [hashangit](https://github.com/hashangit)
- **Source:** [hashangit/openfusion](https://github.com/hashangit/openfusion)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/mcp-hashangit-openfusion
- Seller: https://agentstack.voostack.com/s/hashangit
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
