Skip to content

1.11.0 crashes on spawn with ERR_MODULE_NOT_FOUND for @mcp-ui/server #1206

@MRIIOT

Description

@MRIIOT

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)

  1. mongodb-mcp-server pins @mcp-ui/server to a version that ships both .mjs and .cjs per its own exports declaration.
  2. File upstream against @mcp-ui/server to either ship the .mjs or update exports to omit the import condition.
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions