MCP MongoDB Server

MCP MongoDB Server

An MCP server that provides tools to query and interact with MongoDB user collections, supporting filtering, sorting, and retrieval operations.

Category
Visit Server

README

MCP MongoDB Server

An MCP (Model Context Protocol) server that provides tools to interact with MongoDB databases, specifically designed to query user collections.

Features

  • Query Users: Search and filter users with MongoDB queries
  • Get User by ID: Retrieve specific users by their ID
  • Count Users: Get total count of users with optional filtering
  • Flexible Filtering: Support for MongoDB query operators
  • Sorting and Projection: Advanced query capabilities

Prerequisites

  • Node.js 18+
  • MongoDB instance (local or cloud)
  • TypeScript knowledge

Installation

  1. Install dependencies:

    npm install
    
  2. Set up environment variables:

    cp .env.example .env
    

    Edit .env with your MongoDB connection details:

    MONGODB_URI=mongodb://localhost:27017
    MONGODB_DB_NAME=your_database_name
    
  3. Build the project:

    npm run build
    

Usage

Starting the Server

npm start

Or for development with auto-reload:

npm run dev

Available Tools

1. query_users

Query users with optional filters, sorting, and projection.

Parameters:

  • filter (object, optional): MongoDB filter object
  • limit (number, optional): Maximum results (default: 10)
  • sort (object, optional): Sort criteria
  • projection (object, optional): Fields to include/exclude

Example:

{
  "filter": {"age": {"$gte": 25}},
  "limit": 5,
  "sort": {"name": 1},
  "projection": {"_id": 1, "name": 1, "email": 1}
}

2. get_user_by_id

Retrieve a specific user by their ID.

Parameters:

  • userId (string, required): The user ID to search for

Example:

{
  "userId": "507f1f77bcf86cd799439011"
}

3. count_users

Count total users with optional filtering.

Parameters:

  • filter (object, optional): MongoDB filter object

Example:

{
  "filter": {"status": "active"}
}

MongoDB Connection

The server supports various MongoDB connection types:

Local MongoDB

MONGODB_URI=mongodb://localhost:27017
MONGODB_DB_NAME=myapp

MongoDB with Authentication

MONGODB_URI=mongodb://username:password@localhost:27017/myapp
MONGODB_DB_NAME=myapp

MongoDB Atlas

MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/myapp
MONGODB_DB_NAME=myapp

Development

Project Structure

├─

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured