================== /// MCP /// /// MCP /// ================== [server:online] [protocol:ready]
mcp-mongo-server
by kiliczsh
Model-Context-Protocol (MCP) server that lets LLMs inspect schemas and run queries/aggregations on MongoDB, with optional read-only mode and smart ObjectId conversion.
249
40
Open Source01
query
Execute MongoDB queries
02
aggregate
Run aggregation pipelines
03
count
Count matching documents
04
update
Modify documents
05
insert
Add new documents
06
createIndex
Create collection indexes
07
serverInfo
Get MongoDB server details
Installation
1. Prerequisites
• Node.js ≥ 18 and npm/yarn/pnpm
• Running MongoDB (local Docker container or remote cluster).
Example local Docker:
docker run -d -p 27017:27017 --name mongo mongo:7
2. Install the server package
Global CLI (recommended for quick start):
npm install -g mcp-mongo-server
Project dependency:
npm install mcp-mongo-server --save
3. Create a minimal configuration file (mcp.config.js / mcp.config.mjs)
module.exports = {
dbUri: process.env.MONGO_URI || "mongodb://localhost:27017/mcp", // Mongo connection string
port: process.env.MCP_PORT || 8080, // HTTP port
apiKey: process.env.MCP_API_KEY, // optional auth key
collections: ["documents"] // mongo collections to search
};
4. Launch the server
• From CLI (global):
mcp-mongo-server --config ./mcp.config.js
• With npx:
npx mcp-mongo-server --config ./mcp.config.js
5. Verify
curl http://localhost:8080/health → 200 OK
Environment Variables quick-start
export MONGO_URI="mongodb://localhost:27017/mcp"
export MCP_PORT=8080
export MCP_API_KEY=secret123
mcp-mongo-server
Docker
docker run -d \
-e MONGO_URI=mongodb://host.docker.internal:27017/mcp \
-e MCP_API_KEY=secret123 \
-p 8080:8080 kiliczsh/mcp-mongo-server
TypeScript projects can also import and embed the server:
import { createServer } from 'mcp-mongo-server';
createServer({ dbUri: 'mongodb://…' }).start();
Documentation
# Transform Augment Code into a Database-Aware Coding Partner with MongoDB Integration Stop switching between your code editor and MongoDB Compass every time you need to query data, analyze schemas, or debug database issues. The **mcp-mongo-server** transforms Augment Code from a standard AI coding assistant into a MongoDB-aware powerhouse that can directly interact with your databases while you code. ## Seamless Database Operations During Development With this MCP server connected to Augment Code, you can ask your AI assistant to query your MongoDB collections, analyze data patterns, and even generate code based on real schema information - all without leaving your coding flow. Augment can now execute complex aggregation pipelines, inspect collection structures, and provide data-driven insights that directly inform your coding decisions. Whether you're building a new feature that requires understanding user behavior patterns or debugging an issue that needs real-time data analysis, Augment becomes your intelligent database companion. ## Productivity Gains That Matter The real magic happens when Augment Code can combine its code generation capabilities with live database access. Instead of writing boilerplate MongoDB queries from memory, you can ask Augment to "find all users who haven't logged in for 30 days and generate the cleanup function" - it will query your actual data, understand the schema, and generate perfectly tailored code. The server's smart ObjectId handling and read-only mode options mean you can safely connect to production databases, giving Augment context about real data without risking accidental modifications. This integration is particularly powerful for developers working on data-intensive applications, analytics dashboards, or any system where understanding the actual data structure is crucial for writing effective code. ## Quick Setup for Maximum Impact Adding this server to your Augment Code setup takes just minutes. Simply add the configuration to your Augment settings, connect to your MongoDB instance (local or remote), and start coding with database superpowers. The server supports both read-only connections for safe production access and full read-write capabilities for development environments, making it perfect for any stage of your development workflow.
License: MIT License
Updated 7/15/2025