library: the MCP market puts the most used servers first, counted from the day's report

gugediyige666 and freedomf26 on X asked for an MCP list ranked by
downloads, searchable and installable. Search and install from the list
were already there; skills were already ranked by skills.sh's install
counts. What was missing was a count of who uses each MCP server.

- internal/library/market_public.go: PublicServers names the Library's
  servers that an agent is given and that the market lists from what
  ships with magpie (featured, or the registry snapshot), by market id
  only, matched by serverKey. A bare command names no package and is
  never matched; a server of the user's own, one found only by a
  search, and its address, command or keys never go.
- internal/stats/plugins.go: the day's plugin report carries them as
  "servers" (at most 50), and goes when either list has something.
  PluginCounts returns a Board with plugins and servers.
- site/pluginstats.js: servers are kept as mcp:<id> beside the plugins,
  pruned apart (D1 binds at most 100 values a statement; the test's
  stand-in now enforces that), never liked, and /api/plugins/stats
  returns them under servers.
- GUI: with nothing searched, a server with 20 or more users comes
  first, most used first, with a person chip of its count; the rest
  keep the curated order. Counts are waited for at most a second, so a
  drawn list never reorders; a search keeps the registry's ranking; a
  failed ask is tried again after a minute, not with every search.
- Privacy text: READMEs (en, zh), site privacy and start pages (en, zh,
  ja), reference.md, the Settings privacy row (zh, zh-TW, ja, de),
  llms-full.txt and search indexes rebuilt; docs/subsystems/library.md.

Run (mote, rebased on 18fe1e2dc; budget, TestI18n*, i18n-keys, market-used and privacy-usage-stats again at b53e23ba3, ok):
- go test ./internal/library ./internal/stats ./internal/gui (TestPublicServers,
  TestPublicServerIDsAreCatalogIDs, TestSendPlugins, TestPluginCounts,
  TestCoreScriptBudget, TestI18n*): ok. gofmt -l clean; go vet darwin ok,
  GOOS=linux/windows CGO_ENABLED=0 vet of library and stats ok.
- node --test site/pluginstats.test.mjs: 8 of 8.
- GUI, chromium and webkit, en/zh/zh-TW/ja/de: market-used (new, 30 of
  30), i18n-keys, i18n-en-no-cjk, market-*, plugin-market, privacy-*,
  library-pi-market: 284 of 284.
- Broken by hand: matching a bare command made TestPublicServers name
  "bare-one"; turning byUse off made market-used red. The old single
  DELETE of 100+ bound values made the new site test red.

Not run before the push: the full Go suite and the whole GUI suite.
mote and mica were both running other sessions' full and GUI suites
(load 45 to 270); they run after, on mote. Not tried: a real day's
report reaching usemagpie.ai from a live install (the worker is
checked with curl after deploy).
This commit is contained in:
yetone
2026-11-18 13:39:27 +08:00
parent b53e23ba3e
commit 888d4eba52
29 changed files with 506 additions and 89 deletions
+1 -1
View File
@@ -296,7 +296,7 @@ Find them under Plugins › Discover › Gateway middleware. See [Gateway middle
## Privacy
Your prompts, replies, keys and accounts go only to the providers you use, and with [privacy masking](#privacy-masking) on, the secrets in them don't go even there. Once a day a released magpie tells us it is in use: a random id, its version and system, and which agents, providers and models it is used with, by magpie's own ids (a provider you added yourself is only `custom`), which of the plugins Discover lists are installed, so it can show how many use each one, and for each partner listed first in the add sheet, how many times a day it was shown, opened and added (counts only). No names, URLs, accounts, keys, prompts or usage. Turn part or all of it off in **Settings → Privacy**, or with `DO_NOT_TRACK=1`. A partner's website and key links go through `usemagpie.ai/go/…`, which counts the click, and usemagpie.ai counts fetches of the partner list; the server sees these whatever the settings, and keeps no id or address. Icons named by a plugin, an import link or the library are fetched through `usemagpie.ai/api/icon`, so their hosts see Cloudflare's address, not yours; the server only passes the picture on, and counts and keeps nothing. The [Privacy page](https://usemagpie.ai/docs/privacy) lists everything magpie sends by itself, with an example and every switch; the [reference](docs/reference.md#counting-users) has the rules.
Your prompts, replies, keys and accounts go only to the providers you use, and with [privacy masking](#privacy-masking) on, the secrets in them don't go even there. Once a day a released magpie tells us it is in use: a random id, its version and system, and which agents, providers and models it is used with, by magpie's own ids (a provider you added yourself is only `custom`), which of the plugins Discover lists are installed and which of the Library market’s MCP servers you use, by their market ids, so they can show how many use each one, and for each partner listed first in the add sheet, how many times a day it was shown, opened and added (counts only). No names, URLs, accounts, keys, prompts or usage. Turn part or all of it off in **Settings → Privacy**, or with `DO_NOT_TRACK=1`. A partner's website and key links go through `usemagpie.ai/go/…`, which counts the click, and usemagpie.ai counts fetches of the partner list; the server sees these whatever the settings, and keeps no id or address. Icons named by a plugin, an import link or the library are fetched through `usemagpie.ai/api/icon`, so their hosts see Cloudflare's address, not yours; the server only passes the picture on, and counts and keeps nothing. The [Privacy page](https://usemagpie.ai/docs/privacy) lists everything magpie sends by itself, with an example and every switch; the [reference](docs/reference.md#counting-users) has the rules.
## Community
+1 -1
View File
@@ -296,7 +296,7 @@ magpie plugin options model-map '{"mapping": {"fast": "deepseek/deepseek-chat"}}
## 隐私
你的提示词、回复、密钥和账号只发给你用的供应商;打开[隐私脱敏](#隐私脱敏)后,其中的密钥连供应商也收不到。正式版 magpie 每天告诉我们一次它在用:一个随机 ID、版本和系统,以及用了哪些 agent、供应商和模型,只用 magpie 自己的 ID(你自己添加的供应商只记作 `custom`),装了 Discover 里的哪些插件(用于显示每个插件的在用人数),以及添加供应商页里排在最前的合作伙伴每天被展示、打开和添加的次数(只有次数)。不发送名称、URL、账号、密钥、提示词和用量。可以在 **设置 → 隐私** 里关掉一部分或全部,也可以设 `DO_NOT_TRACK=1`。合作伙伴的官网和获取 Key 链接经 `usemagpie.ai/go/…` 跳转并计一次点击,usemagpie.ai 也统计合作伙伴列表的拉取次数;这是服务器本身看到的,不受设置影响,不记录 ID 和 IP。插件、导入链接和库里的图标经 `usemagpie.ai/api/icon` 获取,图标所在的服务器只看到 Cloudflare 的地址,看不到你的 IP;这台服务器只转发图片,不计数也不记录。[隐私页](https://usemagpie.ai/docs/zh/privacy)列出了 magpie 自己发出的所有内容,附示例和每个开关;规则见[参考文档](docs/reference.md#counting-users)。
你的提示词、回复、密钥和账号只发给你用的供应商;打开[隐私脱敏](#隐私脱敏)后,其中的密钥连供应商也收不到。正式版 magpie 每天告诉我们一次它在用:一个随机 ID、版本和系统,以及用了哪些 agent、供应商和模型,只用 magpie 自己的 ID(你自己添加的供应商只记作 `custom`),装了 Discover 里的哪些插件、用了资源库市场里的哪些 MCP 服务器(只用市场 ID,用于显示每个的在用人数),以及添加供应商页里排在最前的合作伙伴每天被展示、打开和添加的次数(只有次数)。不发送名称、URL、账号、密钥、提示词和用量。可以在 **设置 → 隐私** 里关掉一部分或全部,也可以设 `DO_NOT_TRACK=1`。合作伙伴的官网和获取 Key 链接经 `usemagpie.ai/go/…` 跳转并计一次点击,usemagpie.ai 也统计合作伙伴列表的拉取次数;这是服务器本身看到的,不受设置影响,不记录 ID 和 IP。插件、导入链接和库里的图标经 `usemagpie.ai/api/icon` 获取,图标所在的服务器只看到 Cloudflare 的地址,看不到你的 IP;这台服务器只转发图片,不计数也不记录。[隐私页](https://usemagpie.ai/docs/zh/privacy)列出了 magpie 自己发出的所有内容,附示例和每个开关;规则见[参考文档](docs/reference.md#counting-users)。
## 社区
+7 -1
View File
@@ -4625,7 +4625,13 @@ and models to look after first, by magpie's own ids only:
installed and on (npm names, or `github:owner/repo` for a repository
tagged `magpie-plugin`; never a folder, a private repository or an
unlisted package), with the same id, so Discover can say how many use
each (the ids that reported it in 7 days). A like on a plugin's page
each (the ids that reported it in 7 days). The same report names the
Library's MCP servers that an agent is given and that the market lists
from what ships with magpie (featured, or the registry snapshot), by
their market ids only (`context7`, `io.github.owner/name`; at most 50),
so the market can put the most used first; a server of the user's own,
one found only by a search, and its address, command or keys never go
(`library.PublicServers`). A like on a plugin's page
goes there too, only for a plugin installed here, and is kept in
`~/.config/magpie/plugin-likes.json`. The code is
[internal/stats/plugins.go](../internal/stats/plugins.go) and
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -22061,7 +22061,7 @@ function renderRedact(s, keep) {
}, settingsErr))).id = "agentTelemetryAllRow";
rowIn(share, t("Count me as a user"), t("Once a day, a random id for this computer with magpie's version and system"),
onOff(!s.noStats, (on) => savePrefs({ ...keep, noStats: !on })));
if (!s.noStats) rowIn(share, t("Share the agents, providers, models and plugins I use"), t("Sent with that event, by magpie's own ids, with how many of each, and how often each partner was shown, opened and added; a provider you added yourself is only “custom”. Which of Discover's plugins are installed goes to usemagpie.ai for its counts. No names, addresses, accounts, keys or usage"),
if (!s.noStats) rowIn(share, t("Share the agents, providers, models and plugins I use"), t("Sent with that event, by magpie's own ids, with how many of each, and how often each partner was shown, opened and added; a provider you added yourself is only “custom”. Which of Discover's plugins are installed, and which of the Library market's MCP servers you use, go to usemagpie.ai for their counts. No names, addresses, accounts, keys or usage"),
onOff(!s.noUsageStats, (on) => savePrefs({ ...keep, noUsageStats: !on })));
if (!featureHides($('#nav button[data-view="masking"]'))) {
const open = el("button", "", t("Open"));
+4 -4
View File
@@ -1442,7 +1442,7 @@ const I18N = {
"Count me as a user": "计入用户数",
"Once a day, a random id for this computer with magpie's version and system": "每天一次,发送本机随机 ID、magpie 版本和系统",
"Share the agents, providers, models and plugins I use": "分享我用的 agent、provider、模型和插件",
"Sent with that event, by magpie's own ids, with how many of each, and how often each partner was shown, opened and added; a provider you added yourself is only “custom”. Which of Discover's plugins are installed goes to usemagpie.ai for its counts. No names, addresses, accounts, keys or usage": "随上面那条一起发送:只用 magpie 内置的 ID 和各自的数量,以及每个合作伙伴被展示、打开和添加的次数;你自己添加的 provider 只记作“custom”。装了 Discover 里的哪些插件会发给 usemagpie.ai,用于插件的使用人数。不含名称、地址、账号、密钥和用量",
"Sent with that event, by magpie's own ids, with how many of each, and how often each partner was shown, opened and added; a provider you added yourself is only “custom”. Which of Discover's plugins are installed, and which of the Library market's MCP servers you use, go to usemagpie.ai for their counts. No names, addresses, accounts, keys or usage": "随上面那条一起发送:只用 magpie 内置的 ID 和各自的数量,以及每个合作伙伴被展示、打开和添加的次数;你自己添加的 provider 只记作“custom”。装了 Discover 里的哪些插件、用了资源库市场里的哪些 MCP 服务器,会发给 usemagpie.ai,用于统计使用人数。不含名称、地址、账号、密钥和用量",
"Warm-up and check-in": "预热与签到",
"Warm up on reset": "窗口重置时预热",
"Daily warm-up": "每日定时预热",
@@ -6922,7 +6922,7 @@ const I18N = {
"Count me as a user": "計入使用者數",
"Once a day, a random id for this computer with magpie's version and system": "每天一次,傳送本機隨機 ID、magpie 版本和系統",
"Share the agents, providers, models and plugins I use": "分享我用的 agent、provider、模型和外掛",
"Sent with that event, by magpie's own ids, with how many of each, and how often each partner was shown, opened and added; a provider you added yourself is only “custom”. Which of Discover's plugins are installed goes to usemagpie.ai for its counts. No names, addresses, accounts, keys or usage": "隨上面那則一起傳送:只用 magpie 內建的 ID 和各自的數量,以及每個合作夥伴被展示、開啟和新增的次數;你自己新增的 provider 只記作「custom」。裝了 Discover 裡的哪些外掛會傳給 usemagpie.ai,用於外掛的使用人數。不含名稱、位址、帳號、金鑰和用量",
"Sent with that event, by magpie's own ids, with how many of each, and how often each partner was shown, opened and added; a provider you added yourself is only “custom”. Which of Discover's plugins are installed, and which of the Library market's MCP servers you use, go to usemagpie.ai for their counts. No names, addresses, accounts, keys or usage": "隨上面那則一起傳送:只用 magpie 內建的 ID 和各自的數量,以及每個合作夥伴被展示、開啟和新增的次數;你自己新增的 provider 只記作「custom」。裝了 Discover 裡的哪些外掛、用了資源庫市集裡的哪些 MCP 伺服器,會傳給 usemagpie.ai,用於統計使用人數。不含名稱、位址、帳號、金鑰和用量",
"Warm-up and check-in": "預熱與簽到",
"Warm up on reset": "時段重置時預熱",
"Daily warm-up": "每日定時預熱",
@@ -12368,7 +12368,7 @@ const I18N = {
"Count me as a user": "ユーザー数に含める",
"Once a day, a random id for this computer with magpie's version and system": "1 日 1 回、このコンピュータのランダムな ID と magpie のバージョン、システムを送信します",
"Share the agents, providers, models and plugins I use": "使っているエージェント、プロバイダー、モデル、プラグインを共有",
"Sent with that event, by magpie's own ids, with how many of each, and how often each partner was shown, opened and added; a provider you added yourself is only “custom”. Which of Discover's plugins are installed goes to usemagpie.ai for its counts. No names, addresses, accounts, keys or usage": "上の送信に含めます。magpie 組み込みの ID とそれぞれの数、各パートナーが表示・選択・追加された回数だけで、自分で追加したプロバイダーは「custom」とだけ記録します。Discover のどのプラグインを入れているかは、利用者数のために usemagpie.ai に送ります。名前、アドレス、アカウント、キー、使用量は含みません",
"Sent with that event, by magpie's own ids, with how many of each, and how often each partner was shown, opened and added; a provider you added yourself is only “custom”. Which of Discover's plugins are installed, and which of the Library market's MCP servers you use, go to usemagpie.ai for their counts. No names, addresses, accounts, keys or usage": "上の送信に含めます。magpie 組み込みの ID とそれぞれの数、各パートナーが表示・選択・追加された回数だけで、自分で追加したプロバイダーは「custom」とだけ記録します。Discover のどのプラグインを入れているか、ライブラリのマーケットのどの MCP サーバーを使っているかは、利用者数のために usemagpie.ai に送ります。名前、アドレス、アカウント、キー、使用量は含みません",
"Warm-up and check-in": "ウォームアップとチェックイン",
"Warm up on reset": "リセット時にウォームアップ",
"Daily warm-up": "毎日のウォームアップ",
@@ -17831,7 +17831,7 @@ const I18N = {
"Count me as a user": "Mich als Nutzer zählen",
"Once a day, a random id for this computer with magpie's version and system": "Einmal täglich eine zufällige ID dieses Computers mit magpie-Version und System",
"Share the agents, providers, models and plugins I use": "Meine Agents, Anbieter, Modelle und Plugins teilen",
"Sent with that event, by magpie's own ids, with how many of each, and how often each partner was shown, opened and added; a provider you added yourself is only “custom”. Which of Discover's plugins are installed goes to usemagpie.ai for its counts. No names, addresses, accounts, keys or usage": "Mit diesem Ereignis, nur mit magpies eigenen IDs und ihrer Anzahl sowie wie oft jeder Partner gezeigt, geöffnet und hinzugefügt wurde; ein selbst hinzugefügter Anbieter heißt nur „custom“. Welche Plugins aus Discover installiert sind, geht für deren Zählung an usemagpie.ai. Keine Namen, Adressen, Konten, Schlüssel oder Nutzung",
"Sent with that event, by magpie's own ids, with how many of each, and how often each partner was shown, opened and added; a provider you added yourself is only “custom”. Which of Discover's plugins are installed, and which of the Library market's MCP servers you use, go to usemagpie.ai for their counts. No names, addresses, accounts, keys or usage": "Mit diesem Ereignis, nur mit magpies eigenen IDs und ihrer Anzahl sowie wie oft jeder Partner gezeigt, geöffnet und hinzugefügt wurde; ein selbst hinzugefügter Anbieter heißt nur „custom“. Welche Plugins aus Discover installiert sind und welche MCP-Server aus dem Markt der Bibliothek du nutzt, geht für deren Zählung an usemagpie.ai. Keine Namen, Adressen, Konten, Schlüssel oder Nutzung",
"Warm-up and check-in": "Vorwärmen und Check-in",
"Warm up on reset": "Beim Reset vorwärmen",
"Daily warm-up": "Tägliches Vorwärmen",
+33 -1
View File
@@ -8549,6 +8549,24 @@ magpie.plugin("library", (ctx) => {
};
// how many cards a list shows at first, and each Show more adds
const MARKET_PAGE = 60;
// Who uses each server, by its market id: the computers whose library
// had it in the last week (usemagpie.ai, through /api/plugins/counts),
// asked at most hourly. A server with USED of them goes first, most used
// first; the rest keep the market's own order, featured first.
const USED = 20;
let serverUsers = {}, usersAsked = 0, usersAsk = null;
function askServerUsers() {
if (!usersAsk || Date.now() - usersAsked > 36e5) {
usersAsked = Date.now();
usersAsk = api("plugins/counts").then((r) => { serverUsers = r.servers || {}; }, () => { usersAsked = Date.now() - 36e5 + 6e4; }); // a failed ask is tried again in a minute, not with every search
}
return usersAsk;
}
const usersOf = (x) => serverUsers[x.id]?.users || 0;
function byUse(items) {
const used = items.filter((x) => usersOf(x) >= USED).sort((a, b) => usersOf(b) - usersOf(a));
return used.length ? [...used, ...items.filter((x) => usersOf(x) < USED)] : items;
}
const asked = new Set(); // skills whose description has been asked for
async function fetchMarket(kind) {
@@ -8556,10 +8574,17 @@ magpie.plugin("library", (ctx) => {
const seq = ++m.seq;
m.loading = true;
drawMarket(kind);
// the counts are asked beside the list, and waited for only briefly:
// a list already drawn is never reordered under the reader
const users = kind === "mcp" ? askServerUsers() : null;
try {
const r = await api("library/market/" + ({ mcp: "servers", skills: "skills", pi: "pi" })[kind] + "?q=" + encodeURIComponent(m.q.trim()));
if (users) await Promise.race([users, new Promise((ok) => setTimeout(ok, 1000))]);
if (seq !== m.seq) return;
m.items = r.items || [];
// a search keeps the registry's ranking
m.byUse = kind === "mcp" && !m.q.trim() && m.items.some((x) => usersOf(x) >= USED);
if (m.byUse) m.items = byUse(m.items);
m.shown = MARKET_PAGE;
m.error = r.error || "";
// the source that didn't answer when the rest did (#1589)
@@ -8644,7 +8669,7 @@ magpie.plugin("library", (ctx) => {
box.classList.toggle("loading", m.loading);
const note = box.querySelector(".mk-note");
note.textContent = q && m.items ? (m.items.length === 1 ? t("1 result") : t("{n} results", { n: m.items.length }))
: kind === "mcp" ? t("Featured, and the official MCP Registry") : kind === "pi" ? t("Most downloaded on npm") : t("Popular on skills.sh");
: kind === "mcp" ? (m.byUse ? t("Most used first, then featured and the MCP Registry") : t("Featured, and the official MCP Registry")) : kind === "pi" ? t("Most downloaded on npm") : t("Popular on skills.sh");
const grid = box.querySelector(".mk-grid");
grid.replaceChildren();
if (!m.items) {
@@ -8784,6 +8809,13 @@ magpie.plugin("library", (ctx) => {
const d = el("p", "mk-desc", about(x));
d.title = about(x);
const foot = el("div", "mk-foot");
const n = usersOf(x);
if (n) {
const u = el("span", "mk-installs");
u.append(svg(GLYPH.person, 11, 1.5), el("span", "", compact(n)));
u.title = t("{n} people use it, counted from the last week", { n: n.toLocaleString(intlLang()) });
foot.append(u);
}
foot.append(el("span", "mk-id mono", x.name), el("span", "grow"), (needsKey(x) || x.optIn) && !x.have ? button(t("Add…"), "action mk-add", () => serverSheet(x)) : addButton(x, () => addServer(x, {}, null)));
c.append(top, d, foot);
c.onclick = () => serverSheet(x);
@@ -943,6 +943,7 @@ magpie.strings({
"1 result": "1 个结果",
"{n} results": "{n} 个结果",
"Featured, and the official MCP Registry": "精选,以及官方 MCP Registry",
"Most used first, then featured and the MCP Registry": "最多人用的在前,然后是精选和 MCP Registry",
"Popular on skills.sh": "skills.sh 热门",
"skills.sh's search didn't answer ({error}), so these are only the matches among magpie's picks and the most installed skills.": "skills.sh 的搜索这次没有响应({error}),下面只是 magpie 精选和最热门技能里匹配的结果。",
"The MCP Registry didn't answer ({error}), so these are only magpie's featured servers that match.": "MCP Registry 这次没有响应({error}),下面只是 magpie 精选服务器里匹配的结果。",
@@ -2040,6 +2041,7 @@ magpie.strings({
"1 result": "1 個結果",
"{n} results": "{n} 個結果",
"Featured, and the official MCP Registry": "精選,以及官方 MCP Registry",
"Most used first, then featured and the MCP Registry": "最多人用的在前,然後是精選和 MCP Registry",
"Popular on skills.sh": "skills.sh 熱門",
"skills.sh's search didn't answer ({error}), so these are only the matches among magpie's picks and the most installed skills.": "skills.sh 的搜尋這次沒有回應({error}),下面只是 magpie 精選和最熱門技能裡符合的結果。",
"The MCP Registry didn't answer ({error}), so these are only magpie's featured servers that match.": "MCP Registry 這次沒有回應({error}),下面只是 magpie 精選伺服器裡符合的結果。",
@@ -3136,6 +3138,7 @@ magpie.strings({
"1 result": "1 件の結果",
"{n} results": "{n} 件の結果",
"Featured, and the official MCP Registry": "おすすめと公式 MCP Registry",
"Most used first, then featured and the MCP Registry": "利用者の多い順、続いておすすめと MCP Registry",
"Popular on skills.sh": "skills.sh で人気",
"skills.sh's search didn't answer ({error}), so these are only the matches among magpie's picks and the most installed skills.": "skills.sh の検索が応答しませんでした({error})。以下は magpie のおすすめと人気のスキルのうち一致したものだけです。",
"The MCP Registry didn't answer ({error}), so these are only magpie's featured servers that match.": "MCP Registry が応答しませんでした({error})。以下は magpie のおすすめサーバーのうち一致したものだけです。",
@@ -4233,6 +4236,7 @@ magpie.strings({
"1 result": "1 Ergebnis",
"{n} results": "{n} Ergebnisse",
"Featured, and the official MCP Registry": "Empfohlen und die offizielle MCP Registry",
"Most used first, then featured and the MCP Registry": "Die meistgenutzten zuerst, dann Empfohlene und die MCP Registry",
"Popular on skills.sh": "Beliebt auf skills.sh",
"skills.sh's search didn't answer ({error}), so these are only the matches among magpie's picks and the most installed skills.": "Die Suche von skills.sh hat nicht geantwortet ({error}). Das hier sind nur die Treffer unter magpies Empfehlungen und den meistinstallierten Skills.",
"The MCP Registry didn't answer ({error}), so these are only magpie's featured servers that match.": "Die MCP Registry hat nicht geantwortet ({error}). Das hier sind nur die passenden Server aus magpies Empfehlungen.",
@@ -596,7 +596,7 @@ input.lib-setname:focus { border-color: var(--accent); box-shadow: 0 0 0 3px col
.mk-desc.wait { background: linear-gradient(90deg, var(--pill) 25%, var(--pill-hover) 45%, var(--pill) 65%); background-size: 240% 100%; animation: skeleton-shift 1.4s ease-in-out infinite; border-radius: 5px; min-height: 0; height: 8px; margin: 6px 20% 10px 0; }
.mk-foot { display: flex; align-items: center; gap: 8px; min-height: 26px; margin-top: auto; }
.mk-id { min-width: 0; font: var(--code-style, normal) var(--code-weight, 400) 11px var(--code-font, var(--code)); font-stretch: var(--code-stretch, 100%); color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mk-installs { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mk-installs { flex: none; display: inline-flex; align-items: center; gap: 3px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mk-add { flex: none; height: 26px; }
.mk-add.busy { color: var(--muted); }
.mk-have { flex: none; display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 4px; font-size: 12px; color: var(--muted); }
+19 -13
View File
@@ -18,13 +18,13 @@ import (
)
// Discover's counts, from usemagpie.ai (stats): each plugin's users and
// likes, asked at most every hour, and the plugins liked here, kept on
// this computer.
// likes, and each MCP server's users for the Library's market, asked at
// most every hour, and the plugins liked here, kept on this computer.
var (
countsMu sync.Mutex
countsAt time.Time
countsGot map[string]stats.Counts
countsGot *stats.Board
)
// pluginCountsAsk and pluginLike are stats', for tests to stand in for.
@@ -63,28 +63,34 @@ func saveLiked(l []string) error {
// pluginCounts is the counts held, asked again when an hour old; a failed
// ask keeps what was held, tried again in a minute.
func pluginCounts(ctx context.Context) (map[string]stats.Counts, error) {
func pluginCounts(ctx context.Context) (stats.Board, error) {
countsMu.Lock()
defer countsMu.Unlock()
if countsGot != nil && time.Since(countsAt) < time.Hour {
return countsGot, nil
return *countsGot, nil
}
got, err := pluginCountsAsk(ctx)
if err != nil {
countsAt = time.Now().Add(-time.Hour + time.Minute)
return countsGot, err
if countsGot != nil {
return *countsGot, err
}
return stats.Board{}, err
}
countsGot, countsAt = got, time.Now()
countsGot, countsAt = &got, time.Now()
return got, nil
}
func pluginCountRoutes(mux *http.ServeMux) {
mux.HandleFunc("GET /api/plugins/counts", func(rw http.ResponseWriter, r *http.Request) {
got, err := pluginCounts(r.Context())
out := map[string]any{"plugins": got, "liked": liked()}
if got == nil {
out["plugins"] = map[string]stats.Counts{}
if got.Plugins == nil {
got.Plugins = map[string]stats.Counts{}
}
if got.Servers == nil {
got.Servers = map[string]stats.Counts{}
}
out := map[string]any{"plugins": got.Plugins, "servers": got.Servers, "liked": liked()}
if err != nil {
out["error"] = err.Error()
}
@@ -121,10 +127,10 @@ func pluginCountRoutes(mux *http.ServeMux) {
return
}
countsMu.Lock()
if countsGot != nil {
c := countsGot[in.Name]
if countsGot != nil && countsGot.Plugins != nil {
c := countsGot.Plugins[in.Name]
c.Likes = n
countsGot[in.Name] = c
countsGot.Plugins[in.Name] = c
}
countsMu.Unlock()
writeJSON(rw, map[string]any{"likes": n, "liked": l})
+11 -6
View File
@@ -13,7 +13,8 @@ import (
"github.com/yetone/magpie/internal/stats"
)
// Discover's counts are asked once an hour; a like is taken only for a
// Discover's counts, and the Library market's servers', are asked once
// an hour; a like is taken only for a
// plugin installed here that Discover lists, is kept on this computer,
// and moves the count held at once.
func TestPluginCountsAndLikes(t *testing.T) {
@@ -26,12 +27,15 @@ func TestPluginCountsAndLikes(t *testing.T) {
})
countsGot = nil
fail := false
pluginCountsAsk = func(context.Context) (map[string]stats.Counts, error) {
pluginCountsAsk = func(context.Context) (stats.Board, error) {
asked++
if fail {
return nil, errors.New("offline")
return stats.Board{}, errors.New("offline")
}
return map[string]stats.Counts{"opencode-a": {Users: 12, Likes: 3}}, nil
return stats.Board{
Plugins: map[string]stats.Counts{"opencode-a": {Users: 12, Likes: 3}},
Servers: map[string]stats.Counts{"context7": {Users: 40}},
}, nil
}
pluginLike = func(_ context.Context, name string, on bool) (int, error) {
likes[name] = on
@@ -44,6 +48,7 @@ func TestPluginCountsAndLikes(t *testing.T) {
get := func() (out struct {
Plugins map[string]stats.Counts `json:"plugins"`
Servers map[string]stats.Counts `json:"servers"`
Liked []string `json:"liked"`
Error string `json:"error"`
}) {
@@ -63,7 +68,7 @@ func TestPluginCountsAndLikes(t *testing.T) {
return rec
}
if c := get(); c.Plugins["opencode-a"] != (stats.Counts{Users: 12, Likes: 3}) || len(c.Liked) != 0 {
if c := get(); c.Plugins["opencode-a"] != (stats.Counts{Users: 12, Likes: 3}) || c.Servers["context7"].Users != 40 || len(c.Liked) != 0 {
t.Fatalf("first: %+v", c)
}
get()
@@ -90,7 +95,7 @@ func TestPluginCountsAndLikes(t *testing.T) {
// an hour on, a failed ask keeps what was held
countsAt = countsAt.Add(-2 * 60 * 60 * 1e9)
fail = true
if c := get(); c.Plugins["opencode-a"].Users != 12 || c.Error == "" {
if c := get(); c.Plugins["opencode-a"].Users != 12 || c.Servers["context7"].Users != 40 || c.Error == "" {
t.Fatalf("a failed ask: %+v", c)
}
}
+127
View File
@@ -0,0 +1,127 @@
// Run with Node's test runner and Playwright on the module path; see README.md.
// The MCP market by real use (gugediyige666 on X: rank the servers by
// installs): with nothing searched, a server that USED (20) computers'
// libraries had in the last week goes first, most used first, and the rest
// keep the market's own order, featured first. Each card with users says
// how many. Fewer than that, or no counts at all, keeps the curated order;
// a search keeps the registry's ranking and still shows the counts. Every
// language, a narrow window, both engines. No backend: the API is faked.
const assert = require("node:assert/strict");
const fs = require("node:fs/promises");
const path = require("node:path");
const { test } = require("node:test");
const { chromium, webkit } = require("playwright");
const assets = path.resolve(__dirname, "../assets");
const HOME = "/Users/tester";
const servers = [
{ id: "context7", name: "context7", title: "Context7", featured: true, transport: "http", runs: "remote", inputs: [] },
{ id: "playwright", name: "playwright", title: "Playwright", featured: true, transport: "stdio", runs: "npx", inputs: [] },
...Array.from({ length: 12 }, (_, i) => ({ id: `io.github.o${i}/m${i}`, name: `m${i}`, title: `Server ${i}`, description: `Server number ${i}.`, transport: "stdio", runs: "npx", inputs: [] })),
];
const note = {
en: ["Most used first, then featured and the MCP Registry", "Featured, and the official MCP Registry"],
zh: ["最多人用的在前,然后是精选和 MCP Registry", "精选,以及官方 MCP Registry"],
"zh-TW": ["最多人用的在前,然後是精選和 MCP Registry", "精選,以及官方 MCP Registry"],
ja: ["利用者の多い順、続いておすすめと MCP Registry", "おすすめと公式 MCP Registry"],
de: ["Die meistgenutzten zuerst, dann Empfohlene und die MCP Registry", "Empfohlen und die offizielle MCP Registry"],
};
const people = { en: "1,200 people use it, counted from the last week", zh: "1,200 人在用(近 7 天)", ja: "1,200 人が利用中(直近 7 日)" };
function serve(lang, counts, asked) {
return async (route) => {
const url = new URL(route.request().url());
const json = (data) => route.fulfill({ json: data });
if (url.pathname === "/boot.js") return route.fulfill({ contentType: "text/javascript", body: `window.bootPrefs = {lang:"${lang}",theme:"light",web:true};` });
if (url.pathname === "/wails/runtime.js") return route.fulfill({ contentType: "text/javascript", body: "export const Window = {};" });
if (url.pathname === "/api/state") return json({ agents: [], profiles: [], settings: { lang, theme: "light" } });
if (url.pathname === "/api/plugins") return json({ plugins: [] });
if (url.pathname === "/api/plugins/counts") {
asked.push(1);
return counts ? json({ plugins: {}, servers: counts, liked: [] }) : route.fulfill({ status: 500, json: { error: "offline" } });
}
if (url.pathname === "/api/library") {
return json({
dir: `${HOME}/.magpie/library`, backups: `${HOME}/.magpie/backups`, home: HOME,
agents: [{ id: "claude", name: "Claude Code", icon: "claudecode-color", skills: `${HOME}/.claude/skills`, mcp: `${HOME}/.claude.json` }],
instructions: { agents: [], sets: [] }, servers: [], foundServers: [], projects: [], foundSkills: [], skills: [], problems: [],
});
}
if (url.pathname === "/api/library/market/servers") {
const q = url.searchParams.get("q") || "";
// a search: the registry's own order, the last one first
return json({ items: q ? structuredClone(servers).filter((x) => x.name.startsWith(q)).reverse() : structuredClone(servers) });
}
if (url.pathname === "/api/library/icon") return route.fulfill({ status: 404, body: "" });
if (url.pathname === "/api/groups") return json({ groups: [] });
if (url.pathname === "/api/providers") return json({ providers: [], gateway: { running: true } });
if (url.pathname.startsWith("/api/")) return json({});
const file = path.join(assets, url.pathname === "/" ? "index.html" : url.pathname);
const contentType = { ".html": "text/html", ".js": "text/javascript", ".css": "text/css", ".svg": "image/svg+xml", ".png": "image/png" }[path.extname(file)];
const body = await fs.readFile(file).catch(() => null);
await (body ? route.fulfill({ body, contentType }) : route.fulfill({ status: 404, body: "" }));
};
}
const cases = {
used: { "io.github.o5/m5": { users: 50 }, "io.github.o9/m9": { users: 1200 }, playwright: { users: 3 } },
thin: { "io.github.o5/m5": { users: 19 }, playwright: { users: 3 } },
none: null,
};
for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) {
for (const lang of ["en", "zh", "zh-TW", "ja", "de"]) {
for (const [name, counts] of Object.entries(cases)) {
test(`${engine} ${lang} ${name}: the MCP market goes by real use where there is enough of it`, async (t) => {
const browser = await (engine === "webkit" ? webkit.launch() : chromium.launch({ channel: "chromium" }));
const context = await browser.newContext({ viewport: { width: 420, height: 760 }, reducedMotion: "reduce" });
const page = await context.newPage();
page.setDefaultTimeout(5000);
page.setDefaultNavigationTimeout(60000);
const errors = [];
page.on("pageerror", (e) => errors.push(e.message));
const asked = [];
await page.route("**/*", serve(lang, counts, asked));
await page.addInitScript(() => { try { localStorage.setItem("magpie.libTab", "mcp"); } catch {} });
t.after(() => browser.close());
await page.goto("http://magpie.test/?view=library");
const box = page.locator('#view-library .mk[data-market="mcp"]');
await box.locator(".mk-card").first().waitFor();
const ids = () => box.locator(".mk-card").evaluateAll((cs) => cs.map((c) => c.dataset.id));
const curated = servers.map((x) => x.id);
if (name === "used") {
assert.deepEqual(await ids(), ["io.github.o9/m9", "io.github.o5/m5", ...curated.filter((id) => id !== "io.github.o9/m9" && id !== "io.github.o5/m5")]);
assert.equal((await box.locator(".mk-note").textContent()).trim(), note[lang][0]);
const chip = box.locator('.mk-card[data-id="io.github.o9/m9"] .mk-installs');
assert.equal((await chip.textContent()).trim(), "1.2K");
if (people[lang]) assert.equal(await chip.getAttribute("title"), people[lang]);
// a few users still say so, in the curated place
assert.equal((await box.locator('.mk-card[data-id="playwright"] .mk-installs').textContent()).trim(), "3");
assert.equal(await box.locator('.mk-card[data-id="context7"] .mk-installs').count(), 0);
// the chip and the add button fit the narrow card
for (const id of ["io.github.o9/m9", "playwright"]) {
const fits = await box.locator(`.mk-card[data-id="${id}"]`).evaluate((c) => {
const r = c.getBoundingClientRect();
return [...c.querySelectorAll(".mk-foot > *")].every((e) => { const b = e.getBoundingClientRect(); return b.left >= r.left - 0.5 && b.right <= r.right + 0.5; });
});
assert(fits, id);
}
} else {
assert.deepEqual(await ids(), curated);
assert.equal((await box.locator(".mk-note").textContent()).trim(), note[lang][1]);
assert.equal(await box.locator('.mk-card[data-id="io.github.o9/m9"] .mk-installs').count(), 0);
}
// a search keeps the registry's order, counts shown or not
await box.locator('input[data-lib="market-mcp"]').fill("m");
const found = servers.filter((x) => x.name.startsWith("m")).reverse().map((x) => x.id);
await page.waitForFunction((n) => document.querySelectorAll('.mk[data-market="mcp"] .mk-card').length === n, found.length);
assert.deepEqual(await ids(), found);
if (name === "used") assert.equal(await box.locator('.mk-card[data-id="io.github.o9/m9"] .mk-installs').count(), 1);
// asked once, not with every search
assert.equal(asked.length, 1);
assert.deepEqual(errors, []);
});
}
}
}
+42
View File
@@ -0,0 +1,42 @@
package library
import "slices"
// PublicServers is the library's servers that the market lists from what
// ships with magpie (the featured ones and the registry's popular ones),
// each by its market id, given to at least one agent: what the day's
// report names of the user's MCP servers, for the market's counts of who
// uses each (internal/stats). A server of the user's own, one found only
// by a search of the registry, and one no agent is given are never in it,
// nor is anything of a server but its id: no name, URL, command or key.
func PublicServers() []string {
l, err := loadLocked()
if err != nil {
return nil
}
return l.publicServers(append(slices.Clone(featured), popularServers()...))
}
func (l *Library) publicServers(listed []MarketServer) []string {
byKey := map[string]string{}
for i := range listed {
k := serverKey(&listed[i].server)
// a bare command names no package, so it could be anyone's server
if k == "" || k == listed[i].server.Command {
continue
}
if _, ok := byKey[k]; !ok {
byKey[k] = listed[i].ID
}
}
out := []string{}
for _, s := range l.MCP {
if len(s.Agents) == 0 {
continue
}
if id := byKey[serverKey(s)]; id != "" && !slices.Contains(out, id) {
out = append(out, id)
}
}
return out
}
+76
View File
@@ -0,0 +1,76 @@
package library
import (
"slices"
"strings"
"testing"
)
// The market's counts of who uses each server (gugediyige666 on X: a
// ranking by installs): the day's report names a library server by its
// market id only when the market lists it from what ships with magpie and
// an agent is given it. A server of the user's own, one no agent has, and
// one that names no package are never named, nor anything of a server but
// its id.
func TestPublicServers(t *testing.T) {
listed := readPopular([]byte(`[
{"name":"io.github.big/one","packages":[{"registryType":"npm","identifier":"@big/one"}]},
{"name":"io.github.big/again","packages":[{"registryType":"npm","identifier":"@big/one"}]},
{"name":"io.github.far/away","remotes":[{"type":"streamable-http","url":"https://far.dev/mcp"}]},
{"name":"io.github.no/agent","packages":[{"registryType":"npm","identifier":"no-agent"}]}
]`))
if len(listed) < 3 {
t.Fatalf("the fixture lists %d servers", len(listed))
}
l := &Library{MCP: []*Server{
{Name: "secret-name", Command: "npx", Args: []string{"-y", "@big/one@latest"}, Env: map[string]string{"TOKEN": "sk-1"}, Agents: []string{"claude"}},
{Name: "twice", Command: "npx", Args: []string{"@big/one"}, Agents: []string{"codex"}},
{Name: "far", Transport: "http", URL: "https://FAR.dev/mcp/", Agents: []string{"claude"}},
{Name: "idle", Command: "npx", Args: []string{"no-agent"}},
{Name: "mine", Transport: "http", URL: "https://intranet.corp/mcp?key=abc", Agents: []string{"claude"}},
{Name: "bare", Command: "npx", Agents: []string{"claude"}},
}}
listed = append(listed, MarketServer{ID: "bare-one", server: Server{Command: "npx"}})
got := l.publicServers(listed)
if want := []string{"io.github.big/one", "io.github.far/away"}; !slices.Equal(got, want) {
t.Fatalf("named %q, want %q", got, want)
}
for _, id := range got {
for _, leak := range []string{"secret", "sk-1", "intranet", "abc", "twice"} {
if strings.Contains(id, leak) {
t.Errorf("%q carries %q", id, leak)
}
}
}
}
// What ships with magpie: every featured and popular server's id is one
// the site takes (site/pluginstats.js's validServer), so none is dropped
// there or names more than a catalog id.
func TestPublicServerIDsAreCatalogIDs(t *testing.T) {
ok := func(id string) bool {
if id == "" || len(id) > 200 {
return false
}
parts := strings.Split(id, "/")
if len(parts) > 2 {
return false
}
for _, p := range parts {
if p == "" || !(p[0] >= 'a' && p[0] <= 'z' || p[0] >= 'A' && p[0] <= 'Z' || p[0] >= '0' && p[0] <= '9') {
return false
}
for _, c := range p {
if !(c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c >= '0' && c <= '9' || c == '.' || c == '_' || c == '-') {
return false
}
}
}
return true
}
for _, m := range append(slices.Clone(featured), popularServers()...) {
if !ok(m.ID) {
t.Errorf("market id %q is not one the site takes", m.ID)
}
}
}
+45 -18
View File
@@ -10,6 +10,7 @@ import (
"strings"
"time"
"github.com/yetone/magpie/internal/library"
"github.com/yetone/magpie/internal/plugin"
"github.com/yetone/magpie/internal/update"
)
@@ -19,8 +20,11 @@ import (
// with, usemagpie.ai is told which plugins Discover lists are installed
// and on here (plugin.Public: never a private repository, a folder or a
// package no list names), under the same random id; it counts the
// computers that said so in the last seven days. A like is the user's
// own act, sent when they make it.
// computers that said so in the last seven days. The Library's MCP
// servers go the same way, for the market's order and counts: those the
// market lists from what ships with magpie, by their market ids
// (library.PublicServers), never a server of the user's own. A like is
// the user's own act, sent when they make it.
// Site takes the day's plugins and the likes; MAGPIE_SITE_HOST points
// them elsewhere, for testing.
@@ -31,20 +35,35 @@ func Site() string {
return update.Site
}
// publicPlugins is plugin.Public; tests put their own.
var publicPlugins = plugin.Public
// publicPlugins is plugin.Public, and publicServers
// library.PublicServers; tests put their own.
var (
publicPlugins = plugin.Public
publicServers = library.PublicServers
)
// sendPlugins tells usemagpie.ai the plugins installed here Discover
// lists; nothing when there are none.
// lists, and the Library's servers the market lists; nothing when there
// are none.
func sendPlugins(ctx context.Context, id string) error {
names := publicPlugins(ctx)
if len(names) == 0 {
names, servers := publicPlugins(ctx), publicServers()
if len(names) == 0 && len(servers) == 0 {
return nil
}
if len(names) > most {
names = names[:most]
}
return post(ctx, "/api/plugins/report", map[string]any{"id": id, "plugins": names}, nil)
if len(servers) > most {
servers = servers[:most]
}
if names == nil {
names = []string{}
}
body := map[string]any{"id": id, "plugins": names}
if len(servers) > 0 {
body["servers"] = servers
}
return post(ctx, "/api/plugins/report", body, nil)
}
// Counts is what usemagpie.ai says of each plugin: the computers that
@@ -54,32 +73,40 @@ type Counts struct {
Likes int `json:"likes,omitempty"`
}
// PluginCounts asks usemagpie.ai each plugin's counts, by Discover's key.
func PluginCounts(ctx context.Context) (map[string]Counts, error) {
// Board is what usemagpie.ai counts: each plugin's, by Discover's key,
// and each MCP server's, by its market id.
type Board struct {
Plugins map[string]Counts `json:"plugins"`
Servers map[string]Counts `json:"servers"`
}
// PluginCounts asks usemagpie.ai each plugin's and each server's counts.
func PluginCounts(ctx context.Context) (Board, error) {
ctx, cancel := context.WithTimeout(ctx, 10*time.Second)
defer cancel()
req, err := http.NewRequestWithContext(ctx, "GET", Site()+"/api/plugins/stats", nil)
if err != nil {
return nil, err
return Board{}, err
}
res, err := http.DefaultClient.Do(req)
if err != nil {
return nil, err
return Board{}, err
}
defer res.Body.Close()
if res.StatusCode/100 != 2 {
return nil, fmt.Errorf("plugin counts: %s", res.Status)
}
var out struct {
Plugins map[string]Counts `json:"plugins"`
return Board{}, fmt.Errorf("plugin counts: %s", res.Status)
}
var out Board
if err := json.NewDecoder(http.MaxBytesReader(nil, res.Body, 4<<20)).Decode(&out); err != nil {
return nil, err
return Board{}, err
}
if out.Plugins == nil {
out.Plugins = map[string]Counts{}
}
return out.Plugins, nil
if out.Servers == nil {
out.Servers = map[string]Counts{}
}
return out, nil
}
// Like likes the plugin Discover keys name, or takes the like back, under
+20 -10
View File
@@ -13,8 +13,9 @@ import (
)
// The day's plugins go to usemagpie.ai with the day's event, under its
// id, as plugin.Public has them; not when the user turned off what magpie
// is used with, nor when stats are off, nor with no plugin to name. A like
// id, as plugin.Public has them, and the Library's market servers as
// library.PublicServers has them; not when the user turned off what
// magpie is used with, nor when stats are off, nor with nothing to name. A like
// goes under the same id.
func TestSendPlugins(t *testing.T) {
t.Setenv("XDG_CONFIG_HOME", t.TempDir())
@@ -23,12 +24,15 @@ func TestSendPlugins(t *testing.T) {
t.Setenv("MAGPIE_NO_STATS", "")
usage = func() Usage { return Usage{} }
plugins := []string{"@magpie-community/opencode-cursor-auth", "github:alice/tagged"}
was := publicPlugins
servers := []string{"context7", "io.github.big/one"}
was, wasServers := publicPlugins, publicServers
publicPlugins = func(context.Context) []string { return plugins }
defer func() { usage, publicPlugins = readUsage, was }()
publicServers = func() []string { return servers }
defer func() { usage, publicPlugins, publicServers = readUsage, was, wasServers }()
type report struct {
ID string `json:"id"`
Plugins []string `json:"plugins"`
Servers []string `json:"servers"`
Plugin string `json:"plugin"`
On bool `json:"on"`
}
@@ -63,7 +67,7 @@ func TestSendPlugins(t *testing.T) {
if err := Send(context.Background(), "0.1.300", "app", day); err != nil {
t.Fatal(err)
}
if len(reports) != 1 || reports[0].ID != posthogID || len(posthogID) != 32 || !slices.Equal(reports[0].Plugins, plugins) {
if len(reports) != 1 || reports[0].ID != posthogID || len(posthogID) != 32 || !slices.Equal(reports[0].Plugins, plugins) || !slices.Equal(reports[0].Servers, servers) {
t.Fatalf("reports %+v (event's id %q)", reports, posthogID)
}
// once a day
@@ -77,15 +81,21 @@ func TestSendPlugins(t *testing.T) {
t.Fatalf("like: %d %v %+v", n, err, likes)
}
// none to name: nothing goes
// servers alone still go, with no plugin
plugins = nil
Send(context.Background(), "0.1.300", "app", day.Add(24*time.Hour))
plugins = []string{"opencode-x"}
settings.Save(settings.Settings{NoUsageStats: true})
if len(reports) != 2 || reports[1].Plugins == nil || len(reports[1].Plugins) != 0 || !slices.Equal(reports[1].Servers, servers) {
t.Fatalf("servers alone: %+v", reports)
}
// none to name: nothing goes
servers = nil
Send(context.Background(), "0.1.300", "app", day.Add(48*time.Hour))
settings.Save(settings.Settings{NoStats: true})
plugins, servers = []string{"opencode-x"}, []string{"context7"}
settings.Save(settings.Settings{NoUsageStats: true})
Send(context.Background(), "0.1.300", "app", day.Add(72*time.Hour))
if len(reports) != 1 {
settings.Save(settings.Settings{NoStats: true})
Send(context.Background(), "0.1.300", "app", day.Add(96*time.Hour))
if len(reports) != 2 {
t.Fatalf("sent with nothing to name, or turned off: %+v", reports)
}
}
+6 -6
View File
@@ -142,7 +142,7 @@ fbb62356dad30b1d26fb6ccb46cb8c9c1f38f255bed42e8cb4f1c30e6a18c32d docs/ja/openro
45c59d34527605a9745a41fbcdc67e79b264dbe017cec48c08253049500d5c04 docs/ja/pi.html
43e24b3b62d8b38f4a6e44fc36951fccd9de0f8e37419e90312b00184051774d docs/ja/plugins.html
9bd748744c23810328abe9ab3cd3b08733d1f9fdd4ab3ad7c8071acb99c5f1ba docs/ja/prime-agent.html
7ea43def16b32794c23c9d0def59789b126b3588b029200cf3030f7540e5b5df docs/ja/privacy.html
96ec87b3ab0949735f089c535229232a891c926e2456d715763b8ec8aed887de docs/ja/privacy.html
8a99b3c6c7f1f2bde876c7b31735afd873b31373054ec06108e73e9ef674582e docs/ja/quota.html
e6fdfc52fb6570b4450b663304526c53bca8f94f608a613c9de974b00d9305fe docs/ja/qwen-code.html
edc48cb9c5cab1dc68dc37a45301de5d5aad2d9493644d9cbd5e8cffc440e04f docs/ja/qwen.html
@@ -155,7 +155,7 @@ c7070237e2a6b86e43a2a22c43d72a8a6a36e00c7f9877028d5a7fbbeceaafcb docs/ja/routin
ae657d3db2c4cfacb886a228bc97c3c074d83d3bed441ad60c01931325e3fe44 docs/ja/shelley.html
f2f8e870c8fd1f14483d223ad834b1c99b64c6e39a02b7bd0b12ab74e239624c docs/ja/siliconflow.html
b000018f7903dfb44f7bff6d469a6bd5ec13ba9528893bf409bdde638589c630 docs/ja/snow-cli.html
9a45d72dc05f423bd8a3814bbba2805155e04607210656bef9ccc21c80edc90a docs/ja/start.html
962395e92df0d77c935340c4734e85f3aa2665632f84152421ab8af5532aa73f docs/ja/start.html
1ea5845f140e9e6aa932120bec2f1ff7bf3731603f39996948f561b1a1f52a7f docs/ja/stepcode.html
1eb86470ebe9f83f402d7d77ee8cd51e29f41b5ba4aed2da16b6947c0eee6bd2 docs/ja/stepfun.html
9964db876b8f2f16d2c6ea36921c2ad888d7794fac33a447a28bffa5ca1d4e83 docs/ja/subscriptions.html
@@ -217,7 +217,7 @@ ea24f46fcf7093aaeff056ac39a875e6def1a7c1b8d49d404e4a86369f7dc7a8 docs/penguin.h
446e2b5908e0537c7bc3154849ea84dfccf4c559ec75b98f24a8cf244e8973d4 docs/pi.html
e3a7f2f602083cd39b3f269a1196984a1f9264740154285c277163bd13980467 docs/plugins.html
267113cb7904c7968005b998c3fc109004c24e8e711d326a7aaee3c711739236 docs/prime-agent.html
f8562c3bf8aa5add9b48883606030de18f21d6897e35d832716259808d33c9fd docs/privacy.html
6eae2c12685bb87c0e5c2761ac2eb014a09424c9190f572296d6d49c35f604d7 docs/privacy.html
fa0abe144eb2d7ba48885d1678da96c0082b56a00c7f3af13cdfc69add50a121 docs/quota.html
038e1bec2da338f08d836cd1a21e639f8486d1fdbaeec71e53d260cb039bdc13 docs/qwen-code.html
21fb126db41163eb68a0f627bb74e03063d135fa2da60ab6997dffd3d5757b3d docs/qwen.html
@@ -230,7 +230,7 @@ cbf3a16eee9a07f5c1f5dda30b26787d574a79189fbe8a26ed6088aa9c962d88 docs/routing-g
9c22ec06ed58767bdb661e8ccb6bf324ee42d94ef74fe27e6a05b53885316d3d docs/shelley.html
6f431de880c17c89b081bb424ea551ba48f1502b11c656c6af28c222acf7419e docs/siliconflow.html
3468488643bd5e20c6ef6145e1b163df83eda6ee1c85ab08f2a316cd0e0058ec docs/snow-cli.html
9e51f1c307ca1dad58e0e4c26b28edd26d43e9c071ff864a33e9d19b8d927e14 docs/start.html
a5ae49b1881edff736719cfed7c37b9485eaa1648aad9c3388d279ecc4b570de docs/start.html
48ac24aec6e88393e743659432c8edbf6b99a3ede8cee44426c4d728353b9892 docs/stepcode.html
1969c326de53bf8c97ed5580516edb8a5a6fa5375a74494abdfc913298126284 docs/stepfun.html
79eb1159590a6d4c5d1a1df8a2a6a7b158357ba2d64f62bdbf21a1bf8276e021 docs/subscriptions.html
@@ -342,7 +342,7 @@ c9451778181c711df5e840af23bb3e1d56d3b4b68c232c93e55d42459f27db52 docs/zh/openbo
977ac139da3660d15e27e61cfeed1c6394ede9c10fde71831dd4e0039d5648e1 docs/zh/pi.html
b43535b82a7efc1c7ce43130e4c5b6db314d5ff0701940d36d456a4fdd23feeb docs/zh/plugins.html
d683b08adf02df1de280a32bd8ea3f26b9ae67518749e567518d6e0d19c67895 docs/zh/prime-agent.html
856d3b42eaba91bd5a54bc61e51dc0eeb26488372dbeb8f1fd744726dcddd3b8 docs/zh/privacy.html
6931d84cd9e6ce0c3acfab68249bdfe116dca0a390ac1e1d6540aab543acb59e docs/zh/privacy.html
d77d78aa72937c4756d65f286460e3dbcaa2c216a586e9d06486d5f3d967c1b6 docs/zh/quota.html
8373bb4f1587111d734af26d9ad868a6d6910b5504006783a3c9023e478905da docs/zh/qwen-code.html
01c1fd7734a1d0834ad6474529b46de4c04cf37e7f3bd0d4c3792f41f2591f63 docs/zh/qwen.html
@@ -355,7 +355,7 @@ b2218124e8755dad24e20ecccf7938c9b30e8ae51de574ce46c1514d871ce0c4 docs/zh/routin
1d4b1922da7504bbcf8f6c6b8a77d3688fc877d0a1188c9d3d3d3f9b29deafc6 docs/zh/shelley.html
57da389d7a92c3ae1da447f06fb63f4437f16a2c775476f9e25eba40391e41ad docs/zh/siliconflow.html
bb734095a02534238e82541efac317b6eab7805e87de9e666245212ea5562396 docs/zh/snow-cli.html
caff76b2bba710d19f899b699b6d35f499b4907ab7e4beefbdee3c2543f556ce docs/zh/start.html
329b512cdd19162166fe01eb063a8e5ab2069ef6613a22ddc4479c047ad82595 docs/zh/start.html
f8a9f30aabfa53592dd5e548480763776a2d4913175eccd3fd6d107858a0d0c0 docs/zh/stepcode.html
dc7be40c877df9ea7ef2c9ccc6c829bdd217d3f74a2ebdf0c54a848da0cba82f docs/zh/stepfun.html
b98fe5e40042853057e726642fae823183b85b27ead65de68705a13e0ab4a318 docs/zh/subscriptions.html
+35 -10
View File
@@ -6,7 +6,11 @@
// account or address. A plugin's users are the ids that reported it in
// the last seven days. A like is one per id, can be taken back, and comes
// only from an app that has the plugin (the app checks; here a like also
// counts as that id having it). The caller's address is kept only hashed,
// counts as that id having it). The same report names the Library's MCP
// servers the app's market lists, by their market ids (a registry name
// like io.github.owner/repo, or a featured one's short name), kept as
// "mcp:<id>" beside the plugins and counted the same way, with no likes.
// The caller's address is kept only hashed,
// for an hour, to hold each one to RATE asks an hour.
//
// D1 (wrangler.jsonc's PLUGINS) holds three tables; the quarter-hour
@@ -15,6 +19,8 @@
const ID = /^[0-9a-f]{32}$/;
const NPM = /^(@[a-z0-9][a-z0-9._~-]*\/)?[a-z0-9][a-z0-9._~-]*$/;
const GIT = /^github:[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/;
const SERVER = /^[A-Za-z0-9][A-Za-z0-9._-]*(\/[A-Za-z0-9][A-Za-z0-9._-]*)?$/;
const MCP = "mcp:";
export const MOST = 50; // plugins in one report, as the app's most
export const RATE = 60; // asks an address makes in an hour
const WEEK = 7 * 864e5;
@@ -44,6 +50,10 @@ export function validName(n) {
return typeof n === "string" && n.length <= 214 && (NPM.test(n) || GIT.test(n));
}
export function validServer(n) {
return typeof n === "string" && n.length <= 200 && SERVER.test(n);
}
const day = (t) => new Date(t).toISOString().slice(0, 10);
function answer(body, status = 200, headers = {}) {
@@ -94,17 +104,27 @@ export async function handle(req, env, ctx, now = Date.now()) {
if (!b || !ID.test(b.id ?? "")) return answer({ error: "a report needs the app's id" }, 400);
if (await held(db, req, now)) return answer({ error: "too many asks; try again in an hour" }, 429);
if (path === "/api/plugins/report") {
const names = Array.isArray(b.plugins) ? [...new Set(b.plugins)] : null;
if (!names || names.length > MOST || !names.every(validName)) return answer({ error: "plugins: names Discover lists" }, 400);
const plugins = Array.isArray(b.plugins) ? [...new Set(b.plugins)] : null;
if (!plugins || plugins.length > MOST || !plugins.every(validName)) return answer({ error: "plugins: names Discover lists" }, 400);
// an app from before servers were counted sends none
const servers = b.servers === undefined ? [] : Array.isArray(b.servers) ? [...new Set(b.servers)] : null;
if (!servers || servers.length > MOST || !servers.every(validServer)) return answer({ error: "servers: ids the market lists" }, 400);
const names = [...plugins, ...servers.map((s) => MCP + s)];
const today = day(now);
const marks = names.map((_, i) => `?${i + 2}`).join(",");
const gone = db.prepare(`DELETE FROM installs WHERE device = ?1${names.length ? ` AND plugin NOT IN (${marks})` : ""}`).bind(b.id, ...names);
// what this id no longer has, plugins and servers apart: D1 binds at
// most 100 values a statement
const gone = (list, kind) =>
db
.prepare(
`DELETE FROM installs WHERE device = ?1 AND substr(plugin, 1, 4) ${kind}${list.length ? ` AND plugin NOT IN (${list.map((_, i) => `?${i + 2}`).join(",")})` : ""}`,
)
.bind(b.id, ...list);
const put = names.map((n) =>
db
.prepare("INSERT INTO installs (device, plugin, day) VALUES (?1, ?2, ?3) ON CONFLICT (device, plugin) DO UPDATE SET day = ?3")
.bind(b.id, n, today),
);
await db.batch([gone, ...put]);
await db.batch([gone(plugins, "<> 'mcp:'"), gone(names.slice(plugins.length), "= 'mcp:'"), ...put]);
return answer({ ok: true });
}
// a like, or one taken back
@@ -122,7 +142,8 @@ export async function handle(req, env, ctx, now = Date.now()) {
return answer({ likes: row?.n ?? 0 });
}
// stats is every plugin's users and likes, held at the edge for an hour
// stats is every plugin's users and likes, and every server's users,
// held at the edge for an hour
async function stats(req, db, ctx, now) {
const key = new Request(new URL("/api/plugins/stats", req.url).toString());
const hit = await caches.default.match(key);
@@ -132,9 +153,13 @@ async function stats(req, db, ctx, now) {
db.prepare("SELECT plugin, COUNT(*) AS n FROM likes GROUP BY plugin"),
]);
const plugins = {};
for (const r of users.results) (plugins[r.plugin] ??= {}).users = r.n;
for (const r of likes.results) (plugins[r.plugin] ??= {}).likes = r.n;
const res = answer({ plugins }, 200, { "Cache-Control": "public, max-age=3600" });
const servers = {};
for (const r of users.results) {
if (r.plugin.startsWith(MCP)) servers[r.plugin.slice(MCP.length)] = { users: r.n };
else (plugins[r.plugin] ??= {}).users = r.n;
}
for (const r of likes.results) if (!r.plugin.startsWith(MCP)) (plugins[r.plugin] ??= {}).likes = r.n;
const res = answer({ plugins, servers }, 200, { "Cache-Control": "public, max-age=3600" });
ctx.waitUntil(caches.default.put(key, res.clone()));
return res;
}
+57 -1
View File
@@ -9,7 +9,10 @@ import { handle, prune, RATE, MOST } from "./pluginstats.js";
function d1() {
const db = new DatabaseSync(":memory:");
const stmt = (sql, args = []) => ({
bind: (...a) => stmt(sql, a),
bind: (...a) => {
if (a.length > 100) throw new Error("D1 binds at most 100 values");
return stmt(sql, a);
},
run: async () => (db.prepare(sql).run(...args), { success: true }),
first: async () => db.prepare(sql).get(...args) ?? null,
all: async () => ({ results: db.prepare(sql).all(...args) }),
@@ -132,3 +135,56 @@ test("without the database, the counts are refused, not made up", async () => {
assert.equal((await ask({}, "/api/plugins/stats")).status, 503);
assert.equal(await handle(new Request("https://usemagpie.ai/api/plugins/other"), {}, ctx), null);
});
async function board(env, now = T0) {
store.clear();
return (await ask(env, "/api/plugins/stats", undefined, now)).json();
}
test("the Library's servers are counted beside the plugins, apart from them", async () => {
const env = { PLUGINS: d1() };
const full = Array.from({ length: MOST }, (_, i) => `p${i}`);
const many = Array.from({ length: MOST }, (_, i) => `io.github.o${i}/s${i}`);
assert.equal((await ask(env, "/api/plugins/report", { id: id(1), plugins: full, servers: many })).status, 200);
await ask(env, "/api/plugins/report", { id: id(2), plugins: ["opencode-a"], servers: ["context7", "io.github.o0/s0"] });
let b = await board(env);
assert.equal(b.servers["io.github.o0/s0"].users, 2);
assert.deepEqual(b.servers.context7, { users: 1 });
assert.equal(Object.keys(b.servers).length, MOST + 1);
assert.ok(Object.keys(b.plugins).every((k) => !k.startsWith("mcp:")));
// a server dropped from the library stops counting; the plugins stay
await ask(env, "/api/plugins/report", { id: id(2), plugins: ["opencode-a"], servers: ["context7"] }, T0 + DAY);
b = await board(env, T0 + DAY);
assert.equal(b.servers["io.github.o0/s0"].users, 1);
assert.deepEqual(b.plugins["opencode-a"], { users: 1 });
// a report with no servers (an app from before, or none in its library)
// keeps its plugins and drops its servers
await ask(env, "/api/plugins/report", { id: id(2), plugins: ["opencode-a"] }, T0 + DAY);
b = await board(env, T0 + DAY);
assert.equal(b.servers.context7, undefined);
assert.deepEqual(b.plugins["opencode-a"], { users: 1 });
// and a report of servers alone keeps no plugin
await ask(env, "/api/plugins/report", { id: id(2), plugins: [], servers: ["context7"] }, T0 + DAY);
b = await board(env, T0 + DAY);
assert.deepEqual(b.servers.context7, { users: 1 });
assert.equal(b.plugins["opencode-a"], undefined);
// a server can't be liked
assert.equal((await ask(env, "/api/plugins/like", { id: id(3), plugin: "mcp:context7", on: true })).status, 400);
});
test("only ids the market lists are taken as servers", async () => {
const env = { PLUGINS: d1() };
const bad = [
{ id: id(1), plugins: [], servers: "context7" },
{ id: id(1), plugins: [], servers: ["https://intranet.corp/mcp?key=abc"] },
{ id: id(1), plugins: [], servers: ["npx -y @corp/secret"] },
{ id: id(1), plugins: [], servers: ["/Users/me/server"] },
{ id: id(1), plugins: [], servers: ["a/b/c"] },
{ id: id(1), plugins: [], servers: ["x".repeat(201)] },
{ id: id(1), plugins: [], servers: [7] },
{ id: id(1), plugins: [], servers: Array.from({ length: MOST + 1 }, (_, i) => `s${i}`) },
{ id: id(1), plugins: ["mcp:context7"] },
];
for (const b of bad) assert.equal((await ask(env, "/api/plugins/report", b)).status, 400, JSON.stringify(b).slice(0, 80));
assert.deepEqual(await board(env), { plugins: {}, servers: {} });
});
+2 -2
View File
@@ -170,7 +170,7 @@
<li><b>モデル</b>:つないだエージェントに設定されたモデルを、プロバイダー ID とベンダーのモデル ID で(<code>deepseek/deepseek-v4</code>)。キーのプロバイダーで <a href="https://models.dev">models.dev</a> に載っていないモデル ID(ローカルモデル、ファインチューン)は <code>&lt;プロバイダー&gt;/other</code>、自分のプロバイダーのモデルは <code>custom</code>、ルーティンググループは <code>group</code> です。</li>
</ul>
<p>あわせて <code>magpie partner</code> イベントも送ります。プロバイダー追加シートの先頭に載る各パートナーについて、その ID で、終わった日にシートに表示された回数、行が開かれた回数、キーのページが開かれた回数、そこからプロバイダーが追加された回数です(<code>what</code>:<code>shown</code>、<code>opened</code>、<code>keys</code>、<code>added</code>。1 日にそれぞれ最大 20 回、追加は 5 回)。回数だけで、自分のプロバイダーは含みません。</p>
<p id="plugins">この部分がオンのとき、magpie は同じ日に、Discover に載っているどのプラグインを入れて(オンにして)いるかを <code>usemagpie.ai</code> に伝え、Discover が各プラグインの利用者数を示せるようにします:<code>POST /api/plugins/report</code> に同じランダムな ID とプラグインの npm パッケージ名、<code>magpie-plugin</code> タグのリポジトリは <code>github:owner/repo</code>(最大 50 個)。フォルダーから入れたもの、非公開リポジトリ、Discover に載っていないパッケージのプラグインは送りません。プラグインのページでのいいねは <code>POST /api/plugins/like</code> で、ID、プラグイン、オンかオフかを送ります。いいねできるのはこのコンピューターに入っているプラグインだけで、いいねしたものは <code>plugin-likes.json</code> に残ります。サイトは直近 7 日に報告した ID の数を数え、報告は 30 日で消します。アドレスはハッシュだけを 1 時間、頻度の制限のために残します。Discover は ID を含まない <code>GET /api/plugins/stats</code> で数を読みます。コードは <a href="https://github.com/yetone/magpie/blob/main/internal/stats/plugins.go">internal/stats/plugins.go</a> と <a href="https://github.com/yetone/magpie/blob/main/site/pluginstats.js">site/pluginstats.js</a> です。</p>
<p id="plugins">この部分がオンのとき、magpie は同じ日に、Discover に載っているどのプラグインを入れて(オンにして)いるかを <code>usemagpie.ai</code> に伝え、Discover が各プラグインの利用者数を示せるようにします:<code>POST /api/plugins/report</code> に同じランダムな ID とプラグインの npm パッケージ名、<code>magpie-plugin</code> タグのリポジトリは <code>github:owner/repo</code>(最大 50 個)。フォルダーから入れたもの、非公開リポジトリ、Discover に載っていないパッケージのプラグインは送りません。同じ報告で、ライブラリの MCP サーバーのうち、エージェントに渡していて、magpie に同梱のライブラリのマーケット一覧に載っているものを、マーケットの ID だけで送ります(<code>context7</code>、<code>io.github.owner/name</code>。最大 50 個)。マーケットで利用者の多いものを先に並べるためです。自分で作ったサーバーや検索でだけ見つかるサーバーは送らず、アドレス、コマンド、キーも送りません。プラグインのページでのいいねは <code>POST /api/plugins/like</code> で、ID、プラグイン、オンかオフかを送ります。いいねできるのはこのコンピューターに入っているプラグインだけで、いいねしたものは <code>plugin-likes.json</code> に残ります。サイトは直近 7 日に報告した ID の数を数え、報告は 30 日で消します。アドレスはハッシュだけを 1 時間、頻度の制限のために残します。Discover は ID を含まない <code>GET /api/plugins/stats</code> で数を読みます。コードは <a href="https://github.com/yetone/magpie/blob/main/internal/stats/plugins.go">internal/stats/plugins.go</a> と <a href="https://github.com/yetone/magpie/blob/main/site/pluginstats.js">site/pluginstats.js</a> です。</p>
<p>どのイベントにも <code>$process_person_profile: false</code> が付き、PostHog はこの ID の人物プロファイルを作りません。名前、Base URL、アカウント、キー、プロンプト、返答、使用量は送りません。まとめ全体はこのような形です。</p>
<div class="code">
<span class="lang">POST https://us.i.posthog.com/batch/</span>
@@ -238,7 +238,7 @@
<li><code>/files/&lt;バージョン&gt;/&lt;ファイル&gt;</code>:更新とインストーラがダウンロードするリリースファイルで、Cloudflare R2 から配信されます。サイトにないファイルは github.com へ転送されます。何も計測しません。</li>
<li><code>/api/partners</code>:プロバイダー追加シートのパートナー一覧。6 時間ごと。パートナーが載っている間、10 回に 1 回の取得を Cloudflare が示す国とともに <code>magpie partners fetch</code> として数えます。</li>
<li><code>/go/&lt;パートナー&gt;/site</code> と <code>/go/&lt;パートナー&gt;/keys</code>:パートナーの公式サイトとキーのページへのリンクをブラウザーで開くと、移動の前に <code>magpie partner go</code>(どのパートナーか、どのリンクか、地域、国)として数えます。</li>
<li><code>/api/plugins/stats</code>:Discover の各プラグインの利用者数といいねの数。多くて 1 時間に 1 回で、ID は含みません。<a href="#plugins">プラグインの報告</a>といいねは ID を含み、共有がオンのときだけ送ります。</li>
<li><code>/api/plugins/stats</code>:Discover の各プラグインの利用者数といいねの数と、ライブラリのマーケットの各 MCP サーバーの利用者数。多くて 1 時間に 1 回で、ID は含みません。<a href="#plugins">プラグインの報告</a>といいねは ID を含み、共有がオンのときだけ送ります。</li>
<li><code>/api/icon?url=…</code>:プラグイン、インポートリンク、ライブラリが示すアイコンはここを経由して取得するので、アイコンのあるホストに見えるのはあなたではなく Cloudflare のアドレスです。画像を中継するだけで、数えることも記録することもしません。</li>
</ul>
<p>サイト自身のページ(このドキュメント、ホーム)には Cloudflare Web Analytics と PostHog Web Analytics(<code>us.i.posthog.com</code>)が入っており、どちらも Cookie は使いません。PostHog はこのサイト用のランダムな訪問者 ID をブラウザのローカルストレージに保存し、再訪問を同じ訪問者として数えます。受け取るのは各ページのアドレス、参照元のページ、ページ上でクリックしたもの(入力内容は含みません)、ページとそのリクエストの読み込み速度、ページで起きたエラー、ブラウザ・OS・画面サイズ、IP アドレスの国と都市、そして訪問の録画(ページの表示、マウスの動き、クリック、スクロール、コンソールのメッセージ)で、入力欄はすべて伏せられます。ブラウザが Do Not Track か Global Privacy Control を送っていれば何も送りません。PostHog へのリクエストはこのサイトの <code>usemagpie.ai/r/</code> を経由し、IP アドレスとともに PostHog へ渡されます。サイトの Cookie は渡しません。<code>/download</code> のリンクを開くか <code>install.sh</code> を取得すると、PostHog に別のカウントが 1 件送られます。どのファイルか、国、ブラウザかコマンドか、だけで、ID も IP アドレスも含みません。アプリはどちらも読み込みません。コードは <a href="https://github.com/yetone/magpie/blob/main/site/worker.js">site/worker.js</a> です。</p>
+1 -1
View File
@@ -374,7 +374,7 @@ magpie claude group/opus-anywhere <span class="c"># これを使う</span></p
<p>アプリ(ウィンドウ、メニューバーやトレイのアイコン、パネル。どう開いたかによらず)は <code>app.log</code> を書きます。macOS では <code>~/Library/Logs/magpie/app.log</code>、Windows では <code>%LOCALAPPDATA%\magpie\logs\app.log</code>、Linux では <code>~/.local/state/magpie/app.log</code>(<code>$XDG_STATE_HOME</code> が設定されていれば <code>$XDG_STATE_HOME/magpie</code>)、ポータブル版ではデータフォルダーの <code>logs</code> です。<span class="ui">設定</span> → <span class="ui">情報</span> → <span class="ui">ログ</span>にパスがあり、<span class="ui">開く</span>でそのフォルダーを表示します。<code>magpie log</code> はパスを表示し、<code>magpie log -f</code> は追いかけます。5 MiB に達すると隣の <code>app.old.log</code> になり、残るのは最大 2 ファイルです。記録されるのは magpie がしたことと出会ったエラー(プロバイダーがリクエストを断った、再試行した、プラグインが起動しなかった)で、キー、プロンプト、返答は含みません。キーやトークンに見えるものも伏せられます。サービスとして動く <code>magpie serve</code> のログは別の場所です。macOS では <code>~/Library/Logs/magpie/serve.log</code>、Linux では <code>journalctl --user -u magpie</code>。<code>magpie log</code> はそれも示します。</p>
<h3 id="privacy">magpie は何を送信しますか?</h3>
<p>プロンプト、返答、キー、アカウントは、使っているプロバイダーにだけ送られます。間に magpie 自身のサーバーはありません。リリース版の magpie は 1 日 1 回、使われていることを知らせます。何人が使っていて、何を優先して面倒を見るべきかを知るためです。送るのは、このコンピュータで作ったランダムな ID、magpie のバージョンとシステム、そして使っているエージェント、プロバイダー、モデルを magpie 自身の ID(<code>claude</code>、<code>deepseek</code>、<code>deepseek/deepseek-v4</code>)で、それぞれの数とともに。自分で追加したプロバイダーとそのモデルは <code>custom</code> とだけ記録します。プロバイダー追加シートの先頭に載るパートナーについては、1 日に表示された回数、開かれた回数、追加された回数も送ります(回数のみ)。名前、Base URL、アカウント、キー、プロンプト、使用量は送りません。<span class="ui">設定</span> → <span class="ui">プライバシー</span> → <span class="ui">使っているエージェント、プロバイダー、モデル、プラグインを共有</span> でエージェント、プロバイダー、モデル、パートナーの回数、Discover のどのプラグインを入れているか(各プラグインの利用者数といいねの集計用)を外せます。<span class="ui">ユーザー数に含める</span>、<code>DO_NOT_TRACK=1</code>、<code>MAGPIE_NO_STATS=1</code> のどれかですべてオフになります。ソースからのビルドは送信しません。パートナーの公式サイトと「キーを取得」のリンクは <code>usemagpie.ai/go/…</code> を経由し、移動の前にクリックを 1 回数えます(どのパートナーか、どのリンクか、国)。usemagpie.ai はパートナー一覧が取得された回数も数えます。これはサーバー自身が見るもので、どの Web サイトのアクセス集計とも同じく、上の設定には左右されません。ID、IP アドレス、アカウントは記録しません。プラグイン、インポートリンク、ライブラリが示すアイコンは <code>usemagpie.ai/api/icon</code> を経由して取得するので、アイコンのあるサーバーに見えるのはあなたの IP ではなく Cloudflare のアドレスです。このサーバーは画像を中継するだけで、数えることも記録することもしません。magpie が自分から送るものすべては、毎日のカウントの例、手元に残すファイル、各スイッチとともに<a href="/docs/ja/privacy">プライバシー</a>のページに挙げています。</p>
<p>プロンプト、返答、キー、アカウントは、使っているプロバイダーにだけ送られます。間に magpie 自身のサーバーはありません。リリース版の magpie は 1 日 1 回、使われていることを知らせます。何人が使っていて、何を優先して面倒を見るべきかを知るためです。送るのは、このコンピュータで作ったランダムな ID、magpie のバージョンとシステム、そして使っているエージェント、プロバイダー、モデルを magpie 自身の ID(<code>claude</code>、<code>deepseek</code>、<code>deepseek/deepseek-v4</code>)で、それぞれの数とともに。自分で追加したプロバイダーとそのモデルは <code>custom</code> とだけ記録します。プロバイダー追加シートの先頭に載るパートナーについては、1 日に表示された回数、開かれた回数、追加された回数も送ります(回数のみ)。名前、Base URL、アカウント、キー、プロンプト、使用量は送りません。<span class="ui">設定</span> → <span class="ui">プライバシー</span> → <span class="ui">使っているエージェント、プロバイダー、モデル、プラグインを共有</span> でエージェント、プロバイダー、モデル、パートナーの回数、Discover のどのプラグインを入れているか、ライブラリのマーケットのどの MCP サーバーを使っているか(利用者数といいねの集計用)を外せます。<span class="ui">ユーザー数に含める</span>、<code>DO_NOT_TRACK=1</code>、<code>MAGPIE_NO_STATS=1</code> のどれかですべてオフになります。ソースからのビルドは送信しません。パートナーの公式サイトと「キーを取得」のリンクは <code>usemagpie.ai/go/…</code> を経由し、移動の前にクリックを 1 回数えます(どのパートナーか、どのリンクか、国)。usemagpie.ai はパートナー一覧が取得された回数も数えます。これはサーバー自身が見るもので、どの Web サイトのアクセス集計とも同じく、上の設定には左右されません。ID、IP アドレス、アカウントは記録しません。プラグイン、インポートリンク、ライブラリが示すアイコンは <code>usemagpie.ai/api/icon</code> を経由して取得するので、アイコンのあるサーバーに見えるのはあなたの IP ではなく Cloudflare のアドレスです。このサーバーは画像を中継するだけで、数えることも記録することもしません。magpie が自分から送るものすべては、毎日のカウントの例、手元に残すファイル、各スイッチとともに<a href="/docs/ja/privacy">プライバシー</a>のページに挙げています。</p>
<h3 id="proxy-loopback">エージェントが 502 を返す、または接続できず、magpie の Routing タブに何も出ない?</h3>
<p>プロキシアプリ(Surge、Clash、mihomo など。システムプロキシ、TUN、拡張モードのいずれかが有効)が、エージェントから <code>http://127.0.0.1:3425</code> へのリクエストを横取りして別の場所へ送っているため、magpie に届いていません。除外リスト(<code>skip-proxy</code>、バイパス)に 127.0.0.1 を書くだけでは足りないことがあります。Codex など一部のエージェントは、それでもプロキシを通します。ローカルアドレスを直結にするルールを、他のルールより前に追加してください:</p>
+2 -2
View File
@@ -170,7 +170,7 @@
<li><b>models</b> the connected agents are set to, as provider id and vendor model id (<code>deepseek/deepseek-v4</code>). On a key’s provider, a model id that <a href="https://models.dev">models.dev</a> doesn’t list (a local model, a fine-tune) is only <code>&lt;provider&gt;/other</code>; a model on your own provider is <code>custom</code>; a routing group is <code>group</code>.</li>
</ul>
<p>With them go <code>magpie partner</code> events: for each partner listed first in the add sheet, by its id, how many times on a day that has ended the sheet showed it, its row was opened, its key page was opened, and a provider was added from it (<code>what</code>: <code>shown</code>, <code>opened</code>, <code>keys</code>, <code>added</code>; at most 20 a day each, 5 adds). Counts only, never a provider of your own.</p>
<p id="plugins">With that part on, magpie also tells <code>usemagpie.ai</code>, on the same day, which of the plugins Discover lists are installed and on, so Discover can say how many use each one: <code>POST /api/plugins/report</code> with the same random id and the plugins’ npm names, or <code>github:owner/repo</code> for a repository tagged <code>magpie-plugin</code> (at most 50). A plugin from a folder, a private repository or a package Discover doesn’t list is never named. A like on a plugin’s page goes as <code>POST /api/plugins/like</code> with the id, the plugin and whether it is on, and only for a plugin installed here; the plugins you liked are kept in <code>plugin-likes.json</code>. The site counts the ids that reported a plugin in the last 7 days, drops a report after 30 days, and keeps your address only hashed, for an hour, to limit how often it is asked. Discover reads the counts from <code>GET /api/plugins/stats</code>, which carries no id. The code is <a href="https://github.com/yetone/magpie/blob/main/internal/stats/plugins.go">internal/stats/plugins.go</a> and <a href="https://github.com/yetone/magpie/blob/main/site/pluginstats.js">site/pluginstats.js</a>.</p>
<p id="plugins">With that part on, magpie also tells <code>usemagpie.ai</code>, on the same day, which of the plugins Discover lists are installed and on, so Discover can say how many use each one: <code>POST /api/plugins/report</code> with the same random id and the plugins’ npm names, or <code>github:owner/repo</code> for a repository tagged <code>magpie-plugin</code> (at most 50). A plugin from a folder, a private repository or a package Discover doesn’t list is never named. The same report names the MCP servers in your Library that an agent is given and that the Library’s market lists from what ships with magpie, by their market ids only (<code>context7</code>, <code>io.github.owner/name</code>; at most 50), so the market can put the most used first; a server of your own, or one found only by a search, is never named, nor its address, command or keys. A like on a plugin’s page goes as <code>POST /api/plugins/like</code> with the id, the plugin and whether it is on, and only for a plugin installed here; the plugins you liked are kept in <code>plugin-likes.json</code>. The site counts the ids that reported a plugin in the last 7 days, drops a report after 30 days, and keeps your address only hashed, for an hour, to limit how often it is asked. Discover reads the counts from <code>GET /api/plugins/stats</code>, which carries no id. The code is <a href="https://github.com/yetone/magpie/blob/main/internal/stats/plugins.go">internal/stats/plugins.go</a> and <a href="https://github.com/yetone/magpie/blob/main/site/pluginstats.js">site/pluginstats.js</a>.</p>
<p>Every event carries <code>$process_person_profile: false</code>, so PostHog keeps no person profile for the id. No names, base URLs, accounts, keys, prompts, replies or usage are sent. A whole batch looks like this:</p>
<div class="code">
<span class="lang">POST https://us.i.posthog.com/batch/</span>
@@ -238,7 +238,7 @@
<li><code>/files/&lt;version&gt;/&lt;file&gt;</code>: the release files an update and the installer download, served from Cloudflare R2. A file the site doesn’t hold is sent on to github.com. Nothing is counted.</li>
<li><code>/api/partners</code>: the add sheet’s partner list, every 6 hours. One fetch in ten is counted as a <code>magpie partners fetch</code> event, with the country Cloudflare gives, while a partner is listed.</li>
<li><code>/go/&lt;partner&gt;/site</code> and <code>/go/&lt;partner&gt;/keys</code>: a partner’s website and key-page links, opened in your browser, are counted (the partner, which link, a region, a country) as <code>magpie partner go</code> before you are sent on.</li>
<li><code>/api/plugins/stats</code>: Discover’s counts of how many use and like each plugin, at most once an hour. It carries no id; the <a href="#plugins">plugin report</a> and likes do, and go only with sharing what you use on.</li>
<li><code>/api/plugins/stats</code>: Discover’s counts of how many use and like each plugin, and the Library market’s of how many use each MCP server, at most once an hour. It carries no id; the <a href="#plugins">plugin report</a> and likes do, and go only with sharing what you use on.</li>
<li><code>/api/icon?url=…</code>: icons named by a plugin, an import link or the library are fetched through it, so their hosts see Cloudflare’s address, not yours. The worker passes the picture on and counts and keeps nothing.</li>
</ul>
<p>The site’s own pages (these docs, the home page) carry Cloudflare Web Analytics and PostHog Web Analytics (<code>us.i.posthog.com</code>), without cookies. PostHog keeps a random visitor id in your browser’s local storage for this site, so a return visit counts as the same visitor. It gets each page’s address, the page that sent you, what you click on the page (not what you type), how fast the page and its requests loaded, errors the page hit, your browser, system and screen size, the country and city your address is in, and a recording of the visit (what the page showed, mouse moves, clicks and scrolls, its console messages) with every input box masked; nothing at all when your browser sends Do Not Track or Global Privacy Control. PostHog’s requests go through this site, under <code>usemagpie.ai/r/</code>, which passes them and your address on to PostHog and keeps the site’s cookies. Following a <code>/download</code> link, or fetching <code>install.sh</code>, sends PostHog a count of its own: which file, your country, and whether a browser or a command asked; no id and no address. The app doesn’t load either. The code is <a href="https://github.com/yetone/magpie/blob/main/site/worker.js">site/worker.js</a>.</p>
+1 -1
View File
@@ -374,7 +374,7 @@ magpie claude group/opus-anywhere <span class="c"># use it</span></pre>
<p>The app (its window, the menu bar or tray icon and the panel, however it was opened) writes <code>app.log</code>: <code>~/Library/Logs/magpie/app.log</code> on macOS, <code>%LOCALAPPDATA%\magpie\logs\app.log</code> on Windows, <code>~/.local/state/magpie/app.log</code> on Linux (<code>$XDG_STATE_HOME/magpie</code> when that is set), and <code>logs</code> in a portable magpie’s data folder. <span class="ui">Settings</span> → <span class="ui">About</span> → <span class="ui">Log</span> has its path and an <span class="ui">Open</span> that shows its folder; <code>magpie log</code> prints it, and <code>magpie log -f</code> follows it. At 5 MiB it becomes <code>app.old.log</code> beside it, so two files at most are kept. It holds what magpie did and the errors it met (a provider refusing a request, a retry, a plugin that failed to start), not your keys, prompts or replies; what looks like a key or token is masked anyway. <code>magpie serve</code> run as a service logs elsewhere: <code>~/Library/Logs/magpie/serve.log</code> on macOS, <code>journalctl --user -u magpie</code> on Linux; <code>magpie log</code> names it too.</p>
<h3 id="privacy">What does magpie send about me?</h3>
<p>Your prompts, replies, keys and accounts go only to the providers you use; magpie has no server of its own in the path. Once a day a released magpie tells us it is in use, so we know how many people use it and what to look after first: a random id made up on your computer, magpie’s version and your system, and which agents, providers and models it is used with, by magpie’s own ids (<code>claude</code>, <code>deepseek</code>, <code>deepseek/deepseek-v4</code>) with how many of each. A provider you added yourself, and a model on it, is only <code>custom</code>. For each partner listed first in the add sheet, how many times a day it was shown, opened and added from goes with them, as counts only. No names, base URLs, accounts, keys, prompts or usage are sent. <span class="ui">Settings</span> → <span class="ui">Privacy</span> → <span class="ui">Share the agents, providers, models and plugins I use</span> leaves out the agents, providers and models, the partner counts and which of Discover’s plugins are installed (for its counts of who uses and likes each); <span class="ui">Count me as a user</span>, <code>DO_NOT_TRACK=1</code> or <code>MAGPIE_NO_STATS=1</code> turns it all off. Builds from source never send it. A partner's website and key-page links go through <code>usemagpie.ai/go/…</code>, which counts the click (the partner, which link, and a country) before sending you on, and usemagpie.ai counts how many times the partner list is fetched. The server sees these whatever the settings say, as any website sees its visits; no id, address or account is kept with them. Icons named by a plugin, an import link or the library are fetched through <code>usemagpie.ai/api/icon</code>, so their hosts see Cloudflare's address, not yours; the server only passes the picture on, and counts and keeps nothing. The <a href="/docs/privacy">Privacy page</a> lists everything magpie sends by itself, with an example of the daily count, the files it keeps and every switch.</p>
<p>Your prompts, replies, keys and accounts go only to the providers you use; magpie has no server of its own in the path. Once a day a released magpie tells us it is in use, so we know how many people use it and what to look after first: a random id made up on your computer, magpie’s version and your system, and which agents, providers and models it is used with, by magpie’s own ids (<code>claude</code>, <code>deepseek</code>, <code>deepseek/deepseek-v4</code>) with how many of each. A provider you added yourself, and a model on it, is only <code>custom</code>. For each partner listed first in the add sheet, how many times a day it was shown, opened and added from goes with them, as counts only. No names, base URLs, accounts, keys, prompts or usage are sent. <span class="ui">Settings</span> → <span class="ui">Privacy</span> → <span class="ui">Share the agents, providers, models and plugins I use</span> leaves out the agents, providers and models, the partner counts and which of Discover’s plugins are installed and which of the Library market’s MCP servers are used (for their counts of who uses and likes each); <span class="ui">Count me as a user</span>, <code>DO_NOT_TRACK=1</code> or <code>MAGPIE_NO_STATS=1</code> turns it all off. Builds from source never send it. A partner's website and key-page links go through <code>usemagpie.ai/go/…</code>, which counts the click (the partner, which link, and a country) before sending you on, and usemagpie.ai counts how many times the partner list is fetched. The server sees these whatever the settings say, as any website sees its visits; no id, address or account is kept with them. Icons named by a plugin, an import link or the library are fetched through <code>usemagpie.ai/api/icon</code>, so their hosts see Cloudflare's address, not yours; the server only passes the picture on, and counts and keeps nothing. The <a href="/docs/privacy">Privacy page</a> lists everything magpie sends by itself, with an example of the daily count, the files it keeps and every switch.</p>
<h3 id="proxy-loopback">The agent gets 502 or can’t connect, and nothing shows in magpie’s Routing tab?</h3>
<p>A proxy app (Surge, Clash, mihomo and the like, with system proxy, TUN or enhanced mode on) has taken the agent’s request to <code>http://127.0.0.1:3425</code> and sent it somewhere else, so it never reaches magpie. The bypass list (<code>skip-proxy</code>, “bypass”) isn’t always enough: some agents, Codex among them, send it through the proxy anyway. Add rules that send the local addresses direct, ahead of your other rules:</p>
+2 -2
View File
@@ -170,7 +170,7 @@
<li><b>模型</b>:接入的 agent 设定的模型,记为供应商 ID 加厂商模型 ID(<code>deepseek/deepseek-v4</code>)。密钥类供应商上 <a href="https://models.dev">models.dev</a> 没收录的模型 ID(本地模型、微调模型)只记作 <code>&lt;供应商&gt;/other</code>;你自己供应商上的模型记作 <code>custom</code>;路由组记作 <code>group</code>。</li>
</ul>
<p>同时发送 <code>magpie partner</code> 事件:添加供应商页里排在最前的每个合作伙伴,按它的 ID,在已结束的某一天里被展示、行被打开、Key 页面被打开、从它添加供应商的次数(<code>what</code>:<code>shown</code>、<code>opened</code>、<code>keys</code>、<code>added</code>;每天每项最多 20 次,添加最多 5 次)。只有次数,从不包含你自己的供应商。</p>
<p id="plugins">这部分开着时,magpie 当天还会告诉 <code>usemagpie.ai</code> 装了 Discover 里列出的哪些插件(且已开启),让 Discover 显示每个插件有多少人在用:<code>POST /api/plugins/report</code>,带同一个随机 ID 和插件的 npm 包名;打了 <code>magpie-plugin</code> 标签的仓库记作 <code>github:owner/repo</code>(最多 50 个)。来自本地文件夹、私有仓库或 Discover 没列出的包的插件,永远不会发送。在插件页点赞时发 <code>POST /api/plugins/like</code>,带 ID、插件名和点赞还是取消,只有本机装了的插件才能点赞;点过赞的插件记在 <code>plugin-likes.json</code>。网站只统计近 7 天上报过某个插件的 ID 数,30 天后删除上报记录;你的 IP 只以哈希形式保存一小时,用来限制请求频率。Discover 从 <code>GET /api/plugins/stats</code> 读取计数,这个请求不带 ID。代码见 <a href="https://github.com/yetone/magpie/blob/main/internal/stats/plugins.go">internal/stats/plugins.go</a> 和 <a href="https://github.com/yetone/magpie/blob/main/site/pluginstats.js">site/pluginstats.js</a>。</p>
<p id="plugins">这部分开着时,magpie 当天还会告诉 <code>usemagpie.ai</code> 装了 Discover 里列出的哪些插件(且已开启),让 Discover 显示每个插件有多少人在用:<code>POST /api/plugins/report</code>,带同一个随机 ID 和插件的 npm 包名;打了 <code>magpie-plugin</code> 标签的仓库记作 <code>github:owner/repo</code>(最多 50 个)。来自本地文件夹、私有仓库或 Discover 没列出的包的插件,永远不会发送。同一次上报还会带上资源库里分给了 agent、且资源库市场随 magpie 自带列出的 MCP 服务器,只用市场 ID(<code>context7</code>、<code>io.github.owner/name</code>,最多 50 个),让市场把用的人最多的排在前面;你自己的服务器、只靠搜索找到的服务器永远不会发送,服务器的地址、命令和密钥也不会。在插件页点赞时发 <code>POST /api/plugins/like</code>,带 ID、插件名和点赞还是取消,只有本机装了的插件才能点赞;点过赞的插件记在 <code>plugin-likes.json</code>。网站只统计近 7 天上报过某个插件的 ID 数,30 天后删除上报记录;你的 IP 只以哈希形式保存一小时,用来限制请求频率。Discover 从 <code>GET /api/plugins/stats</code> 读取计数,这个请求不带 ID。代码见 <a href="https://github.com/yetone/magpie/blob/main/internal/stats/plugins.go">internal/stats/plugins.go</a> 和 <a href="https://github.com/yetone/magpie/blob/main/site/pluginstats.js">site/pluginstats.js</a>。</p>
<p>每个事件都带 <code>$process_person_profile: false</code>,PostHog 不为这个 ID 建用户档案。不发送名称、Base URL、账号、密钥、提示词、回复和用量。一整批大致如下:</p>
<div class="code">
<span class="lang">POST https://us.i.posthog.com/batch/</span>
@@ -238,7 +238,7 @@
<li><code>/files/&lt;版本&gt;/&lt;文件&gt;</code>:更新和安装脚本下载的发布文件,由 Cloudflare R2 提供;站点上没有的文件会转到 github.com。不做任何统计。</li>
<li><code>/api/partners</code>:添加供应商页的合作伙伴列表,每 6 小时一次。在有合作伙伴上架时,每十次拉取记一次 <code>magpie partners fetch</code> 事件,附 Cloudflare 给出的国家。</li>
<li><code>/go/&lt;合作伙伴&gt;/site</code> 和 <code>/go/&lt;合作伙伴&gt;/keys</code>:在浏览器里打开合作伙伴的官网和 Key 页面链接时,先记一次 <code>magpie partner go</code>(哪个合作伙伴、哪个链接、地区、国家),再跳转。</li>
<li><code>/api/plugins/stats</code>:Discover 里每个插件的在用人数和点赞数,最多每小时取一次,不带 ID;<a href="#plugins">插件上报</a>和点赞带 ID,只在开着分享时发送。</li>
<li><code>/api/plugins/stats</code>:Discover 里每个插件的在用人数和点赞数,以及资源库市场里每个 MCP 服务器的在用人数,最多每小时取一次,不带 ID;<a href="#plugins">插件上报</a>和点赞带 ID,只在开着分享时发送。</li>
<li><code>/api/icon?url=…</code>:插件、导入链接和库里的图标经它获取,图标所在的服务器只看到 Cloudflare 的地址,看不到你的。它只转发图片,不计数也不记录。</li>
</ul>
<p>网站自己的页面(这些文档、首页)带 Cloudflare Web Analytics 和 PostHog Web Analytics(<code>us.i.posthog.com</code>),都不用 Cookie。PostHog 在浏览器的本地存储里为本站记一个随机访客 id,再次访问算同一位访客。它收到每个页面的地址、来源页面、你在页面上点了什么(不含输入的内容)、页面及其请求的加载速度、页面遇到的报错、浏览器、系统和屏幕尺寸、IP 所在的国家和城市,以及这次访问的录屏(页面显示的内容、鼠标移动、点击、滚动和控制台消息),所有输入框都被遮住;浏览器开了 Do Not Track 或 Global Privacy Control 就什么都不发。PostHog 的请求经由本站的 <code>usemagpie.ai/r/</code> 转给 PostHog,连同你的 IP 一起转发,本站的 Cookie 不转发。打开 <code>/download</code> 下载链接或获取 <code>install.sh</code> 时,会另外向 PostHog 发一次计数:哪个文件、你所在的国家、是浏览器还是命令发起的;不带 id,也不带 IP。应用两者都不加载。代码见 <a href="https://github.com/yetone/magpie/blob/main/site/worker.js">site/worker.js</a>。</p>
+1 -1
View File
@@ -374,7 +374,7 @@ magpie claude group/opus-anywhere <span class="c"># 使用它</span></pre>
<p>应用(窗口、菜单栏或托盘图标、快捷面板,不论怎样打开)写入 <code>app.log</code>:macOS 上是 <code>~/Library/Logs/magpie/app.log</code>,Windows 上是 <code>%LOCALAPPDATA%\magpie\logs\app.log</code>,Linux 上是 <code>~/.local/state/magpie/app.log</code>(设置了 <code>$XDG_STATE_HOME</code> 时是 <code>$XDG_STATE_HOME/magpie</code>),便携版则在数据文件夹的 <code>logs</code> 里。<span class="ui">设置</span> → <span class="ui">关于</span> → <span class="ui">日志</span>里有它的路径,<span class="ui">打开</span>会显示它所在的文件夹;<code>magpie log</code> 打印路径,<code>magpie log -f</code> 持续跟随。满 5 MiB 后它变成旁边的 <code>app.old.log</code>,最多保留两个文件。它记的是 magpie 做了什么、遇到了哪些错误(服务商拒绝请求、重试、插件没能启动),不含你的密钥、提示词或回复;看起来像密钥或令牌的内容也会被遮掉。作为服务运行的 <code>magpie serve</code> 日志在别处:macOS 上是 <code>~/Library/Logs/magpie/serve.log</code>,Linux 上是 <code>journalctl --user -u magpie</code>;<code>magpie log</code> 也会列出它。</p>
<h3 id="privacy">magpie 会发送我的哪些信息?</h3>
<p>你的提示词、回复、密钥和账号只发给你用的供应商,中间没有 magpie 自己的服务器。正式发布的 magpie 每天告诉我们一次它在用,好让我们知道有多少人在用、该先照顾哪些:本机随机生成的 ID、magpie 版本和系统,以及用了哪些 agent、供应商和模型,只用 magpie 自己的 ID(<code>claude</code>、<code>deepseek</code>、<code>deepseek/deepseek-v4</code>)和各自的数量。你自己添加的供应商及其上的模型只记作 <code>custom</code>。添加供应商页里排在最前的合作伙伴,每天被展示、打开和添加的次数也一并发送,只有次数。不发送名称、Base URL、账号、密钥、提示词和用量。<span class="ui">设置</span> → <span class="ui">隐私</span> → <span class="ui">分享我用的 agent、provider、模型和插件</span> 可以去掉 agent、供应商、模型、合作伙伴次数,以及装了 Discover 里哪些插件(用于统计每个插件的在用人数和点赞)这部分;<span class="ui">计入用户数</span>、<code>DO_NOT_TRACK=1</code> 或 <code>MAGPIE_NO_STATS=1</code> 全部关闭。从源码构建的版本从不发送。合作伙伴的官网和「获取 Key」链接经 <code>usemagpie.ai/go/…</code> 跳转,跳转前记一次点击(哪个合作伙伴、哪个链接、哪个国家),usemagpie.ai 也会统计合作伙伴列表被拉取的次数。这部分是服务器本身看到的,和任何网站统计访问一样,不受上面的设置影响;不记录 ID、IP 和账号。插件、导入链接和库里的图标经 <code>usemagpie.ai/api/icon</code> 获取,图标所在的服务器只看到 Cloudflare 的地址,看不到你的 IP;这台服务器只转发图片,不计数也不记录。<a href="/docs/zh/privacy">隐私页</a>列出了 magpie 自己发出的所有内容,附每日计数的示例、它在本机留下的文件和每个开关。</p>
<p>你的提示词、回复、密钥和账号只发给你用的供应商,中间没有 magpie 自己的服务器。正式发布的 magpie 每天告诉我们一次它在用,好让我们知道有多少人在用、该先照顾哪些:本机随机生成的 ID、magpie 版本和系统,以及用了哪些 agent、供应商和模型,只用 magpie 自己的 ID(<code>claude</code>、<code>deepseek</code>、<code>deepseek/deepseek-v4</code>)和各自的数量。你自己添加的供应商及其上的模型只记作 <code>custom</code>。添加供应商页里排在最前的合作伙伴,每天被展示、打开和添加的次数也一并发送,只有次数。不发送名称、Base URL、账号、密钥、提示词和用量。<span class="ui">设置</span> → <span class="ui">隐私</span> → <span class="ui">分享我用的 agent、provider、模型和插件</span> 可以去掉 agent、供应商、模型、合作伙伴次数,以及装了 Discover 里哪些插件、用了资源库市场里哪些 MCP 服务器(用于统计在用人数和点赞)这部分;<span class="ui">计入用户数</span>、<code>DO_NOT_TRACK=1</code> 或 <code>MAGPIE_NO_STATS=1</code> 全部关闭。从源码构建的版本从不发送。合作伙伴的官网和「获取 Key」链接经 <code>usemagpie.ai/go/…</code> 跳转,跳转前记一次点击(哪个合作伙伴、哪个链接、哪个国家),usemagpie.ai 也会统计合作伙伴列表被拉取的次数。这部分是服务器本身看到的,和任何网站统计访问一样,不受上面的设置影响;不记录 ID、IP 和账号。插件、导入链接和库里的图标经 <code>usemagpie.ai/api/icon</code> 获取,图标所在的服务器只看到 Cloudflare 的地址,看不到你的 IP;这台服务器只转发图片,不计数也不记录。<a href="/docs/zh/privacy">隐私页</a>列出了 magpie 自己发出的所有内容,附每日计数的示例、它在本机留下的文件和每个开关。</p>
<h3 id="proxy-loopback">Agent 报 502 或连不上,magpie 的路由标签页里却什么都没有?</h3>
<p>代理软件(Surge、Clash、mihomo 等,开了系统代理、TUN 或增强模式)把 Agent 发往 <code>http://127.0.0.1:3425</code> 的请求接走、转去了别处,请求根本没到 magpie。只在跳过列表(<code>skip-proxy</code>、「绕过」)里写 127.0.0.1 不一定够:有些 Agent(比如 Codex)照样会走代理。在代理软件里加两条本地地址直连的规则,放在其他规则前面:</p>
+3 -3
View File
@@ -272,7 +272,7 @@ The app (its window, the menu bar or tray icon and the panel, however it was ope
### What does magpie send about me?
Your prompts, replies, keys and accounts go only to the providers you use; magpie has no server of its own in the path. Once a day a released magpie tells us it is in use, so we know how many people use it and what to look after first: a random id made up on your computer, magpie’s version and your system, and which agents, providers and models it is used with, by magpie’s own ids (`claude`, `deepseek`, `deepseek/deepseek-v4`) with how many of each. A provider you added yourself, and a model on it, is only `custom`. For each partner listed first in the add sheet, how many times a day it was shown, opened and added from goes with them, as counts only. No names, base URLs, accounts, keys, prompts or usage are sent. Settings → Privacy → Share the agents, providers, models and plugins I use leaves out the agents, providers and models, the partner counts and which of Discover’s plugins are installed (for its counts of who uses and likes each); Count me as a user, `DO_NOT_TRACK=1` or `MAGPIE_NO_STATS=1` turns it all off. Builds from source never send it. A partner's website and key-page links go through `usemagpie.ai/go/…`, which counts the click (the partner, which link, and a country) before sending you on, and usemagpie.ai counts how many times the partner list is fetched. The server sees these whatever the settings say, as any website sees its visits; no id, address or account is kept with them. Icons named by a plugin, an import link or the library are fetched through `usemagpie.ai/api/icon`, so their hosts see Cloudflare's address, not yours; the server only passes the picture on, and counts and keeps nothing. The [Privacy page](https://usemagpie.ai/docs/privacy) lists everything magpie sends by itself, with an example of the daily count, the files it keeps and every switch.
Your prompts, replies, keys and accounts go only to the providers you use; magpie has no server of its own in the path. Once a day a released magpie tells us it is in use, so we know how many people use it and what to look after first: a random id made up on your computer, magpie’s version and your system, and which agents, providers and models it is used with, by magpie’s own ids (`claude`, `deepseek`, `deepseek/deepseek-v4`) with how many of each. A provider you added yourself, and a model on it, is only `custom`. For each partner listed first in the add sheet, how many times a day it was shown, opened and added from goes with them, as counts only. No names, base URLs, accounts, keys, prompts or usage are sent. Settings → Privacy → Share the agents, providers, models and plugins I use leaves out the agents, providers and models, the partner counts and which of Discover’s plugins are installed and which of the Library market’s MCP servers are used (for their counts of who uses and likes each); Count me as a user, `DO_NOT_TRACK=1` or `MAGPIE_NO_STATS=1` turns it all off. Builds from source never send it. A partner's website and key-page links go through `usemagpie.ai/go/…`, which counts the click (the partner, which link, and a country) before sending you on, and usemagpie.ai counts how many times the partner list is fetched. The server sees these whatever the settings say, as any website sees its visits; no id, address or account is kept with them. Icons named by a plugin, an import link or the library are fetched through `usemagpie.ai/api/icon`, so their hosts see Cloudflare's address, not yours; the server only passes the picture on, and counts and keeps nothing. The [Privacy page](https://usemagpie.ai/docs/privacy) lists everything magpie sends by itself, with an example of the daily count, the files it keeps and every switch.
### The agent gets 502 or can’t connect, and nothing shows in magpie’s Routing tab?
@@ -12124,7 +12124,7 @@ Unless you turn that part off, one `magpie uses` event follows for each agent, p
With them go `magpie partner` events: for each partner listed first in the add sheet, by its id, how many times on a day that has ended the sheet showed it, its row was opened, its key page was opened, and a provider was added from it (`what`: `shown`, `opened`, `keys`, `added`; at most 20 a day each, 5 adds). Counts only, never a provider of your own.
With that part on, magpie also tells `usemagpie.ai`, on the same day, which of the plugins Discover lists are installed and on, so Discover can say how many use each one: `POST /api/plugins/report` with the same random id and the plugins’ npm names, or `github:owner/repo` for a repository tagged `magpie-plugin` (at most 50). A plugin from a folder, a private repository or a package Discover doesn’t list is never named. A like on a plugin’s page goes as `POST /api/plugins/like` with the id, the plugin and whether it is on, and only for a plugin installed here; the plugins you liked are kept in `plugin-likes.json`. The site counts the ids that reported a plugin in the last 7 days, drops a report after 30 days, and keeps your address only hashed, for an hour, to limit how often it is asked. Discover reads the counts from `GET /api/plugins/stats`, which carries no id. The code is [internal/stats/plugins.go](https://github.com/yetone/magpie/blob/main/internal/stats/plugins.go) and [site/pluginstats.js](https://github.com/yetone/magpie/blob/main/site/pluginstats.js).
With that part on, magpie also tells `usemagpie.ai`, on the same day, which of the plugins Discover lists are installed and on, so Discover can say how many use each one: `POST /api/plugins/report` with the same random id and the plugins’ npm names, or `github:owner/repo` for a repository tagged `magpie-plugin` (at most 50). A plugin from a folder, a private repository or a package Discover doesn’t list is never named. The same report names the MCP servers in your Library that an agent is given and that the Library’s market lists from what ships with magpie, by their market ids only (`context7`, `io.github.owner/name`; at most 50), so the market can put the most used first; a server of your own, or one found only by a search, is never named, nor its address, command or keys. A like on a plugin’s page goes as `POST /api/plugins/like` with the id, the plugin and whether it is on, and only for a plugin installed here; the plugins you liked are kept in `plugin-likes.json`. The site counts the ids that reported a plugin in the last 7 days, drops a report after 30 days, and keeps your address only hashed, for an hour, to limit how often it is asked. Discover reads the counts from `GET /api/plugins/stats`, which carries no id. The code is [internal/stats/plugins.go](https://github.com/yetone/magpie/blob/main/internal/stats/plugins.go) and [site/pluginstats.js](https://github.com/yetone/magpie/blob/main/site/pluginstats.js).
Every event carries `$process_person_profile: false`, so PostHog keeps no person profile for the id. No names, base URLs, accounts, keys, prompts, replies or usage are sent. A whole batch looks like this:
@@ -12198,7 +12198,7 @@ magpie asks its own site for a few things, whatever the privacy settings say, as
- `/files/<version>/<file>`: the release files an update and the installer download, served from Cloudflare R2. A file the site doesn’t hold is sent on to github.com. Nothing is counted.
- `/api/partners`: the add sheet’s partner list, every 6 hours. One fetch in ten is counted as a `magpie partners fetch` event, with the country Cloudflare gives, while a partner is listed.
- `/go/<partner>/site` and `/go/<partner>/keys`: a partner’s website and key-page links, opened in your browser, are counted (the partner, which link, a region, a country) as `magpie partner go` before you are sent on.
- `/api/plugins/stats`: Discover’s counts of how many use and like each plugin, at most once an hour. It carries no id; the plugin report and likes do, and go only with sharing what you use on.
- `/api/plugins/stats`: Discover’s counts of how many use and like each plugin, and the Library market’s of how many use each MCP server, at most once an hour. It carries no id; the plugin report and likes do, and go only with sharing what you use on.
- `/api/icon?url=…`: icons named by a plugin, an import link or the library are fetched through it, so their hosts see Cloudflare’s address, not yours. The worker passes the picture on and counts and keeps nothing.
The site’s own pages (these docs, the home page) carry Cloudflare Web Analytics and PostHog Web Analytics (`us.i.posthog.com`), without cookies. PostHog keeps a random visitor id in your browser’s local storage for this site, so a return visit counts as the same visitor. It gets each page’s address, the page that sent you, what you click on the page (not what you type), how fast the page and its requests loaded, errors the page hit, your browser, system and screen size, the country and city your address is in, and a recording of the visit (what the page showed, mouse moves, clicks and scrolls, its console messages) with every input box masked; nothing at all when your browser sends Do Not Track or Global Privacy Control. PostHog’s requests go through this site, under `usemagpie.ai/r/`, which passes them and your address on to PostHog and keeps the site’s cookies. Following a `/download` link, or fetching `install.sh`, sends PostHog a count of its own: which file, your country, and whether a browser or a command asked; no id and no address. The app doesn’t load either. The code is [site/worker.js](https://github.com/yetone/magpie/blob/main/site/worker.js).
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long