docker: the image has npx, node, npm, uvx and python for the Library's MCP servers
Passings_z on X: in magpie's Docker image, adding Chrome DevTools' MCP
server from the Library said "npx not found". The runtime stage is
debian:12-slim with ca-certificates and curl only, and the Library's
servers run in the container (gateway mode keeps Library's MCP servers
and the router), so every featured entry but the remote ones failed the
same way: npx for chrome-devtools, playwright, filesystem, memory,
sequential-thinking, brave, firecrawl, tavily and everme, uvx for fetch,
git and time, and the registry's npx/uvx entries.
The image now copies in Node 24.22.3 (node, npm, npx, from the official
bookworm image, matching Debian 12's glibc) and uv 0.13.7 (uv, uvx, from
astral's image). python and python3 are a two-line shim onto uv's own
Python, which uv downloads into the volume on first use (UV_PYTHON=3.14).
UV_PYTHON_PREFERENCE=only-managed keeps uv from taking the shim as an
interpreter: without it uvx recursed and hung looking for one.
Size (docker image inspect / du -sxm / as root):
origin/main 74,636,782 B compressed, 190 MB on disk
this 142,667,379 B compressed, 370 MB on disk (+68 MB, +180 MB)
node is 127 MB of it, npm 19 MB, uv and uvx 43 MB. Bun in place of npx
was weighed and left: agents in the container read PATH themselves, and
Bun's Node compatibility isn't every server's.
The image still has no browser (Chrome would be ~300 MB more for every
user). Chrome DevTools' and Playwright's servers start, list their tools,
and every tool then fails: "Could not find Google Chrome executable for
channel 'stable' at: /opt/google/chrome/chrome" (seen in the image). The
check now reports such a server, run by npx/bunx/pnpx in a container with
no /opt/google/chrome/chrome and no option pointing it at a browser
(--browserUrl/-u, --wsEndpoint, --executablePath, --channel,
--autoConnect; --cdp-endpoint, --executable-path, --browser,
--extension), as Why "nobrowser" with its tools still counted. The row
says "no Chrome here", and its tooltip points at Magpie Browser or the
server's option for a Chrome it can reach; the hub's text says the same.
Desktops, macOS and an image with Chrome are unchanged. A docker-launched
(OCI) entry still says docker not found: there is no Docker in the
container. Docs (en, zh, ja docker.html) get an "MCP servers" section;
the Docker workflow's smoke test runs node/npm/npx/uvx/uv -v and finds
python3 and python.
Run:
- Docker on xiaomi-gpu, origin/main's Dockerfile vs this one, web mode
with a fresh volume, servers added with `magpie library mcp add` and
checked through POST /api/library/mcp/check:
- origin/main: chrome-devtools, memory: notfound "npx"; fetch:
notfound "uvx" (the report).
- this: memory ok, 9 tools; fetch (uvx mcp-server-fetch) ok, 1 tool,
Python downloaded on first run; chrome-devtools error nobrowser
--browserUrl, 33 tools.
- tools/call over stdio inside the container with a small node MCP
client: memory create_entities returned the entity; fetch fetched
https://example.com; chrome-devtools new_page returned the Chrome
error above.
- go test -run 'TestNoBrowser|TestCheckSaysNoBrowser|TestCheckStdio'
./internal/library on mote: ok. Broken by hand (the hook in
checkServer turned off): TestCheckSaysNoBrowser red, "got {State:ok
Tools:3 …}".
- GUI on mote, Chromium and WebKit, en zh zh-TW ja de, 1100 and 390:
mcp-no-browser (new), mcp-home-health, library-mcp-health, i18n-keys,
i18n-en-no-cjk: 58 of 58 pass.
- gofmt -l clean; go vet ./..., GOOS=linux go vet -tags nogui ./...,
GOOS=windows go vet ./... and go build ok on mote.
- go test -timeout 45m ./... on mote at this head (on e1c186cfe): 103
packages ok, none failed (internal/gateway 1039s, internal/library
408s).
Not tried: an arm64 build of the image (both base images are
multi-arch; CI builds it). The test box's network to npm dropped
mid-run: npx -y then timed out the 30s check step, and one npx install
cut short left ~/.npm/_npx with a missing module until it was removed;
that is npm's cache, the same on a desktop.
This commit is contained in:
@@ -54,6 +54,10 @@ jobs:
|
||||
# a NAS panel's terminal opens bash or sh, with magpie on PATH
|
||||
docker exec smoke /bin/bash -c 'magpie healthcheck && ls /config >/dev/null'
|
||||
docker exec smoke /bin/sh -c 'echo sh works'
|
||||
# what the Library's MCP servers start with, as the nonroot user
|
||||
# (Passings_z on X: "npx not found"); python's first run would
|
||||
# download one, so it is only found here
|
||||
docker exec smoke /bin/sh -c 'node -v && npm -v && npx -v && uvx --version && uv --version && command -v python3 python'
|
||||
|
||||
CODE=$(curl -s -o /tmp/body.json -w '%{http_code}' \
|
||||
-H 'Authorization: Bearer magpie' -H 'Content-Type: application/json' \
|
||||
|
||||
+25
@@ -13,6 +13,15 @@ RUN CGO_ENABLED=0 go build -tags nogui -trimpath \
|
||||
-ldflags "-s -w -X main.version=${VERSION}" -o /out/magpie . \
|
||||
&& mkdir -p /config/home /config/cache /config/data /config/state
|
||||
|
||||
# The runtimes the Library's MCP servers start with: npx (most of them,
|
||||
# chrome-devtools among them: "npx not found", Passings_z on X), node and
|
||||
# npm (magpie installs an npx server's package and runs it with node,
|
||||
# mcp_npx.go), and uvx. Node is the official build, for Debian 12's glibc;
|
||||
# uv's static binaries download the Python a uvx server needs into the
|
||||
# volume the first time.
|
||||
FROM node:24.22.3-bookworm-slim AS node
|
||||
FROM ghcr.io/astral-sh/uv:0.13.7 AS uv
|
||||
|
||||
# Debian, not distroless: a subscription's CLI is installed with its
|
||||
# vendor's `curl … | bash` (Cursor, Devin, Grok Build), and the CLI it
|
||||
# installs is a glibc binary that needs a full system's loader and
|
||||
@@ -29,6 +38,19 @@ RUN apt-get update \
|
||||
&& groupadd -g 65532 nonroot \
|
||||
&& useradd -u 65532 -g nonroot -d /config/home -s /bin/bash nonroot
|
||||
|
||||
COPY --from=node /usr/local/bin/node /usr/local/bin/node
|
||||
COPY --from=node /usr/local/lib/node_modules/npm /usr/local/lib/node_modules/npm
|
||||
COPY --from=uv /uv /uvx /usr/local/bin/
|
||||
# python and python3 are uv's own Python, downloaded once, so a server
|
||||
# started as `python3 server.py` runs too. uv takes only its own Pythons
|
||||
# (UV_PYTHON_PREFERENCE below): one found on PATH would be this script,
|
||||
# which asks uv again, and uvx hung looking for an interpreter.
|
||||
RUN ln -s ../lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm \
|
||||
&& ln -s ../lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npx \
|
||||
&& printf '#!/bin/sh\nexec uv run --no-project --quiet python "$@"\n' > /usr/local/bin/python3 \
|
||||
&& chmod 755 /usr/local/bin/python3 \
|
||||
&& ln -s python3 /usr/local/bin/python
|
||||
|
||||
COPY --from=build /out/magpie /magpie
|
||||
# magpie on PATH, so `magpie accounts add …` works in that terminal
|
||||
RUN ln -s /magpie /usr/local/bin/magpie
|
||||
@@ -45,6 +67,9 @@ ENV HOME=/config/home \
|
||||
XDG_CACHE_HOME=/config/cache \
|
||||
XDG_DATA_HOME=/config/data \
|
||||
XDG_STATE_HOME=/config/state \
|
||||
NPM_CONFIG_UPDATE_NOTIFIER=false \
|
||||
UV_PYTHON_PREFERENCE=only-managed \
|
||||
UV_PYTHON=3.14 \
|
||||
MAGPIE_ADDR=0.0.0.0:3425
|
||||
|
||||
VOLUME /config
|
||||
|
||||
@@ -3659,6 +3659,9 @@ magpie.plugin("library", (ctx) => {
|
||||
}
|
||||
switch (h.why) {
|
||||
case "home": return [t("won't start in home"), more(t("It exits when started in your home folder, where magpie runs it for the agents given it, and works in a project folder. Turn off Through the MCP router in its editor, so each agent starts it in its own project"))];
|
||||
// Chrome DevTools' or Playwright's server in magpie's container: its
|
||||
// tools are listed, and each fails for want of a Chrome
|
||||
case "nobrowser": return [t("no Chrome here"), t("It lists its {n} tools, but they drive a Chrome it starts itself, and there is none where magpie runs. Magpie Browser, in the Library, uses your own Chrome instead; or start it with {opt} at a Chrome it can reach", { n: h.tools, opt: h.detail })];
|
||||
case "notfound": return [t("can't start: {cmd} not found", { cmd: h.detail }), t("Can't start it: there is no {cmd} on the PATH magpie has", { cmd: h.detail })];
|
||||
case "start": return [t("can't start"), more(t("Can't start it"))];
|
||||
case "exited": return [h.code ? t("exited ({code})", { code: h.code }) : t("exited"), more(h.code ? t("It exited with code {code} before listing its tools", { code: h.code }) : t("It exited before listing its tools"))];
|
||||
|
||||
@@ -316,6 +316,8 @@ magpie.strings({
|
||||
"The server refused magpie (HTTP {code}) — a key in its headers may be missing or wrong": "服务器拒绝了 magpie(HTTP {code})— Headers 里的密钥可能缺失或有误",
|
||||
"can't start: {cmd} not found": "无法启动:找不到 {cmd}",
|
||||
"Can't start it: there is no {cmd} on the PATH magpie has": "无法启动:magpie 的 PATH 里没有 {cmd}",
|
||||
"no Chrome here": "这里没有 Chrome",
|
||||
"It lists its {n} tools, but they drive a Chrome it starts itself, and there is none where magpie runs. Magpie Browser, in the Library, uses your own Chrome instead; or start it with {opt} at a Chrome it can reach": "它列出了 {n} 个工具,但这些工具要驱动它自己启动的 Chrome,而 magpie 运行的地方没有 Chrome。资源库里的 Magpie Browser 改用你自己的 Chrome;也可以用 {opt} 让它连接一个能访问到的 Chrome",
|
||||
"Can't start it": "无法启动",
|
||||
"exited ({code})": "已退出({code})",
|
||||
"It exited with code {code} before listing its tools": "列出工具前就退出了,退出码 {code}",
|
||||
@@ -1415,6 +1417,8 @@ magpie.strings({
|
||||
"The server refused magpie (HTTP {code}) — a key in its headers may be missing or wrong": "伺服器拒絕了 magpie(HTTP {code})— Headers 裡的金鑰可能缺失或有誤",
|
||||
"can't start: {cmd} not found": "無法啟動:找不到 {cmd}",
|
||||
"Can't start it: there is no {cmd} on the PATH magpie has": "無法啟動:magpie 的 PATH 裡沒有 {cmd}",
|
||||
"no Chrome here": "這裡沒有 Chrome",
|
||||
"It lists its {n} tools, but they drive a Chrome it starts itself, and there is none where magpie runs. Magpie Browser, in the Library, uses your own Chrome instead; or start it with {opt} at a Chrome it can reach": "它列出了 {n} 個工具,但這些工具要驅動它自己啟動的 Chrome,而 magpie 執行的地方沒有 Chrome。資源庫裡的 Magpie Browser 改用你自己的 Chrome;也可以用 {opt} 讓它連線一個能存取到的 Chrome",
|
||||
"Can't start it": "無法啟動",
|
||||
"exited ({code})": "已退出({code})",
|
||||
"It exited with code {code} before listing its tools": "列出工具前就退出了,退出碼 {code}",
|
||||
@@ -2505,6 +2509,8 @@ magpie.strings({
|
||||
"The server refused magpie (HTTP {code}) — a key in its headers may be missing or wrong": "サーバーが magpie を拒否しました(HTTP {code})。ヘッダーのキーが不足しているか誤っている可能性があります",
|
||||
"can't start: {cmd} not found": "起動できません:{cmd} が見つかりません",
|
||||
"Can't start it: there is no {cmd} on the PATH magpie has": "起動できません:magpie の PATH に {cmd} がありません",
|
||||
"no Chrome here": "ここに Chrome がありません",
|
||||
"It lists its {n} tools, but they drive a Chrome it starts itself, and there is none where magpie runs. Magpie Browser, in the Library, uses your own Chrome instead; or start it with {opt} at a Chrome it can reach": "{n} 個のツールを一覧にしましたが、どれも自分で起動する Chrome を操作します。magpie が動いている場所には Chrome がありません。ライブラリの Magpie Browser なら、あなた自身の Chrome を使います。または {opt} で、届く Chrome を指定して起動してください",
|
||||
"Can't start it": "起動できません",
|
||||
"exited ({code})": "終了しました({code})",
|
||||
"It exited with code {code} before listing its tools": "ツールを一覧表示する前にコード {code} で終了しました",
|
||||
@@ -3600,6 +3606,8 @@ magpie.strings({
|
||||
"The server refused magpie (HTTP {code}) — a key in its headers may be missing or wrong": "Der Server hat magpie abgelehnt (HTTP {code}) — ein Schlüssel in seinen Headern fehlt möglicherweise oder ist falsch",
|
||||
"can't start: {cmd} not found": "Start nicht möglich: {cmd} nicht gefunden",
|
||||
"Can't start it: there is no {cmd} on the PATH magpie has": "Start nicht möglich: {cmd} ist nicht im PATH von magpie",
|
||||
"no Chrome here": "kein Chrome hier",
|
||||
"It lists its {n} tools, but they drive a Chrome it starts itself, and there is none where magpie runs. Magpie Browser, in the Library, uses your own Chrome instead; or start it with {opt} at a Chrome it can reach": "Es listet seine {n} Werkzeuge, doch sie steuern ein Chrome, das es selbst startet, und wo magpie läuft, gibt es keins. Magpie Browser in der Bibliothek nutzt stattdessen dein eigenes Chrome; oder starte es mit {opt} für ein Chrome, das es erreicht",
|
||||
"Can't start it": "Start nicht möglich",
|
||||
"exited ({code})": "beendet ({code})",
|
||||
"It exited with code {code} before listing its tools": "Mit Code {code} beendet, bevor die Tools aufgelistet wurden",
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
// Run with Node's test runner and Playwright on the module path; see README.md.
|
||||
// Passings_z on X: in magpie's Docker image, Chrome DevTools' MCP server
|
||||
// listed its tools and each one failed, for want of a Chrome the image
|
||||
// doesn't ship. Its row says there is no Chrome there, in red, and its
|
||||
// tooltip says what works instead: Magpie Browser, or the server's option
|
||||
// for a Chrome it can reach. A server beside it that is fine is unchanged.
|
||||
// Every language, Chromium and WebKit, 1100 and 390 wide; nothing scrolls
|
||||
// sideways. No backend: the API is faked here.
|
||||
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 { I18N } = require("./strings.cjs").strings(); // i18n.js's and the plugins'
|
||||
const tr = (lang, s, vars = {}) => ((lang === "en" ? s : I18N[lang][s]) || s).replace(/\{(\w+)\}/g, (_, k) => vars[k]);
|
||||
const HOME = "/config/home";
|
||||
const agents = [
|
||||
{ id: "claude", name: "Claude Code", icon: "", skills: `${HOME}/.claude/skills`, mcp: `${HOME}/.claude.json` },
|
||||
];
|
||||
const WORDS = [
|
||||
"no Chrome here",
|
||||
"It lists its {n} tools, but they drive a Chrome it starts itself, and there is none where magpie runs. Magpie Browser, in the Library, uses your own Chrome instead; or start it with {opt} at a Chrome it can reach",
|
||||
];
|
||||
const found = {
|
||||
"chrome-devtools": { state: "error", why: "nobrowser", detail: "--browserUrl", tools: 33 },
|
||||
memory: { state: "ok", tools: 9 },
|
||||
};
|
||||
|
||||
function server(lang, calls) {
|
||||
const lib = {
|
||||
dir: `${HOME}/.magpie/library`, backups: `${HOME}/.magpie/backups`, home: HOME,
|
||||
agents, mcpHub: false, hubPath: "/mcp/magpie/hub/",
|
||||
instructions: { agents: [], sets: [] }, foundServers: [], projects: [], foundSkills: [], skills: [],
|
||||
servers: [
|
||||
{ name: "chrome-devtools", transport: "stdio", command: "npx", args: ["-y", "chrome-devtools-mcp@latest"], agents: ["claude"] },
|
||||
{ name: "memory", transport: "stdio", command: "npx", args: ["-y", "@modelcontextprotocol/server-memory"], agents: ["claude"] },
|
||||
],
|
||||
};
|
||||
return async (route) => {
|
||||
const req = route.request(), url = new URL(req.url());
|
||||
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 route.fulfill({ json: { agents: [], profiles: [], settings: { lang, theme: "light", gateway: "http://127.0.0.1:3425" } } });
|
||||
if (url.pathname === "/api/plugins") return route.fulfill({ json: { plugins: [] } });
|
||||
if (url.pathname === "/api/library") return route.fulfill({ json: lib });
|
||||
if (url.pathname === "/api/library/mcp/check") {
|
||||
const names = req.postDataJSON().names || Object.keys(found);
|
||||
return route.fulfill({ json: { servers: Object.fromEntries(names.map((n) => [n, found[n]])) } });
|
||||
}
|
||||
if (url.pathname === "/api/library/servers/save") {
|
||||
const { old, server: s } = req.postDataJSON();
|
||||
calls.push(`${s.name} ${JSON.stringify(s.hub)}`);
|
||||
const i = lib.servers.findIndex((x) => x.name === old);
|
||||
lib.servers[i] = { ...lib.servers[i], ...s };
|
||||
if (!s.hub) delete lib.servers[i].hub;
|
||||
return route.fulfill({ json: { ...lib, result: { changed: ["codex"] } } });
|
||||
}
|
||||
if (url.pathname === "/api/usage/quotas") return route.fulfill({ json: [] });
|
||||
if (url.pathname === "/api/groups") return route.fulfill({ json: { groups: [] } });
|
||||
if (url.pathname === "/api/providers") return route.fulfill({ json: { providers: [], gateway: { running: true } } });
|
||||
if (url.pathname.startsWith("/api/")) return route.fulfill({ 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)];
|
||||
await route.fulfill({ body: await fs.readFile(file), contentType });
|
||||
};
|
||||
}
|
||||
|
||||
for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) {
|
||||
test(engine + ": a browser server with no Chrome", async (t) => {
|
||||
assert(["chromium", "webkit"].includes(engine), "BROWSER must be chromium or webkit");
|
||||
const browser = await (engine === "webkit" ? webkit.launch() : chromium.launch({ channel: process.env.PLAYWRIGHT_CHANNEL || "chromium" }));
|
||||
const errors = [];
|
||||
t.after(async () => {
|
||||
if (errors.length) console.log(errors);
|
||||
await browser.close();
|
||||
});
|
||||
for (const lang of ["en", "zh", "zh-TW", "ja", "de"]) {
|
||||
for (const width of [1100, 390]) {
|
||||
await t.test(`${lang} ${width}`, async () => {
|
||||
const w = (s, v) => tr(lang, s, v);
|
||||
if (lang !== "en") for (const s of WORDS) assert.ok(I18N[lang][s], `${lang}: ${s}`);
|
||||
const ctx = await browser.newContext({ viewport: { width, height: 800 } });
|
||||
await ctx.addInitScript(() => { try { localStorage.setItem("magpie.libTab", "mcp"); } catch {} });
|
||||
const page = await ctx.newPage();
|
||||
page.setDefaultTimeout(5000);
|
||||
page.setDefaultNavigationTimeout(60000);
|
||||
page.on("pageerror", (e) => errors.push(e.message));
|
||||
await page.route("**/*", server(lang, []));
|
||||
await page.goto("http://magpie.test/");
|
||||
await page.locator('button[data-view="library"]').click();
|
||||
const status = (name) => page.locator(`#view-library .lib-health[data-server="${name}"]`);
|
||||
await page.waitForFunction(() => document.querySelectorAll("#view-library .lib-health").length === 2 && !document.querySelector("#view-library .lib-health.checking"));
|
||||
|
||||
const cd = status("chrome-devtools");
|
||||
assert.equal(await cd.textContent(), w(WORDS[0]));
|
||||
assert.ok((await cd.getAttribute("title")).startsWith(w(WORDS[1], { n: 33, opt: "--browserUrl" })), await cd.getAttribute("title"));
|
||||
assert.equal(await cd.evaluate((b) => b.classList.contains("err")), true);
|
||||
assert.equal(await status("memory").textContent(), w("{n} tools", { n: 9 }));
|
||||
assert.equal(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth), true, "no sideways scroll");
|
||||
await ctx.close();
|
||||
});
|
||||
}
|
||||
}
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package library
|
||||
|
||||
// A server that drives a Chrome it starts itself, Chrome DevTools' or
|
||||
// Playwright's, starts in magpie's container and lists its tools, and then
|
||||
// every one of them fails: "Could not find Google Chrome executable for
|
||||
// channel 'stable' at: /opt/google/chrome/chrome" (Passings_z on X). The
|
||||
// image ships no browser, which would add some 300 MB for every user of
|
||||
// it, so the check tells such a server as one with no browser to start
|
||||
// (Why "nobrowser"), and the page says what works there instead: Magpie
|
||||
// Browser, which drives the user's own Chrome through its extension, or
|
||||
// the server's own option for a Chrome it can reach (Detail).
|
||||
|
||||
import (
|
||||
"os"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
"github.com/yetone/magpie/internal/gateway"
|
||||
)
|
||||
|
||||
// browserNeed is a package that starts Chrome on its own: the option that
|
||||
// points it at a running one instead, and the options that each say where
|
||||
// its browser is, without dashes and in lower case, as yargs and
|
||||
// commander take them in either spelling.
|
||||
type browserNeed struct {
|
||||
remote string
|
||||
elsewhere map[string]bool
|
||||
}
|
||||
|
||||
var browserNeeds = map[string]browserNeed{
|
||||
// chrome-devtools-mcp's options: --browserUrl (-u), --wsEndpoint (-w),
|
||||
// --executablePath (-e), --channel, --autoConnect
|
||||
"chrome-devtools-mcp": {remote: "--browserUrl", elsewhere: map[string]bool{
|
||||
"browserurl": true, "u": true, "wsendpoint": true, "w": true, "executablepath": true, "e": true,
|
||||
"channel": true, "autoconnect": true}},
|
||||
// @playwright/mcp's: --cdp-endpoint, --executable-path, --browser
|
||||
// (its own Chromium, Firefox or WebKit), --extension
|
||||
"@playwright/mcp": {remote: "--cdp-endpoint", elsewhere: map[string]bool{
|
||||
"cdpendpoint": true, "executablepath": true, "browser": true, "extension": true}},
|
||||
}
|
||||
|
||||
// Where both look for Chrome on Linux, and whether magpie runs in a
|
||||
// container; vars for tests.
|
||||
var (
|
||||
linuxChrome = "/opt/google/chrome/chrome"
|
||||
runsInBox = gateway.InContainer
|
||||
browserGOOS = runtime.GOOS
|
||||
chromeExists = func(p string) bool { st, err := os.Stat(p); return err == nil && !st.IsDir() }
|
||||
)
|
||||
|
||||
// noBrowser is the option s's server takes for a Chrome it can reach, when
|
||||
// s runs one that starts Chrome itself, in a container with none, and
|
||||
// isn't pointed at a browser elsewhere; "" otherwise.
|
||||
func noBrowser(s *Server) string {
|
||||
if s.Remote() || browserGOOS != "linux" {
|
||||
return ""
|
||||
}
|
||||
need, rest, ok := browserPackage(s)
|
||||
if !ok {
|
||||
return ""
|
||||
}
|
||||
for _, a := range rest {
|
||||
if !strings.HasPrefix(a, "-") {
|
||||
continue
|
||||
}
|
||||
k, _, _ := strings.Cut(a, "=")
|
||||
if need.elsewhere[strings.ToLower(strings.ReplaceAll(k, "-", ""))] {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
if chromeExists(linuxChrome) || !runsInBox() {
|
||||
return ""
|
||||
}
|
||||
return need.remote
|
||||
}
|
||||
|
||||
// browserPackage is the package s runs by npx (or bunx, pnpx), when it is
|
||||
// one that starts Chrome, and the words after it.
|
||||
func browserPackage(s *Server) (browserNeed, []string, bool) {
|
||||
switch progName(s.Command) {
|
||||
case "npx", "bunx", "pnpx":
|
||||
default:
|
||||
return browserNeed{}, nil, false
|
||||
}
|
||||
for i := 0; i < len(s.Args); i++ {
|
||||
a := s.Args[i]
|
||||
if a == "-p" || a == "--package" {
|
||||
i++ // the package npx installs; the program is what follows
|
||||
continue
|
||||
}
|
||||
if strings.HasPrefix(a, "-") {
|
||||
continue
|
||||
}
|
||||
name := a
|
||||
if m := npmSpec.FindStringSubmatch(a); m != nil {
|
||||
name = m[1]
|
||||
}
|
||||
need, ok := browserNeeds[name]
|
||||
return need, s.Args[i+1:], ok
|
||||
}
|
||||
return browserNeed{}, nil, false
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package library
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// inBox has magpie run in a container, on Linux, with Chrome there or not.
|
||||
func inBox(t *testing.T, box, chrome bool) {
|
||||
t.Helper()
|
||||
wb, wg, wc := runsInBox, browserGOOS, chromeExists
|
||||
runsInBox = func() bool { return box }
|
||||
browserGOOS = "linux"
|
||||
chromeExists = func(string) bool { return chrome }
|
||||
t.Cleanup(func() { runsInBox, browserGOOS, chromeExists = wb, wg, wc })
|
||||
}
|
||||
|
||||
// Passings_z on X: Chrome DevTools' server in magpie's image listed its
|
||||
// tools, and each failed with "Could not find Google Chrome executable".
|
||||
func TestNoBrowser(t *testing.T) {
|
||||
npx := func(args ...string) *Server { return &Server{Transport: "stdio", Command: "npx", Args: args} }
|
||||
for _, c := range []struct {
|
||||
name string
|
||||
s *Server
|
||||
want string
|
||||
}{
|
||||
{"chrome-devtools, the Library's", npx("-y", "chrome-devtools-mcp@latest"), "--browserUrl"},
|
||||
{"chrome-devtools by path", &Server{Transport: "stdio", Command: "/usr/local/bin/npx", Args: []string{"chrome-devtools-mcp"}}, "--browserUrl"},
|
||||
{"playwright", npx("@playwright/mcp@latest"), "--cdp-endpoint"},
|
||||
{"playwright headless", npx("-y", "@playwright/mcp", "--headless"), "--cdp-endpoint"},
|
||||
{"bunx", &Server{Transport: "stdio", Command: "bunx", Args: []string{"chrome-devtools-mcp@latest"}}, "--browserUrl"},
|
||||
{"at a running Chrome", npx("-y", "chrome-devtools-mcp@latest", "--browserUrl=http://host.docker.internal:9222"), ""},
|
||||
{"at a running Chrome, split", npx("chrome-devtools-mcp", "--browser-url", "http://h:9222"), ""},
|
||||
{"short option", npx("chrome-devtools-mcp", "-u", "http://h:9222"), ""},
|
||||
{"its own executable", npx("chrome-devtools-mcp", "--executablePath", "/usr/bin/chromium"), ""},
|
||||
{"playwright at a CDP endpoint", npx("@playwright/mcp", "--cdp-endpoint", "ws://h:9222"), ""},
|
||||
{"playwright's own Firefox", npx("@playwright/mcp", "--browser=firefox"), ""},
|
||||
{"another package", npx("-y", "@modelcontextprotocol/server-memory"), ""},
|
||||
{"a package named after it", npx("-y", "chrome-devtools-mcp-helper"), ""},
|
||||
{"not npx", &Server{Transport: "stdio", Command: "node", Args: []string{"chrome-devtools-mcp"}}, ""},
|
||||
{"remote", &Server{Transport: "http", URL: "http://h/mcp", Command: "npx", Args: []string{"chrome-devtools-mcp"}}, ""},
|
||||
} {
|
||||
t.Run(c.name, func(t *testing.T) {
|
||||
inBox(t, true, false)
|
||||
if got := noBrowser(c.s); got != c.want {
|
||||
t.Fatalf("noBrowser = %q, want %q", got, c.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
s := npx("-y", "chrome-devtools-mcp@latest")
|
||||
t.Run("not in a container", func(t *testing.T) {
|
||||
inBox(t, false, false)
|
||||
if got := noBrowser(s); got != "" {
|
||||
t.Fatalf("noBrowser = %q on a desktop", got)
|
||||
}
|
||||
})
|
||||
t.Run("an image with Chrome", func(t *testing.T) {
|
||||
inBox(t, true, true)
|
||||
if got := noBrowser(s); got != "" {
|
||||
t.Fatalf("noBrowser = %q with Chrome there", got)
|
||||
}
|
||||
})
|
||||
t.Run("not Linux", func(t *testing.T) {
|
||||
inBox(t, true, false)
|
||||
browserGOOS = "darwin"
|
||||
if got := noBrowser(s); got != "" {
|
||||
t.Fatalf("noBrowser = %q on macOS", got)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// The check says so: the server answers, with its tools, and the row says
|
||||
// it has no Chrome to start, with its option for one it can reach.
|
||||
func TestCheckSaysNoBrowser(t *testing.T) {
|
||||
s := fakeStdio(t, "ok", nil)
|
||||
// the fake server, as npx running Chrome DevTools' package; the
|
||||
// leading -test.run keeps npxDirect from installing it
|
||||
name := "npx"
|
||||
if runtime.GOOS == "windows" {
|
||||
name += ".exe"
|
||||
}
|
||||
b, err := os.ReadFile(s.Command)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
s.Command = filepath.Join(t.TempDir(), name)
|
||||
if err := os.WriteFile(s.Command, b, 0o755); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
s.Args = append(s.Args, "chrome-devtools-mcp@latest")
|
||||
|
||||
inBox(t, true, false)
|
||||
h := CheckServer(context.Background(), s)
|
||||
if h.State != "error" || h.Why != "nobrowser" || h.Detail != "--browserUrl" || h.Tools != 3 {
|
||||
t.Fatalf("got %+v, want nobrowser with --browserUrl and its 3 tools", h)
|
||||
}
|
||||
if err := healthErr(h); err == nil || err.Error() != "it starts a Chrome, and there is none where magpie runs: use Magpie Browser, or give it --browserUrl for a Chrome it can reach" {
|
||||
t.Errorf("healthErr = %v", err)
|
||||
}
|
||||
|
||||
inBox(t, false, false)
|
||||
if h := CheckServer(context.Background(), s); h.State != "ok" || h.Tools != 3 {
|
||||
t.Fatalf("on a desktop: got %+v, want ok", h)
|
||||
}
|
||||
}
|
||||
@@ -49,7 +49,9 @@ type ServerHealth struct {
|
||||
// protocol, home (exits in home, works in a project: Project),
|
||||
// novar (a ${NAME} magpie's environment hasn't: Detail names
|
||||
// them), wsldown (a command only agents in WSL start, whose distros,
|
||||
// Detail, aren't running: it wasn't checked)
|
||||
// Detail, aren't running: it wasn't checked), nobrowser (it listed its
|
||||
// Tools, and starts a Chrome the container it runs in hasn't: Detail
|
||||
// is its option for one it can reach, mcp_browser.go)
|
||||
Why string `json:"why,omitempty"`
|
||||
Code int `json:"code,omitempty"` // the exit code, or the HTTP status
|
||||
Detail string `json:"detail,omitempty"` // the last line it wrote to stderr, or the error's text
|
||||
@@ -248,6 +250,12 @@ func checkServer(ctx context.Context, s *Server, own ownSignIns) ServerHealth {
|
||||
default:
|
||||
h = checkHTTP(ctx, s)
|
||||
}
|
||||
if h.State == "ok" && s.Transport == "stdio" {
|
||||
// it lists its tools, and every one fails for want of a Chrome
|
||||
if opt := noBrowser(s); opt != "" {
|
||||
h.State, h.Why, h.Detail = "error", "nobrowser", opt
|
||||
}
|
||||
}
|
||||
h.At = time.Now().UnixMilli()
|
||||
if s.Transport == "http" {
|
||||
// only a server magpie is signed in to has one to report
|
||||
|
||||
@@ -721,6 +721,8 @@ func healthErr(h ServerHealth) error {
|
||||
s = "it answered " + h.Detail
|
||||
case h.Why == "refused" || h.Why == "unreachable":
|
||||
s = "it couldn't be reached: " + h.Detail
|
||||
case h.Why == "nobrowser":
|
||||
s = "it starts a Chrome, and there is none where magpie runs: use Magpie Browser, or give it " + h.Detail + " for a Chrome it can reach"
|
||||
case h.Why == "novar":
|
||||
s = h.Detail + " isn't set where magpie runs"
|
||||
default:
|
||||
|
||||
@@ -29,7 +29,7 @@ e8f03915aaf12c386bd6254ccfacbe6dc7ae1544e0080bde67ce31b048a50ee0 docs/copilot.h
|
||||
c2795244d9df800736d5be9042a45bca9358800b27521723e9a4f0604e7a8c43 docs/crush.html
|
||||
d042047b8d4e480702a6986c52135154ded05388ff82e63f215d652ea55f0c6e docs/cursor-private-inference.html
|
||||
cf2645267d38d072f0467a02f6888b3a8848b27c3b14fa2461cda904ab07b793 docs/deepseek.html
|
||||
492510e69af0f4fadf4f4b27e50ff1d60b126837dcc501d061e1182f7bd0e9fb docs/docker.html
|
||||
592efa01b2064ec67e8b25b3a0ea93155498e6d0de494a6d33f961cf0a86851e docs/docker.html
|
||||
0df2e589a2a8d2f0a91344d79ba15eff4a63dbd4d26e9a24601fec9c61a1d90e docs/droid.html
|
||||
9f1fae865cb49fe2279ef8230b0abb7c4056509827840ccd2b055f814b0bfd3b docs/ds-bot.html
|
||||
1e11349a9456e75797816776f8f420de351683df7d2aaf09c18688aaf5d781b5 docs/empryo.html
|
||||
@@ -80,7 +80,7 @@ f3b062404993ee53684e2282e28c21af93f13003e7d09a13e0a06efcf36d1634 docs/ja/craft-
|
||||
07f679f11a97fa7e75130c5defef055b1abc142dbd15510b6ae9b67845817944 docs/ja/crush.html
|
||||
478cf1f70d9a9d9730931c785aee1f72e38bc27b62b3c429fed5ef6e97b8b406 docs/ja/cursor-private-inference.html
|
||||
1dce97081a8170168bc329f4f6c5cf555a207a8a90d375cb19de4c7ec9aba488 docs/ja/deepseek.html
|
||||
6966fb6a9e357b422b65d772ab2438e4c9c48b0e838bf7d480ac99a831078b45 docs/ja/docker.html
|
||||
23e29639adc543621b4b265b66e8effe63760389ed6b3badb11addf6cba00bb7 docs/ja/docker.html
|
||||
e1b20bd4d38845588252a3b083f13517309bea5fbc4c1961f1a9a0291a870a44 docs/ja/droid.html
|
||||
a8e739bb4e75c7568fb7fbf3da1c3e565f9c7f4f285bfad32a025d89f693ddda docs/ja/ds-bot.html
|
||||
aa1c027a828a9f7cae0297aeb86e8d91759bf2cacb10875e56c1fe49f162a40c docs/ja/empryo.html
|
||||
@@ -279,7 +279,7 @@ abf1ef4b505f95b1b1cb32c79ae311f236c8c67c3474e00fe779359a650238d4 docs/zh/copilo
|
||||
a5b7151d7c21e4bb3f601c0c399d0e5a8de051ec7e342c552fd3883f589b66f4 docs/zh/crush.html
|
||||
939171a143b339969019c6fa2cba7f983cb83220b21e08fcb2e49f958fcb7fd3 docs/zh/cursor-private-inference.html
|
||||
69752603509b92a8c0dcda461b71b1e02e669de2f790f6e1ad50922090971dd2 docs/zh/deepseek.html
|
||||
7f193a17723b04b8a4f381d198f4229b3d80bc3e34edacb5f8b235a400dd8fda docs/zh/docker.html
|
||||
b5c7bf5445ee1720a7811fcbe4a6031ee428dc667790194b3f32b1c1a1d6f8bd docs/zh/docker.html
|
||||
d282d59587baab9e6cdd4c1d36b69b9ceea9e2cd0b49d1537642fd529c7816a8 docs/zh/droid.html
|
||||
e8bc868847eede8bcdf157f13e2508f91c790baee914cb3c8f2b1801bf2c5fc1 docs/zh/ds-bot.html
|
||||
2665b5de3bc00d5a7f34ed318dcecc76cd136479ecd239f2623f76134f826850 docs/zh/empryo.html
|
||||
|
||||
@@ -135,6 +135,7 @@
|
||||
<a href="#run">Run it</a>
|
||||
<a href="#web">The browser UI</a>
|
||||
<a href="#signin">Sign in to subscriptions</a>
|
||||
<a href="#mcp">MCP servers</a>
|
||||
<a href="#browser">Your own browser</a>
|
||||
<a href="#volume">What is kept</a>
|
||||
<a href="#env">Environment</a>
|
||||
@@ -206,6 +207,10 @@ docker logs magpie</pre>
|
||||
</div>
|
||||
<p>A Grok (SuperGrok) subscription signs in through xAI’s Grok Build CLI, which the image doesn’t have either. Its sign-in, in the browser UI or with <code>magpie plugin login grok</code>, installs it first, as xAI’s installer does: the stable version from <code>x.ai/cli</code>, kept in <code>/config/home/.grok</code>. To use a Grok Build binary you put on the volume yourself, set <code>GROK_BIN_DIR</code> to the folder holding it.</p>
|
||||
|
||||
<h2 id="mcp"><a class="anchor" href="#mcp">MCP servers</a></h2>
|
||||
<p>The Library’s MCP servers run in the container, and the image has what they start with: <code>npx</code>, <code>node</code> and <code>npm</code> (Node 24), and <code>uvx</code>, <code>uv</code>, <code>python</code> and <code>python3</code>. A server started with <code>uvx</code> or <code>python</code> downloads its Python into the volume the first time, which takes a few seconds. A server started with <code>docker</code> doesn’t run: the container has no Docker of its own.</p>
|
||||
<p>The image has no browser. Chrome DevTools’ and Playwright’s MCP servers start a Chrome of their own, so in the container their row in the Library says <span class="ui">no Chrome here</span>. Use <a href="#browser">Magpie Browser</a> instead, which acts in your own browser, or point the server at a Chrome it can reach: <code>--browserUrl http://host:9222</code> for Chrome DevTools, <code>--cdp-endpoint</code> for Playwright.</p>
|
||||
|
||||
<h2 id="browser"><a class="anchor" href="#browser">Your own browser</a></h2>
|
||||
<p>Magpie Browser lets agents act in your own browser, through its extension. The extension can’t be loaded from the container’s folders, so in the browser UI open <span class="ui">Library</span> → <span class="ui">Magpie Browser</span> and click <span class="ui">Download the extension</span>. The zip is pointed at the page’s own address, with a gateway key named <b>Magpie Browser</b> of its own. Unzip it, open <code>chrome://extensions</code>, turn on Developer mode and click <span class="ui">Load unpacked</span> on the unzipped folder. An extension already loaded takes the address (<code>http://localhost:3430</code>, or the gateway’s published port) and a gateway key in its popup.</p>
|
||||
<p>The Magpie Browser key connects the extension and nothing else: it can’t use models, MCP servers or stats, so a copy of the zip left in Downloads spends nothing. The host’s browser reaches the container from Docker’s bridge, not from the container’s own computer, so it is that key’s alone and the container’s agents don’t use it yet (<a href="https://github.com/yetone/magpie/issues/5529">#5529</a>). To use it from an agent on the host, give that agent a gateway key of its own with full access, connect the extension with the same key in its popup, and call <code>/mcp/magpie/browser</code> with it. A browser given another key is that key’s alone, and it is let go once its key is turned off, removed or rotated.</p>
|
||||
|
||||
@@ -135,6 +135,7 @@
|
||||
<a href="#run">起動する</a>
|
||||
<a href="#web">ブラウザ UI</a>
|
||||
<a href="#signin">サブスクリプションにサインイン</a>
|
||||
<a href="#mcp">MCP サーバー</a>
|
||||
<a href="#browser">自分のブラウザ</a>
|
||||
<a href="#volume">保存されるもの</a>
|
||||
<a href="#env">環境変数</a>
|
||||
@@ -206,6 +207,10 @@ docker logs magpie</pre>
|
||||
</div>
|
||||
<p>Grok(SuperGrok)サブスクリプションは xAI の Grok Build CLI でサインインしますが、これもイメージにはありません。ブラウザ UI や <code>magpie plugin login grok</code> でサインインすると、magpie が xAI のインストーラーと同じ方法で先にインストールします。<code>x.ai/cli</code> の stable 版を <code>/config/home/.grok</code> に置きます。自分でボリュームに置いた Grok Build を使うときは、<code>GROK_BIN_DIR</code> にそのフォルダを指定します。</p>
|
||||
|
||||
<h2 id="mcp"><a class="anchor" href="#mcp">MCP サーバー</a></h2>
|
||||
<p>ライブラリの MCP サーバーはコンテナの中で動き、イメージには起動に使うコマンドが入っています:<code>npx</code>、<code>node</code>、<code>npm</code>(Node 24)と、<code>uvx</code>、<code>uv</code>、<code>python</code>、<code>python3</code>。<code>uvx</code> や <code>python</code> で起動するサーバーは、初回に Python をボリュームへダウンロードするので数秒かかります。<code>docker</code> で起動するサーバーは動きません:コンテナには自前の Docker がありません。</p>
|
||||
<p>イメージにはブラウザがありません。Chrome DevTools と Playwright の MCP サーバーは自分で Chrome を起動するため、コンテナではライブラリの行に <span class="ui">ここに Chrome がありません</span> と出ます。代わりに、あなた自身のブラウザで操作する <a href="#browser">Magpie Browser</a> を使うか、サーバーが届く Chrome を指定してください:Chrome DevTools は <code>--browserUrl http://host:9222</code>、Playwright は <code>--cdp-endpoint</code>。</p>
|
||||
|
||||
<h2 id="browser"><a class="anchor" href="#browser">自分のブラウザ</a></h2>
|
||||
<p>Magpie Browser は拡張機能を通して、エージェントにあなた自身のブラウザを操作させます。コンテナ内のフォルダは拡張機能として読み込めないので、ブラウザ UI で <span class="ui">ライブラリ</span> → <span class="ui">Magpie Browser</span> を開き、<span class="ui">拡張機能をダウンロード</span> をクリックします。zip はこのページ自身のアドレスを指し、<b>Magpie Browser</b> という名前の専用ゲートウェイキーが入っています。展開して <code>chrome://extensions</code> を開き、デベロッパー モードをオンにして、展開したフォルダを <span class="ui">パッケージ化されていない拡張機能を読み込む</span> で選びます。読み込み済みの拡張機能は、ポップアップでアドレス(<code>http://localhost:3430</code> か、ゲートウェイを公開したポート)とゲートウェイキーを受け付けます。</p>
|
||||
<p>Magpie Browser キーは拡張機能の接続専用で、モデル、MCP サーバー、統計は使えません。ダウンロードフォルダに残った zip のコピーで利用枠が使われることはありません。ホストのブラウザは Docker のブリッジ経由でコンテナにつながり、コンテナと同じコンピュータからの接続ではないため、そのキーだけのものになり、コンテナ内のエージェントはまだ使えません(<a href="https://github.com/yetone/magpie/issues/5529">#5529</a>)。ホストのエージェントから使うには、そのエージェントにフルアクセスのゲートウェイキーを渡し、拡張機能のポップアップで同じキーを入れて接続し、そのキーで <code>/mcp/magpie/browser</code> を呼びます。別のキーで接続したブラウザはそのキーだけのもので、キーを無効化、削除、ローテーションすると接続は切れます。</p>
|
||||
|
||||
@@ -135,6 +135,7 @@
|
||||
<a href="#run">运行</a>
|
||||
<a href="#web">Web 界面</a>
|
||||
<a href="#signin">登录订阅</a>
|
||||
<a href="#mcp">MCP 服务器</a>
|
||||
<a href="#browser">你自己的浏览器</a>
|
||||
<a href="#volume">保存了什么</a>
|
||||
<a href="#env">环境变量</a>
|
||||
@@ -206,6 +207,10 @@ docker logs magpie</pre>
|
||||
</div>
|
||||
<p>Grok(SuperGrok)订阅通过 xAI 的 Grok Build CLI 登录,镜像里同样没有它。在浏览器界面里登录,或者用 <code>magpie plugin login grok</code> 登录时,magpie 会先按 xAI 安装脚本的方式安装它:从 <code>x.ai/cli</code> 下载 stable 版本,放在 <code>/config/home/.grok</code>。要用你自己放进数据卷的 Grok Build,把 <code>GROK_BIN_DIR</code> 设为它所在的文件夹。</p>
|
||||
|
||||
<h2 id="mcp"><a class="anchor" href="#mcp">MCP 服务器</a></h2>
|
||||
<p>资源库里的 MCP 服务器在容器里运行,镜像里带着它们启动要用的命令:<code>npx</code>、<code>node</code> 和 <code>npm</code>(Node 24),以及 <code>uvx</code>、<code>uv</code>、<code>python</code> 和 <code>python3</code>。用 <code>uvx</code> 或 <code>python</code> 启动的服务器第一次会把 Python 下载到数据卷里,要几秒钟。用 <code>docker</code> 启动的服务器跑不起来:容器里没有它自己的 Docker。</p>
|
||||
<p>镜像里没有浏览器。Chrome DevTools 和 Playwright 的 MCP 服务器要启动自己的 Chrome,所以在容器里,它们在资源库里的那一行会显示 <span class="ui">这里没有 Chrome</span>。请改用 <a href="#browser">Magpie Browser</a>,它在你自己的浏览器里操作;或者让服务器连接一个它能访问到的 Chrome:Chrome DevTools 用 <code>--browserUrl http://host:9222</code>,Playwright 用 <code>--cdp-endpoint</code>。</p>
|
||||
|
||||
<h2 id="browser"><a class="anchor" href="#browser">你自己的浏览器</a></h2>
|
||||
<p>Magpie Browser 通过它的扩展,让 Agent 在你自己的浏览器里操作。容器里的文件夹没法直接加载成扩展,所以在浏览器界面打开 <span class="ui">资源库</span> → <span class="ui">Magpie Browser</span>,点 <span class="ui">下载扩展</span>。下载的 zip 指向这个页面自己的地址,并带一个名为 <b>Magpie Browser</b> 的专用网关密钥。解压后打开 <code>chrome://extensions</code>,打开开发者模式,点 <span class="ui">加载已解压的扩展程序</span>,选择解压出的文件夹。已经加载过的扩展,也可以在它的弹窗里填地址(<code>http://localhost:3430</code>,或网关发布到主机的端口)和网关密钥。</p>
|
||||
<p>Magpie Browser 密钥只用来连接扩展,不能使用模型、MCP 服务器或统计,所以留在下载文件夹里的 zip 副本花不了你的额度。主机上的浏览器经 Docker 的网桥连到容器,不算容器所在电脑本机的连接,所以它只属于这个密钥,容器里的 Agent 暂时用不到它(<a href="https://github.com/yetone/magpie/issues/5529">#5529</a>)。要让主机上的 Agent 用它:给这个 Agent 一个完整权限的网关密钥,在扩展弹窗里填同一个密钥连上,再用它调用 <code>/mcp/magpie/browser</code>。填了别的密钥连上的浏览器只属于那个密钥;密钥被停用、删除或轮换后,连接随即断开。</p>
|
||||
|
||||
@@ -10813,6 +10813,12 @@ docker exec -it magpie magpie claude-code install
|
||||
|
||||
A Grok (SuperGrok) subscription signs in through xAI’s Grok Build CLI, which the image doesn’t have either. Its sign-in, in the browser UI or with `magpie plugin login grok`, installs it first, as xAI’s installer does: the stable version from `x.ai/cli`, kept in `/config/home/.grok`. To use a Grok Build binary you put on the volume yourself, set `GROK_BIN_DIR` to the folder holding it.
|
||||
|
||||
## MCP servers
|
||||
|
||||
The Library’s MCP servers run in the container, and the image has what they start with: `npx`, `node` and `npm` (Node 24), and `uvx`, `uv`, `python` and `python3`. A server started with `uvx` or `python` downloads its Python into the volume the first time, which takes a few seconds. A server started with `docker` doesn’t run: the container has no Docker of its own.
|
||||
|
||||
The image has no browser. Chrome DevTools’ and Playwright’s MCP servers start a Chrome of their own, so in the container their row in the Library says no Chrome here. Use Magpie Browser instead, which acts in your own browser, or point the server at a Chrome it can reach: `--browserUrl http://host:9222` for Chrome DevTools, `--cdp-endpoint` for Playwright.
|
||||
|
||||
## Your own browser
|
||||
|
||||
Magpie Browser lets agents act in your own browser, through its extension. The extension can’t be loaded from the container’s folders, so in the browser UI open Library → Magpie Browser and click Download the extension. The zip is pointed at the page’s own address, with a gateway key named **Magpie Browser** of its own. Unzip it, open `chrome://extensions`, turn on Developer mode and click Load unpacked on the unzipped folder. An extension already loaded takes the address (`http://localhost:3430`, or the gateway’s published port) and a gateway key in its popup.
|
||||
|
||||
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
Reference in New Issue
Block a user