- Home
- MCP servers
- Mongo
Mongo
- javascript
0
GitHub Stars
javascript
Language
3 months ago
First Indexed
3 weeks ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"jb-7-jay-learn-mcp-server-mongo": {
"command": "node",
"args": [
"/absolute/path/to/server.js"
]
}
}
}You can run a MongoDB-backed MCP server that provides user management tools and guided prompts. It connects to MongoDB, exposes interactive tools, and supports graceful shutdown and robust error handling so you can manage users efficiently in your application workflows.
How to use
Use an MCP client to interact with the MongoDB MCP Server. You can run the server locally and then issue tool commands to create users, retrieve user details by email, or list users with pagination. The server is designed to gracefully shut down and surface clear error messages, helping you build reliable workflows around your data.
How to install
Prerequisites you need before starting:
# Prerequisites
- Node.js (Latest LTS version)
- MongoDB (v8.0 or higher)
- Claude for Desktop (latest version)
- Visual Studio Code with Cursor extension (for development)
Install MongoDB on macOS with Homebrew and start the service, then install the server dependencies and prepare the environment.
# Using Homebrew on macOS
brew tap mongodb/brew
brew install mongodb-community
# Start MongoDB service
brew services start mongodb-community
Install Cursor in VS Code to enable MCP integrations.
# In VS Code, install Cursor from Extensions
Clone the project, install dependencies, and set up environment values.
git clone <repository-url>
cd learn-mcp-mongo
npm install
Configure environment variables, using the example as a guide. If your MongoDB URI differs from the default, update the value in your environment file.
cop .env.example .env
# Edit .env with your MongoDB URI if different from default
Start the MCP server directly or via a development command. The server can be run using the standard npm start script, or by invoking the Node runtime directly on the server file.
# Start in development mode (inspector) if you prefer debugging
npx @modelcontextprotocol/inspector node mcp-server.js
# Or start via npm script
npm start
Additional configuration and notes
The MCP server includes a simple configuration for integrating with an MCP client. A typical runtime path to the server in a local setup uses a direct Node invocation or an npm script. You can also configure tools and prompts to guide user management tasks through interactive prompts.
Environment and runtime considerations include ensuring MongoDB is running and accessible at mongodb://localhost:27017 by default, and updating the MongoDB connection string in your environment file if needed.
Troubleshooting and tips
If you encounter issues, check that MongoDB is running and accessible, and review server logs for startup errors or tool execution issues. You can test MongoDB operations in a shell, for example by listing users from the target database.
For development and debugging, use the inspector variant of the start command to attach a debugger, and verify that the MCP prompts and tool flows work as expected.
Available tools
create-user
Creates a new user in the MongoDB database with name, email, and age fields. Returns the created user object.
get-user
Retrieves a user by their email address from the MongoDB collection and returns the user data.
list-users
Lists users with optional pagination (limit) to control how many users are returned per request.