DEV Community

csa7mdm
csa7mdm

Posted on

One 100 KB npx Command to Wire a Zero-Dep SQLite FTS5 Brain Across 4 Coding Agents (Plus Safe Remote /mcp)

Part 2 of the Building Mizan in Public series (Part 1: cutting multi-agent fixed prefix tokens by 94%).

Mizan is an open-source, zero-dependency, local-first multi-agent control plane and 4-tool stdio SQLite FTS5 MCP hub for Claude Code, Codex, Cursor, OpenCode, and Antigravity.


If you use more than one AI coding agent, configuring MCP servers gets repetitive fast. Every tool stores its config in a different path and format. Worse, stacking eager-loaded MCP servers quietly adds 50,644+ upfront tokens to your fixed prefix before you even ask a question.

I shipped mizan-os on npm (100.3 kB, 0 external dependencies) so you can fix both problems without cloning a repo:

  1. npx mizan-os connect: One command that wires Mizan's 4-tool stdio SQLite FTS5 brain (brain_search_lessons, brain_search_components, brain_get_ops_state, brain_log_decision) across Claude Code, OpenCode, Codex, and Cursor with atomic writes.
  2. npx mizan-os start (Streamable HTTP /mcp inside Action Center): Boots a Bearer-authenticated endpoint restricted to strictly 5 safe Control-Plane tools (zero shell execution) so ChatGPT and Claude Mobile can inspect ops state and approve decisions remotely over Cloudflare Tunnel or Tailscale Funnel.

Before vs. After

Workflow Manual Multi-Agent MCP Setup With npx mizan-os
Wiring 4 coding agents Hand-edit 4 separate config files npx mizan-os connect (--dry-run, --status, --remove)
Prefix token overhead 50,644+ tokens from eager-loaded MCP stacks < 3k fixed prefix (4 stdio tools locally, 5 remote /mcp tools)
Playbooks & ops history Pasted manually into system prompts Indexed in Node 24 node:sqlite FTS5 (knowledge/ + ops/ACTIVITY-LOG.jsonl) with 0 prefix bloat
Remote mobile control Exposed shell endpoints or none Bearer-auth /mcp with strictly 5 non-exec Control-Plane tools via Tailscale Funnel / Cloudflare Tunnel

1. Atomic Auto-Connect (npx mizan-os connect)

Instead of asking users to copy-paste JSON blocks across four tools, connect detects installed agent configs and writes safely using atomic file replacement:

# Preview changes without touching disk (zero clone required)
npx mizan-os connect --dry-run

# Wire brain-hub into Claude Code, OpenCode, Codex, and Cursor
npx mizan-os connect

# Verify wiring, run isolated selftests, or cleanly remove
npx mizan-os connect --status
npx mizan-os test
npx mizan-os connect --remove
Enter fullscreen mode Exit fullscreen mode

2. Searchable knowledge/ Playbooks With Zero Prefix Increase

Every time you add a long playbook to a system prompt, you pay for it on every turn. Instead, Mizan keeps curated playbooks (Browser Automation, Mobile Android USB ADB / Wi-Fi Wireless Debugging / iOS from Windows, and Token-Optimal engineering) plus the unified ops/ACTIVITY-LOG.jsonl indexed in Node 24's built-in node:sqlite FTS5 engine.

Agents query only what they need on demand via brain_search_lessons and brain_search_components, keeping fixed prefix budgets under 3,000 tokens with zero cloud lock-in and zero telemetry.

3. Safe 5-Tool Remote /mcp for ChatGPT and Claude Mobile

Opening a remote shell-exec MCP endpoint to the internet is a security incident waiting to happen.

Mizan's /mcp endpoint inside action-center/server.mjs enforces:

  • Mandatory Bearer token authentication (crypto.timingSafeEqual).
  • Strictly 5 safe Control-Plane tools with zero shell execution.
  • Verified via an isolated selftest suite (action-center/mcp-selftest.mjs).
  • Works over Tailscale Funnel or Cloudflare Tunnel so you can check fleet status or resolve pending decisions from ChatGPT or Claude Mobile.

Honest Limits

  • Node 24 required: Both hub-mcp and action-center rely on built-in Node 24 modules (node:sqlite, node:http, node:crypto) to stay zero-dependency.
  • Remote tunnel setup is opt-in: Mizan does not bundle or auto-expose a public tunnel; you control Tailscale Funnel or Cloudflare Tunnel explicitly.
  • No remote shell execution by design: /mcp intentionally omits shell commands so mobile clients can only inspect and steer the control plane safely.

Frequently Asked Questions (FAQ)

How do I connect one MCP server to Claude Code, Cursor, Codex, and OpenCode automatically?

Run npx mizan-os connect --dry-run to preview the detected config paths, then run npx mizan-os connect to wire brain-hub atomically across all four agents without manual JSON editing.

How can I connect ChatGPT or Claude Mobile to my local AI agent control plane safely?

Expose Mizan's Bearer-authenticated /mcp endpoint (npx mizan-os start) through Tailscale Funnel or Cloudflare Tunnel. It restricts remote callers to 5 non-exec Control-Plane tools verified with crypto.timingSafeEqual.

Does indexing knowledge/ playbooks in hub-mcp increase my agent's startup prefix tokens?

No. Playbooks and ops/ACTIVITY-LOG.jsonl live in Node 24 SQLite FTS5 and are fetched on demand through the 4-tool stdio interface, adding zero tokens to the fixed startup prefix.


Try it locally (100.3 kB, 0 deps):

If npx mizan-os connect --dry-run misses a config path on your OS or IDE, open an issue (or check our good first issue #3) and we will add it.

Top comments (0)