Version / 版本号
v 3.0.47 (3.0.47.76)
Platform / 平台
macOS
OS version / 系统版本
Monterey
Issue area / 问题类型
MCP / OAuth / integration
Upload ID / 日志上传 ID
415143477977153
What happened? / 问题描述
Summary
Every mavis * CLI command (e.g. mavis mcp ls, mavis memory append, mavis mcp call) fails immediately with a Node.js SyntaxError on line 2 of the shipped CLI entry point. The CLI file cli.js is an ES module being loaded via Node's CommonJS loader.
Environment
- App: MiniMax Code (
/Applications/MiniMax Code.app) Version 3.0.47 (3.0.47.76)
- Platform: macOS (MOnterey / Sonoma / any recent; version-independent — reproduces on any host Node version because the bug is in the file itself, not the runtime)
- App entry:
/Applications/MiniMax Code.app/Contents/Resources/resources/daemon/cli.js
- App package:
…/daemon/package.json → {"type":"module","version":"3.0.47"} ✓ ("type": "module" is already declared)
- System Node:
v9.6.1 (/usr/local/bin/node) — but the app presumably uses a bundled Node; reproduces regardless
Root cause
cli.js is an ES module — line 2 uses top-level import. The packaging metadata correctly marks it as such (the file's own package.json has "type": "module"). However the launcher script that invokes it is using require() / Module._load (visible in the stack trace: module._compile, module._extensions..js) — i.e. the CommonJS loader.
This is a packaging bug. The CLI cannot load until the launcher is changed to use ESM-aware loading.
Suggested fix (for the maintainer)
Any of these will resolve it:
-
Rename the entry so Node picks the right loader by extension:
mv resources/daemon/cli.js resources/daemon/cli.mjs
and update the launcher shim to require cli.mjs. (MJS files skip the CJS loader entirely even without "type": "module" in package.json.)
-
Use a CJS wrapper that imports the ESM file via dynamic import:
// resources/daemon/cli.cjs
(async () => {
const cli = await import('./cli.js');
cli.main(process.argv.slice(2));
})();
and have the launcher invoke cli.cjs.
-
Fix the launcher to do await import('./daemon/cli.js') instead of require('./daemon/cli.js').
Option 1 is the smallest, most surgical patch.
Impact
- Any user trying to manage MCP servers via CLI (
mavis mcp ls/call/tools list), manage memory (mavis memory append), or any other mavis * subcommand is fully blocked.
- MCP server functionality is not affected — the daemon process (
MiniMax Code.app/Contents/MacOS/MiniMax Code) loads its own modules correctly (it's loaded by Electron under ESM-aware paths) and serves MCP configs via the daemon transport. Only the standalone CLI wrapper is broken.
- Workaround until patched: drive the daemon via its HTTP transport directly (e.g.
curl http://127.0.0.1:15321/mavis/...), or edit ~/.mavis/mcp/mcp.json by hand.
Reporter
Local macOS user, MiniMax Code build that ships cli.js as the daemon CLI entry. No data loss; just unusable CLI.
Steps to reproduce / 复现步骤
mavis mcp ls
# OR
mavis memory append --help
Expected behavior / 预期行为
CLI runs, lists MCP servers, prints help, etc.
Actual behavior / 实际行为
/Applications/MiniMax Code.app/Contents/Resources/resources/daemon/cli.js:2
import { createRequire as __mavis_cR } from "module"; const require = __mavis_cR(import.meta.url);
^^^^^^
SyntaxError: Unexpected token import
at new Script (vm.js:51:7)
at createScript (vm.js:138:10)
at Object.runInThisContext (vm.js:199:10)
at Module._compile (module.js:626:28)
at Object.Module._extensions..js (module.js:673:10)
at Module.load (module.js:575:32)
at tryModuleLoad (module.js:515:12)
at Function.Module._load (module.js:507:3)
at Function.Module.runMain (module.js:703:10)
at startup (bootstrap.js:193:16)
Logs or crash report / 日志或崩溃信息
General → Upload logs and include the generated upload ID" — but our crash is pre-execution so the log upload may have nothing;
Screenshots / 截图
No response
Before submitting / 提交前确认
Version / 版本号
v 3.0.47 (3.0.47.76)
Platform / 平台
macOS
OS version / 系统版本
Monterey
Issue area / 问题类型
MCP / OAuth / integration
Upload ID / 日志上传 ID
415143477977153
What happened? / 问题描述
Summary
Every
mavis *CLI command (e.g.mavis mcp ls,mavis memory append,mavis mcp call) fails immediately with a Node.js SyntaxError on line 2 of the shipped CLI entry point. The CLI filecli.jsis an ES module being loaded via Node's CommonJS loader.Environment
/Applications/MiniMax Code.app) Version 3.0.47 (3.0.47.76)/Applications/MiniMax Code.app/Contents/Resources/resources/daemon/cli.js…/daemon/package.json→{"type":"module","version":"3.0.47"}✓ ("type": "module"is already declared)v9.6.1(/usr/local/bin/node) — but the app presumably uses a bundled Node; reproduces regardlessRoot cause
cli.jsis an ES module — line 2 uses top-levelimport. The packaging metadata correctly marks it as such (the file's ownpackage.jsonhas"type": "module"). However the launcher script that invokes it is usingrequire()/Module._load(visible in the stack trace:module._compile,module._extensions..js) — i.e. the CommonJS loader.This is a packaging bug. The CLI cannot load until the launcher is changed to use ESM-aware loading.
Suggested fix (for the maintainer)
Any of these will resolve it:
Rename the entry so Node picks the right loader by extension:
mv resources/daemon/cli.js resources/daemon/cli.mjsand update the launcher shim to require
cli.mjs. (MJS files skip the CJS loader entirely even without"type": "module"in package.json.)Use a CJS wrapper that imports the ESM file via dynamic import:
and have the launcher invoke
cli.cjs.Fix the launcher to do
await import('./daemon/cli.js')instead ofrequire('./daemon/cli.js').Option 1 is the smallest, most surgical patch.
Impact
mavis mcp ls/call/tools list), manage memory (mavis memory append), or any othermavis *subcommand is fully blocked.MiniMax Code.app/Contents/MacOS/MiniMax Code) loads its own modules correctly (it's loaded by Electron under ESM-aware paths) and serves MCP configs via the daemon transport. Only the standalone CLI wrapper is broken.curl http://127.0.0.1:15321/mavis/...), or edit~/.mavis/mcp/mcp.jsonby hand.Reporter
Local macOS user, MiniMax Code build that ships
cli.jsas the daemon CLI entry. No data loss; just unusable CLI.Steps to reproduce / 复现步骤
mavis mcp ls # OR mavis memory append --helpExpected behavior / 预期行为
CLI runs, lists MCP servers, prints help, etc.
Actual behavior / 实际行为
Logs or crash report / 日志或崩溃信息
General → Upload logs and include the generated upload ID" — but our crash is pre-execution so the log upload may have nothing;Screenshots / 截图
No response
Before submitting / 提交前确认