MongoDB MCP Server

by PrashantSedhain

3 307 downloads Not rated yet MIT
GitHub

About

MongoDB MCP Server is a Model Context Protocol (MCP) server that connects to MongoDB and exposes a query tool to retrieve data from collections via a simple interface. It currently supports read-only transactions and is intended for local integrations and command line tools.

Details

License
MIT

Explore

- Exposes a query tool for MongoDB collections
- Read‑only transactions only
- Connects to local or cloud MongoDB databases
- Built with Node.js and TypeScript
- Includes a client application for interaction

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name MongoDB MCP Server
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

- Node.js (v16 or higher)
- npm
- MongoDB database (local or cloud-based)

node dist/client/client.js dist/index.js

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "mongodb mcp server": {
            "mongo-db-mcp": {
                "command": "node",
                "args": [
                    "dist/client/client.js",
                    "dist/index.js"
                ]
            }
        }
    }
}

McpServers

{
    "mongo-db-mcp": {
        "command": "node",
        "args": [
            "dist/client/client.js",
            "dist/index.js"
        ]
    }
}

A Model Context Protocol (MCP) server for MongoDB that allows querying MongoDB collections through a simple interface for local integrations and command line tools.

Overview

This project implements an MCP server that connects to MongoDB and provides a query tool to retrieve data from collections. It currently only supports read-only transactions. Project includes:

- A MongoDB MCP server that exposes database querying capabilities
- A client application for interacting with the server
- Utilities for MongoDB connection and transaction management

Prerequisites

- Node.js (v16 or higher)
- npm
- MongoDB database (local or cloud-based)

Installation

1. Clone the repository:

   git clone https://github.com/yourusername/mongo-db-mcp.git
cd mongo-db-mcp

2. Install dependencies:

   npm install

3. Create a .env file in the root directory with your MongoDB connection string:

   MONGO_CONNECTION_STRING=your_mongodb_connection_string

Building the Project

Build the TypeScript code:

npm run build

Running the client

node dist/client/client.js dist/index.js
No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.