mongo-mcp

mongo-mcp

10

This project is an MCP server designed to facilitate interaction between large language models (LLMs) and MongoDB databases using the Model Context Protocol. It offers features like schema inspection, document querying, and secure access management, promoting seamless database operations through natural language queries.

🗄️ MongoDB MCP Server for LLMS

A Model Context Protocol (MCP) server enabling LLMs to interact with MongoDB databases.

📚 What is Model Context Protocol (MCP)?

  • Universal access for AI assistants to query data
  • Standardized connections for authentication and data formats
  • Promotes ecosystem of reusable connectors

✨ Features

  • Collection schema inspection
  • Document querying and filtering
  • Index management
  • Secure database access
  • Comprehensive error handling and validation

Prerequisites

  • Node.js (v18 or higher)
  • MongoDB instance
  • MCP client like Claude Desktop or Cursor.ai

Installing via Smithery

Install MongoDB MCP Server for Claude Desktop using Smithery.

Available Tools

Query Tools

  • listCollections
  • find
  • insertOne

Index Tools

  • createIndex
  • dropIndex

Development

  • Built with TypeScript and MongoDB Node.js driver
  • Install dependencies, build, and run tests with npm

Security Considerations

  • Create dedicated MongoDB user
  • Never use admin credentials in production
  • Enable access logging

How It Works

  • Connects to MongoDB using the provided connection string
  • Exposes operations as MCP tools
  • Validates inputs with Zod

Deployment

  • Locally, as global npm package, or in a Docker container

❓ Troubleshooting

Common Issues

  1. Connection Errors
  2. Authentication Issues
  3. Tool Execution Problems
  4. Performance Issues

🤝 Contributing

Contributions are encouraged via Pull Requests.

📜 License

Licensed under the MIT License.