JUHE API Marketplace
franciscorojas27 avatar
MCP Server

MongoDB MCP Server

A modular server that enables management of MongoDB databases, collections, documents, indexes, and bulk operations through the Model Context Protocol (MCP) interface.

0
GitHub Stars
3/10/2026
Last Updated
No Configuration
Please check the documentation below.
  1. Home
  2. MCP Servers
  3. McpServerMongodb

README Documentation

πŸš€ MongoDB MCP Server

A modular, well-documented server for managing MongoDB databases, collections, documents, indexes, and bulk operations using the Model Context Protocol (MCP). Built for extensibility, clarity, and ease of use. Fully compatible with ESM, TypeScript, and modern testing workflows.


✨ Features

  • πŸ“¦ Register and manage MongoDB databases, collections, documents, indexes, and bulk operations via MCP tools
  • ⚑ Bulk operations support
  • πŸ“ Fully documented codebase (English, JSDoc)
  • βš™οΈ Easy configuration via config.json
  • 🧩 Clean, modular architecture
  • πŸ§ͺ Automated tests with Jest, ts-jest, and in-memory MongoDB
  • πŸ”— Modern ESM + TypeScript + path aliases
  • 🧾 Test files use .mjs extension for full ESM compatibility with Jest

πŸ“ Project Structure

β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ main.ts                # Main entry point, server initialization
β”‚   β”œβ”€β”€ config.json            # MongoDB connection config
β”‚   β”œβ”€β”€ mongo/                 # MongoDB operation classes
β”‚   └── tools/                 # MCP tool registration modules
β”œβ”€β”€ tests/                     # Jest test suites (in-memory MongoDB, .mjs)
β”œβ”€β”€ package.json
β”œβ”€β”€ tsconfig.json
β”œβ”€β”€ jest.config.cjs
└── README.md

🚦 Getting Started

Prerequisites

  • Node.js (v18+ recommended)
  • TypeScript
  • MongoDB instance (local or remote)

Installation

  1. Clone the repository:

    git clone <your-repo-url>
    cd <your-repo>
    
  2. Install dependencies:

    npm install
    
  3. Configure your MongoDB URI in src/config.json:

    {
      "mongo_uri": "mongodb://localhost:27017"
    }
    

πŸƒ Running the Server

You can run the server using tsx:

npx tsx src/main.ts

Or use the provided VS Code launch configuration.


βš™οΈ VS Code MCP Integration Example

To use this server as an MCP backend in VS Code, add the following to your settings.json:

"mcp": {
  "inputs": [],
  "servers": {
    "mongo-local": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "tsx",
        "C:/Users/<your-username>/Desktop/McpServerMongodb/src/main.ts"
      ]
    }
  }
},
  • Replace <your-username> with your actual Windows username or adjust the path to where your project is located.
  • This will allow VS Code to launch your MCP MongoDB server as a local backend.

πŸ§ͺ Running Tests

All core logic is covered by automated tests using Jest, ts-jest, and mongodb-memory-server for a real MongoDB environment in-memory (no external DB required).

npm test
  • Tests are located in the tests/ directory and use the .mjs extension for ESM compatibility.

  • ESM, TypeScript, and path aliases are fully supported in tests.

  • Example test import (in a .mjs test file):

    import { MongoDatabaseOps } from "@mongo/mongoDatabaseOps.js";
    

πŸ› οΈ Usage & Development

  • The server exposes MCP tools for database, collection, document, index, and bulk operations.
  • You can extend or customize tools in the src/tools/ directory.
  • All business logic for MongoDB operations is in src/mongo/.
  • Use path aliases (@mongo/, @tools/) for clean imports.
  • All code and tests use ESM imports with explicit .js extensions for internal modules.
  • All Jest test files must use the .mjs extension for full ESM compatibility.

πŸ§‘β€πŸ’» Code Quality

  • All files are documented in English using JSDoc.
  • Modular and maintainable structure.
  • Follows best practices for clarity and extensibility.
  • Robust error handling and configuration management.

🧩 ESM, TypeScript & Jest Notes

  • Project uses ESM (type: "module"), moduleResolution: "nodenext", and path aliases in tsconfig.json.
  • Jest is configured to transform ESM dependencies (e.g., mongodb-memory-server) and support TypeScript/ESM via ts-jest.
  • All internal imports must use .js extensions for ESM compatibility.
  • All Jest test files must use the .mjs extension for ESM compatibility.
  • See jest.config.cjs and tsconfig.json for details.

πŸ‘€ Author

Francisco Antonio Rojas FariΓ±a


πŸ“„ License

MIT

Quick Actions

View on GitHubView All Servers

Key Features

Model Context Protocol
Secure Communication
Real-time Updates
Open Source

Boost your projects with Wisdom Gate LLM API

Supporting GPT-5, Claude-4, DeepSeek v3, Gemini and more.

Enjoy a free trial and save 20%+ compared to official pricing.

Learn More
JUHE API Marketplace

Accelerate development, innovate faster, and transform your business with our comprehensive API ecosystem.

JUHE API VS

  • vs. RapidAPI
  • vs. API Layer
  • API Platforms 2025
  • API Marketplaces 2025
  • Best Alternatives to RapidAPI

For Developers

  • Console
  • Collections
  • Documentation
  • MCP Servers
  • Free APIs
  • Temp Mail Demo

Product

  • Browse APIs
  • Suggest an API
  • Wisdom Gate LLM
  • Global SMS Messaging
  • Temp Mail API

Company

  • What's New
  • Welcome
  • About Us
  • Contact Support
  • Terms of Service
  • Privacy Policy
Featured on Startup FameFeatured on Twelve ToolsFazier badgeJuheAPI Marketplace - Connect smarter, beyond APIs | Product Huntai tools code.marketDang.aiFeatured on ShowMeBestAI
Copyright Β© 2026 JUHEDATA HK LIMITED - All rights reserved