Do not use a production cluster!
This is a personal project and not officially affiliated with MongoDB Inc. It’s intended for educational use only and not recommended for production. Use at your own discretion — you're responsible for any risks or consequences.
This project explains how to connect your own MongoDB database to Claude using the Model Context Protocol (MCP). Once connected, Claude will be able to query your database using natural language. This is not an official MongoDB integration.
Access to a running MongoDB database (e.g., MongoDB Atlas or local):
- Atlas account
- Set a MongoDB Cluster -** Do not use a production cluster!**
- Download MongoDB Compass For Easy Desktop UI (Optional)
Make sure you have the following installed and ready:
- Node.js - version 18 or higher
- npm
- Claude desktor
npm install @smithery/cliThe @smithery/cli is used to run the MCP server that connects your MongoDB database to Claude.
- Connect to Compass to easly see the data in your DB.
- Get your MongoDB_URI (for Node.js) connection string in MongoDB Atlas - https://www.mongodb.com/docs/guides/atlas/connection-string/
🛑🛑To continue, you must get your Node.js connection string from Atlas🛑🛑

- Open the Claude desktop app
- Go to Settings → Developer
- Click “Edit config”
- Open the claude_desktop_config.json file and
- Update it with the following content and replace <mongoUri_Node.js> per instructions below:
{
"mcpServers": {
"mongo-mcp": {
"command": "npx",
"args": [
"-y",
"@smithery/cli@latest",
"run",
"mongo-mcp",
"--config",
"{\"mongoUri\":\"<mongoUri_Node.js>\"}"
]
}
}
}Replace the <mongoUri_Node.js> part with your MongoDB_URI (for Node.js) connection sting that you got above.
Relaunch Claude - Sometimes it takes 2-3 times of relaunching to see the MCP tools. If everything is correct, you should see an icon of a Hammer and a number (8 tools) next to Claude text box:
Claude will now have access to your MongoDB database
Once you see the MCP tools try prompting Claude with something like:
“Show me all my collections” “Create a new collection of Users and insert a document that is relevant”
- 🧪 Use a test environment. This setup is meant for experimentation and learning. We highly recommend using a dedicated test cluster or database — not your production environment.
- 🔐 Control permissions.
Follow for more: https://www.linkedin.com/in/ormaccabi/
❗️Troubleshooting Permissions
If you get an error during `npm install` that includes `EACCES`, `EPERM`, or similar permission issues, it's likely due to file ownership problems in your `.npm` directory. You can fix it by resetting permissions:
For example, on macOS:
```bash
sudo chown -R $(whoami) ~/.npm
