MCP ExplorerExplorer

Claude Mcp Mongodb Integration

@OrMaccon 10 months ago
3 MIT
FreeCommunity
AI Systems
Connect MongoDB to Claude via MCP for educational use only.

Overview

What is Claude Mcp Mongodb Integration

claude-mcp-mongodb-integration is a personal project that connects MongoDB databases to Claude using the Model Context Protocol (MCP) for educational purposes only. It allows Claude to query the MongoDB database using natural language.

Use cases

Use cases include querying educational datasets, experimenting with natural language queries on personal databases, and learning how to integrate databases with AI models in a controlled environment.

How to use

To use claude-mcp-mongodb-integration, you need to install the required @smithery/cli package, obtain your MongoDB connection string, and update the Claude configuration file accordingly. Follow the setup instructions provided in the README to connect your MongoDB database to Claude.

Key features

Key features include the ability to connect a MongoDB database to Claude, natural language querying capabilities, and ease of setup with Node.js and npm. It is important to note that this integration is not intended for production use.

Where to use

claude-mcp-mongodb-integration can be used in educational settings, research projects, and personal experiments where users want to explore the capabilities of natural language processing with MongoDB data.

Content

Connect MongoDB to Claude via MCP

Do not use a production cluster!

⚠️ Disclaimer

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.

📦 Prerequisites

Access to a running MongoDB database (e.g., MongoDB Atlas or local):

Make sure you have the following installed and ready:

🛠 Setup Instructions

1. Install the required @smithery/cli

npm install @smithery/cli

The @smithery/cli is used to run the MCP server that connects your MongoDB database to Claude.

2. Get your MongoDB_URI (for Node.js) connection string and Connect to MongoDB Compass

🛑🛑To continue, you must get your Node.js connection string from Atlas🛑🛑
image

3. Update Claude claude_desktop_config.json file

  1. Open the Claude desktop app
  2. Go to Settings → Developer
  3. Click “Edit config”
  4. Open the claude_desktop_config.json file and
  5. 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.

image

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:

image

Claude will now have access to your MongoDB database

🧪 Usage Example

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”

🔒 Security Notes

  • 🧪 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/

Q&A:

❗️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

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers