Files
plugins/packages/mclaw/README.md
T
Joey Shao d51e9e3cad mclaw 0.5.3: fail at authorize when there is no browser or display (#898)
mclaw's authorize now runs a preflight before it returns opened:true. When
no Chromium browser can be found, or Linux has neither DISPLAY nor
WAYLAND_DISPLAY, it returns {type:'failed'} at once instead of claiming a
window opened and failing later in callback (source issue
joey-41/opencode-mclaw-auth#1, the same shape as inkstone #825).
requireBrowser() is now the only place that looks up the browser, and
holds its one error message. It now looks for Edge, Chromium and Brave on
macOS, Edge on Windows, and microsoft-edge and /opt/google/chrome on Linux.
MCLAW_CHROME_PATH is checked first (X_OK, or F_OK on Windows) and a bad
path gets its own error. Headless renewal still goes through requireBrowser
only, with no display check. The cancel test now uses two independent
AbortControllers (#746 follow-up). README and CHANGELOG updated, 0.5.3.

Reviewed head 40784afa76c89285cb039460f55cc0f9fb059e21, on main 89fcfb2e.
Read every line of the diff: it adds no network endpoint, credential read,
install script or obfuscated code.

Run at that head, on mote (macOS), HOME a scratch dir:
- packages/mclaw `bun test`: 41 pass, 0 fail.
- repo `bun test` (HOME=$(mktemp -d), as CI): 7604 pass, 0 fail.
  `bun scripts/check.mjs`: exit 0. (The package has no node:test files;
  every test is bun:test.)
- Broken by hand, each red and restored:
  - no preflight call in authorize: both login preflight tests red;
  - no DISPLAY check: the browser-path and login no-display tests red;
  - MCLAW_CHROME_PATH not validated: the bad-override test red;
  - candidates not access()-checked: the real-executable test red.
- Real env, no seams, in WSL (magpie-desktop): DISPLAY/WAYLAND_DISPLAY
  unset → authorize returns failed with the no-display message, no
  opened. DISPLAY set + MCLAW_CHROME_PATH=/no/such → failed with the
  override message. DISPLAY set, no browser installed → requireBrowser
  throws the no-browser message.
- Candidate tables against real machines: mote finds
  ~/Applications/Google Chrome.app; xiaomi-gpu (Windows 11) finds
  C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe.
- PR CI (ubuntu, headless) test job green.

Not blocking, left for a later version: on Windows, Edge (installed on
every machine) now comes before a LOCALAPPDATA Chromium, so a renewal of
a profile Chromium made would open in Edge. Linux's table has no Brave,
though the README names it.

Not tried: a real MClaw sign-in (no account), or a headed sign-in through
Edge or Brave.
2026-11-09 17:58:05 +08:00

5.6 KiB
Raw Blame History

MClaw(中国移动云)

把中国移动云 MClaw(移动云盘 App 内的智能体,ai.yun.139.com)作为一个 OpenAI 兼容供应商接进 magpie 与 OpenCode:一次浏览器登录同时拿到 chat(llm 开放接口)、模型(账号实际可用清单与积分倍率)与用量(aitokens 池)。装好后所有 agent(Claude Code、Codex、openclaw 等)都能通过 magpie 用 mclaw/<model> 访问 MClaw 的模型,并享受 magpie 的用量统计与故障切换。

非官方插件,风险自负。本包与中国移动或 magpie 官方无隶属关系。接口协议 2026-11-04 从移动云盘 App 13.2.5 抓包逆向,平台未公开,随时可能变化或失效;本插件不绕过验证码、限流或任何平台限制。登录凭证只存 magpie 的 plugin-auth.json(600),插件目录不落任何凭证。

安装

magpie plugin add @magpie-community/opencode-mclaw-auth
magpie plugin login mclaw

(从源码跑:git clone https://github.com/joey-41/opencode-mclaw-auth.git MClaw && magpie plugin add ./MClaw)

登录

登录前提:浏览器登录由插件自己启动一个有界面的 Chromium 内核浏览器窗口(CDP --remote-debugging-pipe 驱动,收登录态),所以要求:

  • 本机安装了 Google Chrome / Microsoft Edge / Chromium / Brave 之一(macOS 上 Safari 不行:它不支持插件用的独立 --user-data-dir profile,也没有 CDP);
  • magpie 运行在有图形界面的本地会话里。远程服务器、SSH、容器、纯 headless 环境弹不出窗口——Linux 上未设置 DISPLAY / WAYLAND_DISPLAY 时插件会在选登录方式时直接报明原因。

浏览器装在非标准位置(或上述自动探测没找到)时,用 MCLAW_CHROME_PATH 指到可执行文件,例如 macOS:

MCLAW_CHROME_PATH="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" magpie plugin login mclaw

MCLAW_CHROME_PATH 会先校验存在/可执行,路径写错会明确报「指向的浏览器不存在或不可执行」,不会混成「找不到 Chrome」。没有可用的浏览器或没有图形界面时,无法完成浏览器登录,本插件目前只有这一种登录方式。


浏览器登录,一次登录凭证全自动,没有任何要填的输入:选「浏览器登录」→ 插件弹出一个专用浏览器窗口(每次登录一个全新 profile,不影响日常浏览器)→ 在窗口里登录移动云 yun.139.com(网页支持验证码、密码、扫码等多种方式,任选)→ 插件自动收走 authorization Cookie(= pc: 票,30 天期),其余全自动:llm chat key(na-…)与模型倍率表自动取回,openclawId 与账号实际模型清单自动发现,vip 会话由换票链自动维持(toSourceId 001005,与 App vip 会员中心同渠道;进程内复用,24h 期,失败 30 分钟冷却),用量窗口(含「重置于」与逐条明细)自动接上;账号显示名 = 掩码手机号(票里解出)。票到期前 3 天自动续期:headless 复开该账号自己的 profile(目录存在账号 metadata 里,多账号互不串票,续期时会校验收割到的票属于本账号),网页会话自己刷新后重新收割,票换了顺手刷新 key。取消登录、登录失败或超时都会立即关掉 Chrome 并清掉当次的 profile 目录。已知限制:重新登录同一账号会生成一个新 profile,旧目录会留在 mclaw-browser-profiles/ 下(内含不再被任何账号引用的历史登录态,可手动删除)。

模型

登录后模型目录与倍率自动发现(agent/list + config/get),无需硬编码 ID;下表是未登录时的静态目录。

模型 ID(mclaw/…) 名称 倍率 备注
blian_qwen38_flash Qwen3.8-Flash 0.18 推理;并行工具调用实测 8/8
blian_qwen38_max Qwen3.8-Max 1.5 推理
huoshan_glm_5_3 GLM-5.3 3.5 推理
blian_qwen37_plus Qwen3.7-Plus 1.5 推理
blian_qwen36_plus Qwen3.6-Plus 1.0
blian_qwen35_plus Qwen3.5-Plus 0.6 多模态
blian_deepseek_v4_pro DeepSeek-V4-Pro 2.5 推理
vlm_huoshan_2_0_lite_thinking_vision Seed-2.0-Lite 1.0 推理+视觉
vlm_huoshan_2_0_mini_thinking_vision Seed-2.0-Mini 0.3 推理+视觉
huoshan_deepseek_v4_1_flash DeepSeek-V4.1-Flash 未知 计费表未列出

rate 是 App 的 tokenRatio 计费倍率(如 flash 0.18×),不是美元价格。上下文/输出上限 App 未暴露,插件按 200k/32k 声明,仅作调度参考,以上游实际判定为准。

用量

aitokens 池窗口:总量、已用、剩余与「重置于」。重置于来自消耗明细里的权威 endTime(当前周期终点);vip 会话由插件自动维持(SSO 换票链,toSourceId 001005),没有可用会话时不显示重置时间——上游不给周期起止,插件不用别的账号的周期猜。上游报「无效的ApiKey」时插件转成明确的登录失效(401),重新登录即可。

Options

magpie plugin options mclaw '{"base": "https://ai.yun.139.com/api/llm/102001"}'

环境变量(浏览器登录相关):MCLAW_CHROME_PATH(Chrome / Edge / Chromium / Brave 可执行文件路径,默认按平台探测;设置后会校验存在/可执行)、MCLAW_BROWSER_PROFILE(登录 profile 目录的根,每个账号用其下的独立子目录,默认 ~/.config/magpie/mclaw-browser-profiles/)。登录前提见上文「登录」。

许可证

MIT