MCP MongoDB Integration

by the-sukhsingh

302 downloads
Not rated
GitHub

About

This project demonstrates the integration of MongoDB with the Model Context Protocol (MCP) to provide AI assistants with database interaction capabilities.

Details

Author
the-sukhsingh
Downloads
302
Categories
Database

- Full CRUD operations exposed as MCP tools
- Gemini AI integration for natural language queries
- Terminal-based chatbot interface
- Supports find, insert, update, delete, and aggregation
- Count documents, list and create collections
- Communicates via Server-Sent Events (SSE)

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 MCP MongoDB Integration
    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

Set up the server by navigating to mcp-mongo-project, install dependencies, create a .env file with MONGODB_URI and MONGODB_NAME, then start with npm start. Set up the client by navigating to client-side, install dependencies, create a .env with GEMINI_API_KEY, and run node index.js. The client connects to the server via Server-Sent Events (SSE) and lets you chat with Gemini to perform MongoDB operations.

Claude Desktop / Cursor

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

{
    "mcpServers": {
        "mcp mongodb integration": {
            "mcpmongo": {
                "command": "node",
                "args": [
                    "index.js"
                ]
            }
        }
    }
}

McpServers

{
    "mcpmongo": {
        "command": "node",
        "args": [
            "index.js"
        ]
    }
}

MCP MongoDB Integration

This project demonstrates the integration of MongoDB with the Model Context Protocol (MCP) to provide AI assistants with database interaction capabilities. It consists of two main components:

1. MCP MongoDB Server - A server that exposes MongoDB operations as MCP tools
2. Client-side Gemini Integration - A terminal-based chatbot that uses Google's Gemini AI with access to MongoDB tools

Project Structure

.
├── client-side/            # Client application using Gemini AI
│   ├── index.js            # Main client application
│   └── package.json        # Client dependencies
└── mcp-mongo-project/      # MCP server with MongoDB tools
    ├── src/
    │   ├── index.js        # Server setup and tool definitions
    │   └── services/
    │       └── mcp-service.js  # MongoDB service implementation
    └── package.json        # Server dependencies

Features

- MongoDB Integration: Full CRUD operations exposed as MCP tools
- MCP Server: Implements the Model Context Protocol for AI tool use
- Gemini AI Integration: Connects to Google's Gemini models
- Terminal Chatbot: Interactive chat interface for database operations

Prerequisites

- Node.js (v14 or higher)
- MongoDB instance (local or remote)
- Google Gemini API key

Function Calling Overview

Setup Instructions

1. Server Setup

```bash

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.