Registry / database / mongo-mcp

mongo-mcp

JSON →
library0.2.0jsnpmunverified

A Model Context Protocol (MCP) server (v0.2.0) that enables LLMs like Claude to interact directly with MongoDB databases. It provides tools for querying collections, inspecting schemas, managing indexes, and performing document operations (insert, update, delete). Designed to be used as a tool provider for MCP clients (e.g., Claude Desktop). Requires Node.js 18+ and a MongoDB connection string. Differentiators: leverages the MCP standard, easy setup via npx, and provides a sandbox for testing. Active development, frequent updates expected.

npm install mongo-mcp
INSTALL
IMPORT
SIG · MONGO-MCP
M
mongo-mcp
databasejavascriptv0.2.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Default Export
npx mongo-mcp <connection_string> (not imported directly, CLI tool)
const mongoMcp = require('mongo-mcp')
This package is a CLI tool, not a library. Usage is via npx as an MCP server command.

Claude Desktop configuration to connect to a local MongoDB sandbox. Replace connection string with your own.

{ "mcpServers": { "mongodb": { "command": "npx", "args": [ "mongo-mcp", "mongodb://root:example@localhost:27017/test?authSource=admin" ] } } }
Debug
Known issues
gotchaPackage is primarily a CLI tool; importing it as a Node.js module is not supported and may break.
fix
Use via npx or run the dist/index.js directly. Do not require() or import this package.
affects: >=0.1.0
gotchaConnection string is passed as a command-line argument; avoid exposing credentials in version control.
fix
Use environment variables or secrets management for the connection string.
affects: >=0.1.0
gotchaNo authentication or authorization built-in; any MCP client with the config can access the database.
fix
Use a MongoDB user with limited privileges (read-only, specific database) for production.
affects: >=0.1.0
gotchaThe package is experimental and may change significantly; tools and their signatures are not stable.
fix
Pin to a specific version and test updates in a sandbox before using in production.
affects: <1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'mongo-mcp'
Attempting to require/import the package as a library instead of using npx.
fix
Do not import in code. Run: npx mongo-mcp <connection_string>
MongooseError: The `uri` parameter to `openUri()` must be a string, got "undefined"
Connection string not provided as argument when running the MCP server.
fix
Pass a valid MongoDB connection string: node dist/index.js mongodb://...
Error: listen EADDRINUSE :::3000
Default port 3000 already in use; MCP server may be conflicting.
fix
Kill the process using port 3000 or configure a different port (if supported).
Upgrade
Version history
0.2.0latest on npm
Audit
Dependencies
@modelcontextprotocol/sdkrequiredCore SDK for building MCP servers
mongodbrequiredMongoDB Node.js driver for database connectivity
Agent activity
2 hits · last 30 days
node
2
Resources
mongo-mcp — npm install mongo-mcp · libregistry