cuipengcx90's #4382, Option A's first step (nifengfanpan asked on
Discord): with the MCP hub on, every Library server went behind magpie's
one entry, so a server that reads its project from the folder it starts
in, or keeps a session's state, resolved the wrong repository or shared
state across agents. A server now has a hub policy, Server.Hub ("hub" in
library.json): "" (shared, the default, so nothing changes for existing
users; "shared" is saved as "") or "direct". A direct server is left out
of the hub through inHub, the test that already keeps magpie's own image
server out, so each agent given it keeps its own entry written as with
the hub off, beside the hub's entry for the rest. An agent whose every
server is direct gets no hub entry. The hub neither lists nor runs a
direct server, at /mcp/magpie/hub either, and hubPrune ends one it held.
Switching goes through change(), so the agents are written again at once
and the entry from the other policy is removed. An unknown policy is an
error.
- GUI: with the hub on, the server editor has a "Through the MCP hub"
switch (role=switch, not a <select>; not shown with the hub off or for
the image server), a direct server's row has a "Not through the hub"
tag, and the hub's line and the Connect sheet name the direct servers
with the image server as given directly. Strings are in zh, zh-TW, ja
and de ("MCP 聚合" as the core uses it).
- CLI: magpie library mcp hub <name> shared|direct (ServerHub), and
magpie library marks a direct server.
- TUI: an edit keeps the policy.
- Not done: Option B (per-roots/project backends behind the hub, keying
hubPool by roots). It is left for later; #4382 stays open for it.
Run:
- TestHubDirectServer (internal/library) and the extended
TestLibraryMCPHub (internal/cli) on mote. Broken by hand: inHub back to
!isSelf(s) makes TestHubDirectServer red ("codex with the hub on:
[magpie], want [index magpie]").
- Real configs in a sandbox HOME on mote (fake claude on PATH, the real
binary built from this tree): mcp add index + web for claude and codex,
hub on, hub index direct, shared, then both direct. The direct index
entry was in .claude.json and .codex/config.toml beside magpie's; with
every server direct both files were byte-for-byte as with the hub off
(json.tool diff and diff); shared again removed the index entry.
- Full Go suite (-tags nogui -timeout 45m ./...) on mote at this tree
rebased on origin/main 72ed121fd: 81 packages ok. Before the rebase
the only red was TestQuotaSpanCarriesEveryWindowField (#4457, fixed by
ccbefe2a2). GOOS=linux and GOOS=windows go vet clean, gofmt clean.
- GUI on WSL (magpie-desktop; mote's GUI is broken, #4125), both engines,
every language: the new mcp-hub-direct.test.cjs (1100 and 390 wide,
hub on and off), library-mcp-hub, mcp-local-server, i18n-keys: 88 pass.
Broken by hand: not sending hub in the save makes mcp-hub-direct red
(11 of 11 in chromium).
- The 54 library/mcp/i18n GUI files at --test-concurrency=4 on WSL at load
~160: 978 of 988 pass. Red: library-chip-fan (webkit, fan positions),
library-mcp-tools (chromium ja 420, "the click scrolled the page") and
mcp-oauth-app (chromium de 390). None of them touch the hub switch or
the editor's new field. They are being rerun alone, here and on
origin/main, after this push; a red that only this change has is fixed
next, and a red on main too is filed.
Not tried: the whole GUI suite (1028 files); a real cwd-sensitive
server in a real agent session; the live app window.