Summary
mongodb-mcp-server@1.11.0 fails to start when spawned via npx -y mongodb-mcp-server@1.11.0. The process exits before any MCP handshake with ERR_MODULE_NOT_FOUND for a transitive dependency. 1.10.0 works fine in the same environment.
Reproduction
# Inside a Linux container, as a non-root user (e.g. uid 1001)
npx -y mongodb-mcp-server@1.11.0
Result (with no other env set):
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/home/worker/.npm/_npx/<hash>/node_modules/@mcp-ui/server/dist/index.mjs' imported from /home/worker/.npm/_npx/<hash>/node_modules/mongodb-mcp-server/dist/esm/tools/tool.js
Did you mean to import "@mcp-ui/server/dist/index.cjs"?
at finalizeResolution (node:internal/modules/esm/resolve:275:11)
...
{
code: 'ERR_MODULE_NOT_FOUND',
url: 'file:///home/worker/.npm/_npx/<hash>/node_modules/@mcp-ui/server/dist/index.mjs'
}
The same npx -y mongodb-mcp-server@1.10.0 in the same environment starts cleanly and accepts JSON-RPC initialize over stdio. The server proceeds normally through [INFO] 1000003 - server: Server close requested on stdin EOF.
Root cause
mongodb-mcp-server@1.11.0 pulls in @mcp-ui/server@6.1.0 as a transitive dependency. That package's package.json#exports declares:
{
".": {
"types": "./dist/src/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
}
}
…but the published 6.1.0 tarball does not contain dist/index.mjs. Only dist/index.cjs is present. When mongodb-mcp-server's ESM code does import from @mcp-ui/server, Node resolves the import condition → dist/index.mjs → file missing → crash. The error message's "Did you mean to import dist/index.cjs?" confirms which file exists.
This appears to be a packaging bug in @mcp-ui/server@6.1.0 that surfaces only because mongodb-mcp-server@1.11.0 started depending on it (or upgraded its version). 1.10.0 was unaffected (different dep set / different resolution).
Environment
node v22.22.3
npm 10.9.8
- Linux container (debian-slim base), running as non-root
worker user uid 1001
- Spawned via
npx -y mongodb-mcp-server@1.11.0 (no global install)
Workaround
Pin to mongodb-mcp-server@1.10.0 until upstream @mcp-ui/server ships a tarball that matches its exports field (or mongodb-mcp-server updates its dep range to skip 6.1.0).
Suggested fixes (any one resolves)
mongodb-mcp-server pins @mcp-ui/server to a version that ships both .mjs and .cjs per its own exports declaration.
- File upstream against
@mcp-ui/server to either ship the .mjs or update exports to omit the import condition.
- Cut a
1.11.1 patch with the dep fix.
Happy to test a prerelease if the team wants to try a fixed dep range before a public bump.
Summary
mongodb-mcp-server@1.11.0fails to start when spawned vianpx -y mongodb-mcp-server@1.11.0. The process exits before any MCP handshake withERR_MODULE_NOT_FOUNDfor a transitive dependency.1.10.0works fine in the same environment.Reproduction
# Inside a Linux container, as a non-root user (e.g. uid 1001) npx -y mongodb-mcp-server@1.11.0Result (with no other env set):
The same
npx -y mongodb-mcp-server@1.10.0in the same environment starts cleanly and accepts JSON-RPCinitializeover stdio. The server proceeds normally through[INFO] 1000003 - server: Server close requestedon stdin EOF.Root cause
mongodb-mcp-server@1.11.0pulls in@mcp-ui/server@6.1.0as a transitive dependency. That package'spackage.json#exportsdeclares:{ ".": { "types": "./dist/src/index.d.ts", "import": "./dist/index.mjs", "require": "./dist/index.cjs" } }…but the published 6.1.0 tarball does not contain
dist/index.mjs. Onlydist/index.cjsis present. Whenmongodb-mcp-server's ESM code doesimportfrom@mcp-ui/server, Node resolves theimportcondition →dist/index.mjs→ file missing → crash. The error message's "Did you mean to import dist/index.cjs?" confirms which file exists.This appears to be a packaging bug in
@mcp-ui/server@6.1.0that surfaces only becausemongodb-mcp-server@1.11.0started depending on it (or upgraded its version).1.10.0was unaffected (different dep set / different resolution).Environment
node v22.22.3npm 10.9.8workeruser uid 1001npx -y mongodb-mcp-server@1.11.0(no global install)Workaround
Pin to
mongodb-mcp-server@1.10.0until upstream@mcp-ui/serverships a tarball that matches itsexportsfield (ormongodb-mcp-serverupdates its dep range to skip 6.1.0).Suggested fixes (any one resolves)
mongodb-mcp-serverpins@mcp-ui/serverto a version that ships both.mjsand.cjsper its ownexportsdeclaration.@mcp-ui/serverto either ship the.mjsor updateexportsto omit theimportcondition.1.11.1patch with the dep fix.Happy to test a
prereleaseif the team wants to try a fixed dep range before a public bump.