[Bug]: Cannot find module '@mongodb-js/saslprep'
Closed this issue · 7 comments
Version
mongodb-mcp-server@0.3.0
Node 24.3.0
App
- Cursor
- Windsurf
- VSCode
- VSCode Insiders
- Claude Desktop
- Other
Affected Models (if applicable)
- Claude 3.5 Sonnet
- Claude 3.7 Sonnet
- GPT-4a
- o4-mini
- Other
Bug Description
Cannot find module '@mongodb-js/saslprep' when running npx -y mongodb-mcp-server on node 24.3.0
Thanks for opening this issue. The ticket MCP-180 was created for internal tracking.
Hi @marclou ,
can you provide more information on the environment where you are running the MCP Server?
- Can you provide the host OS? Are you running on a Linux Distro/Windows/OSX?
- Are you using a Docker container?
- Can you go to a temporary directory and run
npm i @mongodb-js/saslprep? Later delete any node_modules folder created.
@mongodb-js/saslprep is a security library used by the MongoDB Driver. Does installing the driver work for you?
Thanks!
sure
- MacOS
- Nope, just a NextJS project
- I did install saslprep successfully but I still get "Error: Cannot find module '@mongodb-js/saslprep'" when enabling the MCP server
Do I guess right that your NextJS application can connect to MongoDB fine and run queries?
@nirinchev , @himanshusinghs , @blva . I'll be off for a few days, can you take the lead on this one? To make sure it's not a generalised issue.
Correct
Do I guess right that your NextJS application can connect to MongoDB fine and run queries?
Correct, no issues with that!
I'm unable to recreate this but a couple things worth confirming for this:
- Running
npm cache verifyto make sure the npm cache isn't in a weird state. npm list -g --depth=0Check that you do not have any globally installed packages that can conflict with this (i.e. an oldmongodbor other MongoDB dependent tool.--depth=1might be useful too)- Check that the directory you're running from doesn't have any NPM dependencies that could affect this or ideally isn't a Node project directory at all (i.e. with
npm list mongodb-mcp-serverandnpm list mongodb). where npm,where npxandwhere nodeall point to the same installation of Node/NPM.
If nothing suspicious is caught from there, you can try installing with npm i --g mongodb-mcp-server. Though I'd expect it to fail similarly. Going down a Docker route should hopefully unblock you otherwise but we'd definitely want to resolve this issue if it persists.
The corresponding JIRA ticket has been automatically closed.