Expect MCP Server — Connection Failure Context
Summary
The expect MCP server is configured and approved in this repo, but it does not connect because the upstream expect-cli package crashes on launch under Node.js with an ERR_UNSUPPORTED_DIR_IMPORT error originating from ink → es-toolkit/compat.
Repository
- Path:
/home/user/untab
- Branch:
claude/test-expect-mcp-connection-HA1mw
Configuration (correct, no changes needed)
.mcp.json:
{
"mcpServers": {
"expect": {
"command": "npx",
"args": ["-y", "expect-cli@latest", "mcp"]
}
}
}
.claude/settings.json:
{
"enabledMcpjsonServers": ["expect"],
"enabledPlugins": {
"chrome-devtools-mcp@chrome-devtools-plugins": true
},
"extraKnownMarketplaces": {
"chrome-devtools-plugins": {
"source": {
"source": "git",
"url": "https://github.com/ChromeDevTools/chrome-devtools-mcp.git"
},
"autoUpdate": true
}
}
}
The server is declared and explicitly enabled. The Claude Code session lists no mcp__expect__* tools, confirming the server failed to start.
Reproduction
npx -y expect-cli@latest --version
Same failure with both:
- Node.js v22.22.2 (system)
- Node.js v24.15.0 (Vite+ runtime via
vp env print → /root/.vite-plus/js_runtime/node/24.15.0/bin)
Error
Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import
'/root/.npm/_npx/015c9764bdd64143/node_modules/es-toolkit/compat'
is not supported resolving ES modules imported from
/root/.npm/_npx/015c9764bdd64143/node_modules/ink/build/ink.js
Did you mean to import "es-toolkit/compat.js"?
at finalizeResolution (node:internal/modules/esm/resolve:259:11)
at moduleResolve (node:internal/modules/esm/resolve:861:10)
at defaultResolve (node:internal/modules/esm/resolve:988:11)
...
code: 'ERR_UNSUPPORTED_DIR_IMPORT',
url: 'file:///.../node_modules/es-toolkit/compat'
Root Cause Hypothesis
ink (transitive dependency of expect-cli) imports from 'es-toolkit/compat' — a bare directory specifier. Node's strict ESM resolver rejects this unless the target package's exports map declares the subpath, or the import points at a real file (es-toolkit/compat.js). The version of es-toolkit that gets hoisted in the npx resolution does not expose ./compat as a subpath, so resolution fails before any CLI code runs.
Upstream
Possible Fixes (any of)
- Pin
ink in expect-cli to a version whose es-toolkit import targets a file path (es-toolkit/compat.js), or one that uses a subpath supported by the es-toolkit exports map.
- Pin
es-toolkit (via expect-cli's lockfile/overrides) to a version that exposes ./compat as a directory subpath in exports.
- Add an
overrides / resolutions block to expect-cli's package.json so the transitive resolution stays aligned with what ink expects.
- As a temporary workaround for users: pin to a known-good earlier
expect-cli version in .mcp.json:
"args": ["-y", "expect-cli@<known-good-version>", "mcp"]
Impact
expect-cli is unusable as a CLI (--version, --help, etc. all fail at module resolution).
- The
expect MCP server cannot start, so Claude Code sessions in this repo have no mcp__expect__* tools available.
- Affects both Node 22 and Node 24, so a Node downgrade is not a viable workaround.
Suggested Next Steps
- File the upstream issue at https://github.com/millionco/expect/issues using the body in this document.
- While waiting on a fix, optionally pin
expect-cli to the latest known-working version in .mcp.json and re-approve the server.
- Re-run a Claude Code session and confirm
mcp__expect__* tools appear.
Expect MCP Server — Connection Failure Context
Summary
The
expectMCP server is configured and approved in this repo, but it does not connect because the upstreamexpect-clipackage crashes on launch under Node.js with anERR_UNSUPPORTED_DIR_IMPORTerror originating fromink→es-toolkit/compat.Repository
/home/user/untabclaude/test-expect-mcp-connection-HA1mwConfiguration (correct, no changes needed)
.mcp.json:{ "mcpServers": { "expect": { "command": "npx", "args": ["-y", "expect-cli@latest", "mcp"] } } }.claude/settings.json:{ "enabledMcpjsonServers": ["expect"], "enabledPlugins": { "chrome-devtools-mcp@chrome-devtools-plugins": true }, "extraKnownMarketplaces": { "chrome-devtools-plugins": { "source": { "source": "git", "url": "https://github.com/ChromeDevTools/chrome-devtools-mcp.git" }, "autoUpdate": true } } }The server is declared and explicitly enabled. The Claude Code session lists no
mcp__expect__*tools, confirming the server failed to start.Reproduction
Same failure with both:
vp env print→/root/.vite-plus/js_runtime/node/24.15.0/bin)Error
Root Cause Hypothesis
ink(transitive dependency ofexpect-cli) imports from'es-toolkit/compat'— a bare directory specifier. Node's strict ESM resolver rejects this unless the target package'sexportsmap declares the subpath, or the import points at a real file (es-toolkit/compat.js). The version ofes-toolkitthat gets hoisted in thenpxresolution does not expose./compatas a subpath, so resolution fails before any CLI code runs.Upstream
expect-cliapps/cli)<[founders@million.dev](mailto:founders@million.dev)>Possible Fixes (any of)
inkinexpect-clito a version whosees-toolkitimport targets a file path (es-toolkit/compat.js), or one that uses a subpath supported by thees-toolkitexportsmap.es-toolkit(viaexpect-cli's lockfile/overrides) to a version that exposes./compatas a directory subpath inexports.overrides/resolutionsblock toexpect-cli'spackage.jsonso the transitive resolution stays aligned with whatinkexpects.expect-cliversion in.mcp.json:Impact
expect-cliis unusable as a CLI (--version,--help, etc. all fail at module resolution).expectMCP server cannot start, so Claude Code sessions in this repo have nomcp__expect__*tools available.Suggested Next Steps
expect-clito the latest known-working version in.mcp.jsonand re-approve the server.mcp__expect__*tools appear.