RouterSync
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
RouterSync
Keeps model lists and combos in sync across LLM routers, agent harnesses and providers. Local-first, human-approved, zero inference tokens.
0.1.0. The read-only surface is the stable part:
scanning, planning, ranking preview, verification and the daemon. Every
write command refuses to run without an interactive TTY and the confirmation
word it prints in --help, so a pipe or a CI job cannot approve a write.
English
Overview
RouterSync is a local command-line tool and MCP server that keeps the model lists of LLM routers (9Router, OmniRoute) in sync with the combo definitions you want, and with the agent harnesses that consume them (OpenCode, Claude Code, Hermes Agent, or any MCP client).
It reads a router database in read-only mode, asks each provider for its
public model list with a plain GET /models, compares the result with the
current combo, and produces a plan. Nothing is written to a router until a
human types the confirmation word on a terminal.
Purpose
Goal. Stop hand-editing combo step lists in several routers at once, and make every change reviewable before it happens.
Benefits.
One declarative file (
config.yaml) describes the routers and the combos (a legacyroutersync.yamlin the working directory is also accepted by the loader). Each router entry inconfig.yamlmust use a distinct adapter (e.g. one9routerand oneomniroute); multiple routers sharing the same adapter are rejected with a clear error.A plan shows exactly which steps are added, moved or dropped before anything is written.
Every write is preceded by a snapshot and followed by a read-back.
Model discovery costs zero inference tokens: only model listings are fetched.
Main Features
Read-only scan - reads the router database and the provider model lists.
Deterministic plan - the same inputs always produce the same plan hash.
Ranking preview - shows the new combo order without touching the router.
Verification - labels every model across three layers (provider list, external catalogue, upstream notice).
Zero-token tracking -
tickwatches the catalogues and writes to the inbox; it never calls a paid endpoint.MCP server - 24 read-only tools, no write tool.
Daemon and web UI - a local read-only dashboard.
How it works
scan -> compare -> plan -> confirm -> backup -> narrow write -> read-back -> undo
| | | | | | | |
GET /models | dry-run diff type the snapshot only the re-read restore the
with your | + plan hash word on the router steps in the router previous
own key | a TTY database the plan database step listSafety model
Only claims that the test suite proves are listed here.
Rule | What it means |
Read-only by default |
|
Human confirmation |
|
Backup before a write | A write snapshots the router rows it is about to change before the transaction. |
Read-back after a write | After a write the router is read again through the same path it serves from. |
Bounded undo |
|
Zero inference tokens |
|
Secrets stay local | API keys are read into memory, never printed, never written to a plan or a log. |
Install
Requirements on every platform: Node.js >= 22.12 and pnpm >= 10.
The SQLite driver (better-sqlite3) ships a prebuilt binary for macOS
(Intel and Apple Silicon), Linux (x64 and arm64) and Windows inside the npm
package, so no C++ compiler and no manual build step is needed. The
repository pins the package manager in packageManager and the Node version
in .nvmrc, so corepack enable pnpm picks the right one.
Note about the SQLite driver.
pnpm installprints an "Ignored build scripts: better-sqlite3" warning on purpose: the package ships the compiled binary for every supported platform, and building it from source would require a C++ toolchain. The warning is harmless.
Windows (PowerShell)
node --version # must be >= v22.12.0
corepack enable pnpm # or: npm install -g pnpm@10
git clone https://github.com/CThawngs/Router-Sync.git
cd Router-Sync
pnpm install --frozen-lockfile
pnpm build
New-Item -ItemType Directory -Force "$env:APPDATA\routersync" | Out-Null
Copy-Item ranking.example.yaml "$env:APPDATA\routersync\ranking.yaml"
node packages/cli/dist/index.js init # create default config.yaml configuration
node packages/cli/dist/index.js scan # first read-only commandmacOS (Terminal)
node --version # must be >= v22.12.0
corepack enable pnpm # or: npm install -g pnpm@10
git clone https://github.com/CThawngs/Router-Sync.git
cd Router-Sync
pnpm install --frozen-lockfile
pnpm build
mkdir -p ~/.config/routersync && cp ranking.example.yaml ~/.config/routersync/ranking.yaml
node packages/cli/dist/index.js init # create default config.yaml configuration
node packages/cli/dist/index.js scan # first read-only commandLinux (Terminal)
node --version # must be >= v22.12.0
corepack enable pnpm # or: npm install -g pnpm@10
git clone https://github.com/CThawngs/Router-Sync.git
cd Router-Sync
pnpm install --frozen-lockfile
pnpm build
mkdir -p ~/.config/routersync && cp ranking.example.yaml ~/.config/routersync/ranking.yaml
node packages/cli/dist/index.js init # create default config.yaml configuration
node packages/cli/dist/index.js scan # first read-only commandRunning commands via
pnpm routersync: You can invoke any command usingpnpm routersync <command>(for examplepnpm routersync doctor) or vianode packages/cli/dist/index.js <command>. Note: Runningpnpm doctortriggers pnpm's own built-in environment diagnosis tool (which outputs nothing for RouterSync); always usepnpm routersync doctor.
Example output: The output depends on which router instances are currently running. For example, when OmniRoute is stopped and 9Router is running locally without a client key configured:
[routersync] Scanned 2 router(s) from <config-path>:
✗ [omni] (omniroute) - Status: down (...) | Read-Back: db-only (degraded) | Combos: 0 | Models: 0
Read-Back Info: Router API unreachable (fetch failed) - serving path unconfirmed, degraded to db-only
Detail: fetch failed
✓ [nine] (9router) - Status: ok (...) | Read-Back: db-only (degraded) | Combos: 0 | Models: 0
Read-Back Info: No client key configured. 9Router API requires browser session or NINEROUTER_CLIENT_KEY for /v1/models.Default router database locations:
Router | Platform / Environment | Default Database Path | Override Environment Variable |
9Router | Windows |
|
|
9Router | macOS / Linux |
|
|
OmniRoute | All platforms |
|
|
Note: 9Router database resolution on macOS/Linux is documented from installation references and source code inspection, but has not yet been run on physical macOS/Linux hardware by the author.
Set up with an AI agent
If you are handing this repo to an AI agent (Claude Code, OpenCode, Codex, Gemini CLI, Antigravity), paste this single instruction:
"Clone
<repo URL>, readAGENTS.md, set up RouterSync, and ask me before any decision."
The agent will run pnpm routersync doctor --json, follow nextSteps, and only
propose read-only actions. Every write command (sync --apply, undo --apply,
rank --apply, rollback --write) must be typed by you in your own terminal — the agent never
types the confirmation word for you.
Note: routersync <command> in this document is run via pnpm routersync <command>.
CLI
Command | What it does | Writes to a router? |
| Write a starter | No |
| Read the router databases and the provider lists. | No |
| Compute the plan and print the diff. | No |
| Show router health and read-back level. | No |
| Diagnose the configuration. | No |
| Label every model across L1/L2/L3. | No |
| One zero-token catalogue and inbox pass. | No |
| Preview the new combo order. | No (unless |
| Plan and, with | Only with |
| Restore the step list of the newest sync backup. | Only with |
| Restore a persisted snapshot. | Only with |
| Run the local read-only daemon. | No |
| Work with the notification inbox. | No |
| Print the MCP client configuration. | No |
MCP client configuration
RouterSync ships a read-only MCP server with 24 tools. Paste this into an MCP client (the path is the one you installed from):
{
"mcpServers": {
"routersync": {
"command": "node",
"args": ["/absolute/path/to/routersync/packages/mcp-server/dist/index.js"],
"env": {
"ROUTERSYNC_STATE_DIR": "/absolute/path/to/state"
}
}
}
}Scheduling tick
tick reads model lists only, so a scheduled run costs 0 tokens. Ready to
use samples live in examples/schedule/:
Platform | File |
Windows Task Scheduler |
|
macOS launchd |
|
Linux systemd timer |
|
Linux cron |
|
Troubleshooting
Symptom | What to do |
| The router database was not found. Copy the printed path into |
| Run |
| A write command needs a human. Run it in an interactive terminal. |
| Copy |
| Rebuild the native module: |
| A provider model list shrank by more than the threshold (default 30%). The old catalog is preserved. Review the official provider model list to confirm genuine removals vs provider outage; if genuine, a human operator (not an agent) may reset the baseline by removing that provider's entry from |
A provider shows | The key in the router database is expired or invalid. RouterSync never prints the key. |
Documentation map
Document | Content |
Low-resource mode, env vars, and tips | |
First-time setup | |
The daily workflow | |
What is planned and what is known to be missing | |
Platform and feature matrix | |
Per-router and per-harness notes | |
Architecture decision records | |
Runbooks for the first apply | |
Daemon threat model | |
Ready-to-use schedule samples | |
Release notes | |
How to contribute |
Conclusion
RouterSync is deliberately conservative: it reads, it plans, it asks, and only
then does it write - and it refuses to write at all when nobody is watching.
If you want to try it, run routersync scan first. It changes nothing.
Disclaimer
RouterSync is not affiliated with, endorsed by or sponsored by 9Router, OmniRoute, OpenAI, Google, Anthropic or any other provider. Product names and logos belong to their respective owners and are used only to describe what this tool talks to.
The software is provided "AS IS", without warranty of any kind, under the MIT licence.
You are responsible for every write to your own router. RouterSync asks for confirmation before it writes, but the consequences of a write are yours.
The tool calls GET /models with your own API key - the key that is
already stored in your router database - and reads public catalogue pages
(OpenRouter, models.dev, LiteLLM and provider deprecation notices). It never
calls a chat or completion endpoint, so model discovery costs 0 tokens.
Related MCP server: Hoplon
Tiếng Việt
Tổng quan
RouterSync là công cụ dòng lệnh và máy chủ MCP chạy cục bộ, giữ danh sách model của các router LLM (9Router, OmniRoute) khớp với phần định nghĩa combo bạn muốn dùng, và khớp với các agent harness tiêu thụ chúng (OpenCode, Claude Code, Hermes Agent, hoặc bất kỳ ứng dụng khách MCP nào).
Công cụ đọc database của router ở chế độ chỉ đọc, hỏi từng nhà cung cấp
danh sách model công khai bằng một lệnh GET /models, so sánh kết quả với
combo hiện tại, rồi lập kế hoạch. Không có gì được ghi vào router cho tới
khi một người gõ từ xác nhận trên terminal.
Mục đích
Mục tiêu. Không phải sửa tay danh sách bước combo trong nhiều router, và mọi thay đổi đều xem lại được trước khi xảy ra.
Lợi ích.
Một tệp khai báo (
config.yaml) mô tả router và combo (bộ nạp cấu hình vẫn nhậnroutersync.yamlở thư mục làm việc nếu có). Mỗi router trongconfig.yamlphải dùng một adapter khác nhau (ví dụ một9routervà mộtomniroute); cấu hình có nhiều router cùng adapter sẽ bị từ chối kèm lỗi rõ ràng.Kế hoạch cho biết chính xác bước nào được thêm, đổi vị trí hoặc bỏ.
Mỗi lần ghi đều có bản sao lưu trước và đọc lại sau.
Khám phá model không tốn token suy luận: chỉ lấy danh sách model.
Tính năng chính
Quét chỉ đọc - đọc database router và danh sách model của nhà cung cấp.
Kế hoạch xác định - cùng đầu vào luôn cho cùng một mã băm kế hoạch.
Xem trước thứ hạng - hiện thứ tự combo mới mà không đụng router.
Kiểm chứng - gán nhãn cho mọi model qua ba tầng (danh sách nhà cung cấp, danh mục ngoài, thông báo ngừng hỗ trợ).
Theo dõi 0 token -
tickcanh danh mục và ghi vào hộp thư báo.Máy chủ MCP - 24 công cụ chỉ đọc, không có công cụ ghi.
Daemon và giao diện web - bảng điều khiển cục bộ chỉ đọc.
Cách hoạt động
quét -> so sánh -> kế hoạch -> xác nhận -> sao lưu -> ghi hẹp -> đọc lại -> hoàn tác
| | | | | | | |
GET /models | chạy thử diff gõ từ xác chụp lại chỉ ghi các đọc lại khôi phục
với khóa | + mã băm kế nhận trên database bước trong database danh sách
của bạn | hoạch terminal TTY router kế hoạch router bước cũMô hình an toàn
Chỉ nêu những điều mà bộ kiểm thử chứng minh được.
Quy tắc | Ý nghĩa |
Mặc định chỉ đọc |
|
Cần người xác nhận |
|
Sao lưu trước khi ghi | Một lần ghi chụp lại những dòng router sắp thay đổi trước khi mở giao dịch. |
Đọc lại sau khi ghi | Sau khi ghi, router được đọc lại qua đúng đường dẫn mà nó phục vụ. |
Hoàn tác có giới hạn |
|
0 token suy luận |
|
Khóa ở lại máy bạn | Khóa API được đọc vào bộ nhớ, không in ra, không ghi vào kế hoạch hay nhật ký. |
Cài đặt
Yêu cầu giống nhau trên mọi nền tảng: Node.js >= 22.12 và pnpm >= 10.
Thư viện SQLite (better-sqlite3) đi kèm bản dựng sẵn cho macOS (Intel và
Apple Silicon), Linux (x64 và arm64) và Windows ngay trong gói npm, nên
không cần trình biên dịch C++ và không cần bước build thủ công. Kho đã
ghim phiên bản trình quản lý gói trong packageManager và phiên bản Node
trong .nvmrc, nên corepack enable pnpm sẽ chọn đúng phiên bản.
Ghi chú về thư viện SQLite.
pnpm installin ra cảnh báo "Ignored build scripts: better-sqlite3" một cách có chủ đích: gói này đã kèm sẵn nhị phân biên dịch cho mọi nền tảng được hỗ trợ, và việc dựng lại từ mã nguồn sẽ đòi hỏi trình biên dịch C++. Cảnh báo này vô hại.
Windows (PowerShell)
node --version # phải là >= v22.12.0
corepack enable pnpm # hoặc: npm install -g pnpm@10
git clone https://github.com/CThawngs/Router-Sync.git
cd Router-Sync
pnpm install --frozen-lockfile
pnpm build
New-Item -ItemType Directory -Force "$env:APPDATA\routersync" | Out-Null
Copy-Item ranking.example.yaml "$env:APPDATA\routersync\ranking.yaml"
node packages/cli/dist/index.js init # tạo tệp cấu hình config.yaml mặc định
node packages/cli/dist/index.js scan # lệnh chỉ đọc đầu tiênmacOS (Terminal)
node --version # phải là >= v22.12.0
corepack enable pnpm # hoặc: npm install -g pnpm@10
git clone https://github.com/CThawngs/Router-Sync.git
cd Router-Sync
pnpm install --frozen-lockfile
pnpm build
mkdir -p ~/.config/routersync && cp ranking.example.yaml ~/.config/routersync/ranking.yaml
node packages/cli/dist/index.js init # tạo tệp cấu hình config.yaml mặc định
node packages/cli/dist/index.js scan # lệnh chỉ đọc đầu tiênLinux (Terminal)
node --version # phải là >= v22.12.0
corepack enable pnpm # hoặc: npm install -g pnpm@10
git clone https://github.com/CThawngs/Router-Sync.git
cd Router-Sync
pnpm install --frozen-lockfile
pnpm build
mkdir -p ~/.config/routersync && cp ranking.example.yaml ~/.config/routersync/ranking.yaml
node packages/cli/dist/index.js init # tạo tệp cấu hình config.yaml mặc định
node packages/cli/dist/index.js scan # lệnh chỉ đọc đầu tiênChạy lệnh qua
pnpm routersync: Bạn có thể gọi bất kỳ lệnh nào bằngpnpm routersync <lệnh>(ví dụ:pnpm routersync doctor) hoặc thông quanode packages/cli/dist/index.js <lệnh>. Lưu ý: Chạypnpm doctorsẽ kích hoạt công cụ chẩn đoán môi trường nội bộ của pnpm (không xuất ra thông tin của RouterSync); hãy luôn dùngpnpm routersync doctor.
Ví dụ đầu ra: Kết quả hiển thị phụ thuộc vào router nào đang chạy trên máy của bạn. Ví dụ, khi OmniRoute đang tắt và 9Router đang chạy cục bộ nhưng chưa cấu hình khóa client:
[routersync] Scanned 2 router(s) from <đường-dẫn-cấu-hình>:
✗ [omni] (omniroute) - Status: down (...) | Read-Back: db-only (degraded) | Combos: 0 | Models: 0
Read-Back Info: Router API unreachable (fetch failed) - serving path unconfirmed, degraded to db-only
Detail: fetch failed
✓ [nine] (9router) - Status: ok (...) | Read-Back: db-only (degraded) | Combos: 0 | Models: 0
Read-Back Info: No client key configured. 9Router API requires browser session or NINEROUTER_CLIENT_KEY for /v1/models.Bảng đường dẫn cơ sở dữ liệu router mặc định:
Router | Hệ điều hành / Môi trường | Đường dẫn database mặc định | Biến môi trường ghi đè |
9Router | Windows |
|
|
9Router | macOS / Linux |
|
|
OmniRoute | Mọi nền tảng |
|
|
Ghi chú: Đường dẫn 9Router trên macOS/Linux được xác định theo tài liệu và mã nguồn, chưa được tác giả chạy trên macOS/Linux thật.
Cài đặt bằng AI Agent
Nếu bạn giao kho này cho một AI Agent (Claude Code, OpenCode, Codex, Gemini CLI, Antigravity), hãy gửi câu lệnh duy nhất này:
"Clone
<repo URL>, đọcAGENTS.md, cài đặt RouterSync, và hỏi tôi trước mọi quyết định."
Agent sẽ chạy pnpm routersync doctor --json, làm theo nextSteps, và chỉ đề xuất
các hành động chỉ đọc. Mọi lệnh ghi (sync --apply, undo --apply,
rank --apply, rollback --write) phải do chính bạn gõ trong terminal của bạn — agent không bao
giờ tự gõ từ xác nhận thay bạn.
Ghi chú: routersync <lệnh> trong tài liệu này chạy bằng pnpm routersync <lệnh>.
Bảng lệnh CLI
Lệnh | Việc nó làm | Ghi vào router? |
| Viết tệp | Không |
| Đọc database router và danh sách của nhà cung cấp. | Không |
| Lập kế hoạch và in ra khác biệt. | Không |
| Hiện tình trạng router và mức đọc lại. | Không |
| Chẩn đoán cấu hình. | Không |
| Gán nhãn mọi model qua L1/L2/L3. | Không |
| Một vòng danh mục và hộp thư báo, 0 token. | Không |
| Xem trước thứ tự combo mới. | Không (trừ khi |
| Lập kế hoạch và, kèm | Chỉ khi |
| Khôi phục danh sách bước của bản sao lưu sync mới nhất. | Chỉ khi |
| Khôi phục một ảnh chụp đã lưu. | Chỉ khi |
| Chạy daemon cục bộ chỉ đọc. | Không |
| Xử lý hộp thư báo. | Không |
| In cấu hình máy chủ MCP cho ứng dụng khách. | Không |
Cấu hình máy chủ MCP cho ứng dụng khách
RouterSync có máy chủ MCP chỉ đọc với 24 công cụ. Dán đoạn này vào ứng dụng khách MCP (đường dẫn là nơi bạn cài đặt):
{
"mcpServers": {
"routersync": {
"command": "node",
"args": ["/absolute/path/to/routersync/packages/mcp-server/dist/index.js"],
"env": {
"ROUTERSYNC_STATE_DIR": "/absolute/path/to/state"
}
}
}
}Lịch chạy tick
tick chỉ đọc danh sách model, nên một lần chạy theo lịch tốn 0 token.
Các mẫu dùng ngay nằm ở examples/schedule/:
Nền tảng | Tệp |
Windows Task Scheduler |
|
macOS launchd |
|
Linux systemd timer |
|
Linux cron |
|
Xử lý sự cố
Triệu chứng | Cách xử lý |
| Không tìm thấy database router. Dán đường dẫn được in ra vào |
| Chạy |
| Lệnh ghi cần có người. Hãy chạy trong terminal tương tác. |
| Chép |
| Dựng lại module native: |
| Danh sách model của nhà cung cấp sụt giảm quá ngưỡng (mặc định 30%). Catalog cũ được giữ nguyên. Hãy đối chiếu danh sách chính thức của nhà cung cấp để phân biệt gỡ bỏ thật hay sự cố; nếu đúng là gỡ bỏ, người vận hành (không phải agent) có thể đặt lại baseline bằng cách xóa mục của nhà cung cấp đó trong |
Nhà cung cấp hiện | Khóa trong database router đã hết hạn hoặc không hợp lệ. RouterSync không bao giờ in khóa. |
Bản đồ tài liệu
Tài liệu | Nội dung |
Cài đặt lần đầu | |
Quy trình dùng hằng ngày | |
Điều sắp làm và điều đã biết là thiếu | |
Ma trận nền tảng và tính năng | |
Ghi chú theo từng router và harness | |
Biên bản quyết định kiến trúc | |
Runbook cho lần ghi đầu tiên | |
Mô hình đe doạ của daemon | |
Mẫu lịch chạy dùng ngay | |
Ghi chú phát hành | |
Cách đóng góp |
Kết luận
RouterSync cố ý thận trọng: nó đọc, nó lập kế hoạch, nó hỏi, và chỉ sau đó
mới ghi - và nó không ghi gì khi không ai đang nhìn. Nếu bạn muốn thử, hãy
chạy routersync scan trước. Lệnh đó không thay đổi gì cả.
Tuyên bố miễn trừ
RouterSync không liên kết với, không được 9Router, OmniRoute, OpenAI, Google, Anthropic hay bất kỳ nhà cung cấp nào bảo trợ hay chấp thuận. Tên và logo sản phẩm thuộc về chủ sở hữu tương ứng và chỉ được dùng để mô tả những gì công cụ này kết nối tới.
Phần mềm được cung cấp "NGUYÊN TRẠNG", không kèm bảo đảm dưới bất kỳ hình thức nào, theo giấy phép MIT.
Bạn chịu trách nhiệm về mọi lần ghi vào router của chính bạn. RouterSync có xin xác nhận trước khi ghi, nhưng hậu quả của một lần ghi thuộc về bạn.
Công cụ gọi GET /models bằng khóa API của chính bạn - khóa vốn đã nằm
trong database router của bạn - và đọc các trang danh mục công khai
(OpenRouter, models.dev, LiteLLM và trang thông báo ngừng hỗ trợ của nhà
cung cấp). Nó không bao giờ gọi endpoint chat hay completion, nên việc khám
phá model tốn 0 token.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
IaC, CI and dependency security review for coding agents: local scan CLI plus hosted OAuth MCP.
Scan AI agent skills, MCP server packages and MCP configs before you install them. Static analysis.
Audit AI Agent SDKs and MCP servers for breaking changes, schema drift, and migration fixes.
Control plane for autonomous software labor. Agents claim objectives over MCP with audit trail.
Related MCP Servers
- FlicenseNot gradedqualityBmaintenancePolicy-as-code gate for AI-SDLC, providing MCP tools to review prompts, diff tool manifests, vet MCP servers, and run evaluation suites for LLM agent repos.1-
- AlicenseNot gradedqualityDmaintenanceEnables AI coding agents and hosts to enforce deterministic repository boundaries via MCP, providing structured reads, supervised edits, snapshots, audits, and recovery with machine-readable evidence.MIT
- AlicenseNot gradedqualityDmaintenanceProvides read-only repository health scanning tools for drift detection, module reachability, prompt bloat, evidence calibration, and registration completeness, enabling agents to diagnose repositories via MCP.1MIT
- AlicenseNot gradedqualityBmaintenanceEnables local static analysis of deployed AI model artifacts over MCP, exposing audit, diff, capabilities, and rule-explanation tools without uploading model bytes.2Apache 2.0