Every agent's model. One place. Codex on DeepSeek, Claude Code on Kimi, from the menu bar.
library: the MCP hub's mark is magpie's bird, its address row says Hub address, and magpie-image is said to go direct
yetoneb0ab8420c13b
diff --git a/internal/gui/assets/plugins/library/client.js b/internal/gui/assets/plugins/library/client.jsindex faceb0205..d86967dcd 100644--- a/internal/gui/assets/plugins/library/client.js+++ b/internal/gui/assets/plugins/library/client.js@@ -50,8 +50,6 @@ magpie.plugin("library", (ctx) => {subagent: "M6 3a2.2 2.2 0 1 0 0 4.4A2.2 2.2 0 0 0 6 3z M2 13c.5-2.2 2-3.4 4-3.4s3.5 1.2 4 3.4 M11.5 7.5a1.5 1.5 0 1 0 0 .01 M10.2 12.5c.3-1.3 1.1-2 2.3-2s1.6.5 1.9 1.4",// a clock with an arrow going back round it, as macOS draws backupsbackup: "M3.2 8a4.8 4.8 0 1 0 1.4-3.4 M2.8 2.6v2.4h2.4 M8 5.3V8l1.9 1.2",- // one point that four lines meet at: the MCP hub (#2679)- hub: "M8 6.2a1.8 1.8 0 1 0 0 3.6 1.8 1.8 0 0 0 0-3.6z M8 2.5v3.7 M8 9.8v3.7 M2.5 8h3.7 M9.8 8h3.7",power: "M8 2.5v5 M4.7 4.6a4.8 4.8 0 1 0 6.6 0",};@@ -91,6 +89,13 @@ magpie.plugin("library", (ctx) => {});}+ // the hub's mark: magpie's bird, the one server each agent is given+ // (the owner didn't like a made-up glyph for it)+ function hubMark() {+ const g = el("span", "lib-glyph lib-hubmark");+ g.innerHTML = '<svg viewBox="0 0 44 44" aria-hidden="true"><use href="#bird"/></svg>';+ return g;+ }function glyph(d, cls = "lib-glyph") {const g = el("span", cls);g.append(svg(d, 16, 1.3));@@ -1647,7 +1652,7 @@ magpie.plugin("library", (ctx) => {? t("Each agent is given one server, magpie, in place of these. magpie runs each server once for all of them and hands each call to it, as server__tool. Restart an agent for it to read the change."): t("Serve every server through magpie: each agent is given one server, magpie, in place of these, and any other app connects at one address.")));if (lib.mcpHub) who.append(el("div", "sub lib-hubstats", hubStats()));- row.append(glyph(GLYPH.hub), who, toggle(!!lib.mcpHub, t("MCP hub"), (on) =>+ row.append(hubMark(), who, toggle(!!lib.mcpHub, t("MCP hub"), (on) =>change("servers/hub", { on }, on? t("The agents are given magpie's one MCP server — restart them to use it"): t("The agents are given each server's own entry again — restart them to use it"))));@@ -1657,7 +1662,10 @@ magpie.plugin("library", (ctx) => {// the one address any other app connects atconst at = el("div", "row lib-row lib-hubat");const aw = el("div", "who");- aw.append(el("div", "name", t("Other apps")));+ // what it is, not who: the hub's address (the owner: "Other apps" over+ // an address read as nonsense); who connects there is in the tooltip+ aw.append(el("div", "name", t("Hub address")));+ aw.title = t("Any other app, as Cursor or VS Code, connects here for every server in the library");const u = el("div", "sub mono lib-hubURL", hubURL());u.title = hubURL();aw.append(u);@@ -1681,11 +1689,13 @@ magpie.plugin("library", (ctx) => {}return out;}+ // magpie's own image server is given as it is, never through the hub: it+ // asks its agent for the project's folder (inHub in mcp_hub.go)+ const isSelf = (s) => s.transport === "stdio" && s.args?.[0] === "mcp" && s.args?.[1] === "image";// what the hub serves: its servers, their tools as far as checked, and// the agents given itfunction hubStats() {- // magpie's own image server is given as it is, never through the hub- const servers = lib.servers.filter((s) => !(s.transport === "stdio" && s.args?.[0] === "mcp" && s.args?.[1] === "image"));+ const servers = lib.servers.filter((s) => !isSelf(s));const parts = [servers.length === 1 ? t("1 server") : t("{n} servers", { n: servers.length })];const known = servers.filter((s) => health.get(s.name)?.h?.state === "ok");if (known.length) {@@ -1694,6 +1704,9 @@ magpie.plugin("library", (ctx) => {}const given = hubAgents().filter((a) => a.hub === "on").map((a) => a.name);if (given.length) parts.push(t("in {agents}", { agents: given.length > 3 ? t("{first} and {n} more", { first: given.slice(0, 2).join(", "), n: given.length - 2 }) : given.join(", ") }));+ // the owner, counting two servers and seeing one: where the other went+ const own = lib.servers.find(isSelf);+ if (own) parts.push(t("{name} is given to each agent directly", { name: own.name }));return parts.join(" · ");}const hubURL = () => mcpAddress(state.settings || {}, lib.hubPath.replace(/\/+$/, ""));@@ -1714,10 +1727,10 @@ magpie.plugin("library", (ctx) => {function connectHub() {const url = hubURL();const json = (o) => JSON.stringify(o, null, 2);- const served = () => lib.servers.filter((s) => !(s.transport === "stdio" && s.args?.[0] === "mcp" && s.args?.[1] === "image"));+ const served = () => lib.servers.filter((s) => !isSelf(s));const ed = el("div", "editor lib-editor lib-hubsheet");const head = el("div", "ehead");- head.append(glyph(GLYPH.hub), el("b", "", t("Connect an app")));+ head.append(hubMark(), el("b", "", t("Connect an app")));ed.append(head);const pane = el("div", "lib-hubpane");const bar = el("div", "bar");@@ -1848,6 +1861,8 @@ magpie.plugin("library", (ctx) => {const left = can.length - on.length;const sub = [left ? t("{n} more can be connected", { n: left }) : t("Each server runs once, for all of them")];if (kept.length) sub.push(kept.length === 1 ? t("1 keeps each server's own entry") : t("{n} keep each server's own entry", { n: kept.length }));+ const own = lib.servers.find(isSelf);+ if (own) sub.push(t("{name} is given to each agent directly", { name: own.name }));// each part whole on its line, the dot kept with the part before itconst line = el("p", "lib-hubsub");sub.forEach((x, i) => line.append(...(i ? [" "] : []), el("span", "", x + (i < sub.length - 1 ? "\u00a0·" : ""))));diff --git a/internal/gui/assets/plugins/library/i18n.js b/internal/gui/assets/plugins/library/i18n.jsindex 2090c7e55..70ad4a909 100644--- a/internal/gui/assets/plugins/library/i18n.js+++ b/internal/gui/assets/plugins/library/i18n.js@@ -58,6 +58,9 @@ magpie.strings({"1 server": "1 个服务器","{first} and {n} more": "{first} 等 {n} 个","Other apps": "其他应用",+ "Hub address": "聚合地址",+ "Any other app, as Cursor or VS Code, connects here for every server in the library": "Cursor、VS Code 等其他应用连接这个地址,即可使用资源库中的全部服务器",+ "{name} is given to each agent directly": "{name} 直接给各 Agent","Connect…": "连接…","Connect an app": "连接应用","{agent} no longer has the library's servers — restart it to read the change": "{agent} 不再使用资源库的服务器——重启它后生效",@@ -780,6 +783,9 @@ magpie.strings({"1 server": "1 個伺服器","{first} and {n} more": "{first} 等 {n} 個","Other apps": "其他應用程式",+ "Hub address": "聚合位址",+ "Any other app, as Cursor or VS Code, connects here for every server in the library": "Cursor、VS Code 等其他應用程式連接這個位址,即可使用資源庫中的全部伺服器",+ "{name} is given to each agent directly": "{name} 直接提供給各 Agent","Connect…": "連線…","Connect an app": "連線應用程式","{agent} no longer has the library's servers — restart it to read the change": "{agent} 不再使用資源庫的伺服器——重新啟動後生效",@@ -1498,6 +1504,9 @@ magpie.strings({"1 server": "1 サーバー","{first} and {n} more": "{first} ほか {n} 件","Other apps": "ほかのアプリ",+ "Hub address": "ハブのアドレス",+ "Any other app, as Cursor or VS Code, connects here for every server in the library": "Cursor や VS Code などほかのアプリは、このアドレスに接続するとライブラリのすべてのサーバーを使えます",+ "{name} is given to each agent directly": "{name} は各エージェントに直接渡されます","Connect…": "接続…","Connect an app": "アプリを接続","{agent} no longer has the library's servers — restart it to read the change": "{agent} はライブラリのサーバーを使わなくなりました。再起動すると反映されます",@@ -2218,6 +2227,9 @@ magpie.strings({"1 server": "1 Server","{first} and {n} more": "{first} und {n} weitere","Other apps": "Andere Apps",+ "Hub address": "Hub-Adresse",+ "Any other app, as Cursor or VS Code, connects here for every server in the library": "Andere Apps wie Cursor oder VS Code verbinden sich hier mit allen Servern der Bibliothek",+ "{name} is given to each agent directly": "{name} geht direkt an jeden Agenten","Connect…": "Verbinden…","Connect an app": "App verbinden","{agent} no longer has the library's servers — restart it to read the change": "{agent} hat die Server der Bibliothek nicht mehr – starte es neu, damit es die Änderung liest",diff --git a/internal/gui/assets/plugins/library/library.css b/internal/gui/assets/plugins/library/library.cssindex 19084a151..6fc3d08c3 100644--- a/internal/gui/assets/plugins/library/library.css+++ b/internal/gui/assets/plugins/library/library.css@@ -134,6 +134,9 @@ button.row.lib-hubfolded:hover { background: var(--pill); }/* the glyph at the front of a row: drawn, in the text colour */.lib-glyph { flex: none; width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; color: var(--fg-2); background: var(--pill); }.lib-glyph svg { width: 15px; height: 15px; }+/* the hub's mark: magpie's bird on the glyph's tile */+.lib-glyph.lib-hubmark { color: var(--fg); }+.lib-glyph.lib-hubmark svg { width: 17px; height: 17px; }.lib-rtk-logo .mask { width: 20px; height: 20px; background: currentColor; -webkit-mask: var(--i) center / contain no-repeat; mask: var(--i) center / contain no-repeat; }.mk-icon.lib-logo { flex: none; width: 26px; height: 26px; border-radius: 7px; }.lib-editor .ehead .mk-icon.lib-logo { width: 24px; height: 24px; }diff --git a/internal/gui/tests/library-mcp-hub.test.cjs b/internal/gui/tests/library-mcp-hub.test.cjsindex 93a2ab6f8..ccc691fd9 100644--- a/internal/gui/tests/library-mcp-hub.test.cjs+++ b/internal/gui/tests/library-mcp-hub.test.cjs@@ -49,6 +49,8 @@ const fixture = (on, st = {}) => ({servers: [{ name: "my-tools", transport: "stdio", command: "node", args: [`${HOME}/code/my-tools/index.js`], agents: ["claude", "codex", "claude-desktop", ...(st.cursorOn ? ["cursor"] : [])] },{ name: "notes", transport: "stdio", command: "uvx", args: ["notes-mcp"], agents: ["claude", "codex", ...(st.cursorOn ? ["cursor"] : [])] },+ // magpie's own: given to each agent as it is, and the hub says so+ { name: "magpie-image", transport: "stdio", command: "/Applications/magpie.app/Contents/MacOS/magpie", args: ["mcp", "image"], agents: ["claude"] },],});@@ -175,10 +177,13 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",assert.equal((await v.locator(".lib-hub .sub.wraps").textContent()).trim(), w("Each agent is given one server, magpie, in place of these. magpie runs each server once for all of them and hands each call to it, as server__tool. Restart an agent for it to read the change."));// what it serves: two servers, 2 tools each once checked, in Claude Codeawait page.waitForFunction((x) => document.querySelector("#view-library .lib-hubstats")?.textContent === x,- [w("{n} servers", { n: 2 }), w("{n} tools", { n: 4 }), w("in {agents}", { agents: "Claude Code" })].join(" · "));+ [w("{n} servers", { n: 2 }), w("{n} tools", { n: 4 }), w("in {agents}", { agents: "Claude Code" }), w("{name} is given to each agent directly", { name: "magpie-image" })].join(" · "));+ // the hub's mark is magpie's bird (the owner didn't like a made-up glyph)+ assert.equal(await v.locator('.lib-hub > .lib-hubmark use[href="#bird"]').count(), 1);// the address any other app connects atconst at = v.locator(".lib-hubat");- assert.equal((await at.locator(".name").textContent()).trim(), w("Other apps"));+ // the row says what it is (the owner: "Other apps" over an address read as nonsense)+ assert.equal((await at.locator(".name").textContent()).trim(), w("Hub address"));assert.equal((await at.locator(".lib-hubURL").textContent()).trim(), url);assert.equal((await at.locator(".lib-hubconnect").textContent()).trim(), w("Connect…"));const why = v.locator(".lib-hub-why");@@ -205,7 +210,8 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",// one agent that can be: named, not countedassert.equal(await lead(), web ? w("{agent} uses the library's servers through magpie", { agent: "Claude Code" }) : w("{on} of {all} agents use the library's servers through magpie", { on: 1, all: 2 }));assert.equal((await sheet.locator(".lib-hubsub").textContent()).trim().replace(/\u00a0/g, " "),- [web ? w("Each server runs once, for all of them") : w("{n} more can be connected", { n: 1 }), w("{n} keep each server's own entry", { n: 2 })].join(" · "));+ [web ? w("Each server runs once, for all of them") : w("{n} more can be connected", { n: 1 }), w("{n} keep each server's own entry", { n: 2 }), w("{name} is given to each agent directly", { name: "magpie-image" })].join(" · "));+ assert.equal(await sheet.locator('.ehead > .lib-hubmark use[href="#bird"]').count(), 1);// a few agents: no search, nothing foldedassert.equal(await sheet.locator(".lib-hubsearch, .lib-hubfolded, .lib-hubfold").count(), 0);const groups = () => sheet.locator(".lib-hubgrp").evaluateAll((gs) => gs.map((g) => [g.dataset.group, [...g.querySelectorAll(".lib-hubagent")].map((r) => r.dataset.agent)]));