• Databases
JavaScript
MIT
101
5
  • Apple
-
security - not tested
A
license - permissive license (MIT)
-
quality - not tested

A Model Context Protocol server that provides access to MongoDB databases. This server enables LLMs to inspect collection schemas and execute read-only queries.

  1. Tools
  2. Prompts
  3. Resources
  4. Server Configuration
  5. README.md

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

Tools

Functions exposed to the LLM to take actions

NameDescription

No tools

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault

No arguments

README.md

MCP MongoDB Server


NPM Version NPM Downloads NPM License smithery badge

A Model Context Protocol server that provides access to MongoDB databases. This server enables LLMs to inspect collection schemas and execute read-only queries.

Demo

MCP MongoDB Server Demo | Claude Desktop

Features

Resources

  • List and access collections via mongodb:// URIs
  • Each collection has a name, description and schema
  • JSON mime type for schema access

Tools

  • query
    • Execute read-only MongoDB queries against the connected database
    • Input: query (object): The MongoDB query to execute
    • All queries are executed with read-only permissions
  • aggregate
    • Execute read-only MongoDB queries against the connected database
    • Input: aggregate (object): The MongoDB query to execute
    • All queries are executed with read-only permissions

Prompts

  • query - Provide insights about the collection's structure, data types, and basic statistics
    • Input: collection (string): The name of the collection to analyze
    • Output: text (string): A summary of the collection's structure, data types, and basic statistics
  • aggregate - Provide insights about the collection's structure, data types, and basic statistics
    • Input: collection (string): The name of the collection to analyze
    • Output: text (string): A summary of the collection's structure, data types, and basic statistics

Development

Install dependencies:

npm install

Build the server:

npm run build

For development with auto-rebuild:

npm run watch

Installation for Development

Using Claude Desktop

To use with Claude Desktop, add the server config:

On MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json

On Windows: %APPDATA%/Claude/claude_desktop_config.json

{ "mcpServers": { "mongodb": { "command": "node", "args": [ "~/mcp-mongo-server/build/index.js", "mongodb://muhammed:kilic@mongodb.localhost/namespace" ] }, } }

Debugging

Since MCP servers communicate over stdio, debugging can be challenging. We recommend using the MCP Inspector, which is available as a package script:

npm run inspector

The Inspector will provide a URL to access debugging tools in your browser.

Components

Resources

The server provides schema information for each collection in the database:

  • Collection Schemas (mongodb://<host>/<collection>/schema)
    • JSON schema information for each collection
    • Includes field names and data types
    • Automatically inferred from collection documents

Usage with Claude Desktop

To use this server with the Claude Desktop app, add the following configuration to the "mcpServers" section of your claude_desktop_config.json:

{ "mcpServers": { "mongodb": { "command": "npx", "args": [ "-y", "mcp-mongo-server", "mongodb://muhammed:kilic@mongodb.localhost/sample_namespace" ] } } }

Installing via Smithery

To install MCP MongoDB Server for Claude Desktop automatically via Smithery:

npx @smithery/cli install mcp-mongo-server --client claude

Installing via mcp-get

You can install this package using mcp-get:

npx @michaellatman/mcp-get@latest install mcp-mongo-server

Replace /sample_namespace with your database name.

License

This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.

GitHub Badge

Glama performs regular codebase and documentation scans to:

  • Confirm that the MCP server is working as expected.
  • Confirm that there are no obvious security issues with dependencies of the server.
  • Extract server characteristics such as tools, resources, prompts, and required parameters.

Our directory badge helps users to quickly asses that the MCP server is safe, server capabilities, and instructions for installing the server.

Copy the following code to your README.md file:

Alternative MCP servers

  • A
    security
    A
    license
    A
    quality
    This server enables AI models to interact with MySQL databases through a standardized interface.
    MIT
  • A
    security
    A
    license
    A
    quality
    A Model Context Protocol (MCP) server implementation for DuckDB, providing database interaction capabilities through MCP tools. It would be interesting to have LLM analyze it. DuckDB is suitable for local analysis.
    MIT
    • Apple
  • A
    security
    A
    license
    A
    quality
    A Model Context Protocol (MCP) server that provides programmatic access to the Supabase Management API. This server allows AI models and other clients to manage Supabase projects and organizations through a standardized interface.
    MIT
  • -
    security
    A
    license
    -
    quality
    A Model Context Protocol (MCP) server implementation that provides database interaction and business intelligence capabilities through SQLite. This server enables running SQL queries, analyzing business data, and automatically generating business insight memos.
    MIT