Back to Home
ziangziangziang icon

mcp-mongodb

Verified Safe

by ziangziangziang

Overview

Exposes a MongoDB database to Model Context Protocol (MCP) agents, providing tools for database inspection, querying, and aggregation.

Installation

Run Command
npm run build && PORT=3000 npm start

Environment Variables

  • MONGODB_URI
  • ALLOWED_DB_NAME
  • DISALLOWED_DB_NAME
  • PORT
  • DEBUG

Security Notes

The `query` and `aggregation` tools accept flexible JSON objects for filters, projections, sort, and pipelines (`z.any()` in their input schemas). This allows agents to construct arbitrary MongoDB read queries. While the README emphasizes 'read-only access' and strongly recommends not exposing the server publicly, and database access can be controlled via `ALLOWED_DB_NAME`/`DISALLOWED_DB_NAME` environment variables, a compromised or maliciously instructed agent could potentially execute complex, resource-intensive read operations or exfiltrate unintended data if the connected MongoDB user has broader permissions than strictly necessary for these tools. It is CRITICAL to ensure the MongoDB user configured via `MONGODB_URI` has minimal, read-only privileges.

Similar Servers

Stats

Interest Score0
Security Score7
Cost ClassLow
Avg Tokens500
Stars0
Forks0
Last Update2025-12-05

Tags

MongoDBMCPAI AgentDatabase ToolingDeveloper Tool