MongoDB Read-Only MCP
Read-only MongoDB access for AI clients, with database and field-level policies
MongoDB Read-Only MCP is an open-source MCP server for databases. It runs locally on your machine and is started by your AI client.
- Pricing
- Open source
- Platforms
- CLI, Self-hosted
- Runs
- Locally
- Version
- 2.0.0
- Listing updated
Similar MCP servers
Install
Add with the CLI
Run in a terminal
claude mcp add mongodb-readonly-mcp --env MONGODB_URI='<MONGODB_URI>' -- npx -y @fean-developer/mongodb-readonly-mcpAdd --scope user to use it in every project, or --scope project to share it in .mcp.json.
Or share it with your project
Add to .mcp.json
{
"mcpServers": {
"mongodb-readonly-mcp": {
"command": "npx",
"args": [
"-y",
"@fean-developer/mongodb-readonly-mcp"
],
"env": {
"MONGODB_URI": "<MONGODB_URI>"
}
}
}
}Add to claude_desktop_config.json
{
"mcpServers": {
"mongodb-readonly-mcp": {
"command": "npx",
"args": [
"-y",
"@fean-developer/mongodb-readonly-mcp"
],
"env": {
"MONGODB_URI": "<MONGODB_URI>"
}
}
}
}Settings → Developer → Edit Config, then quit and reopen Claude Desktop.
Add to ~/.cursor/mcp.json
{
"mcpServers": {
"mongodb-readonly-mcp": {
"command": "npx",
"args": [
"-y",
"@fean-developer/mongodb-readonly-mcp"
],
"env": {
"MONGODB_URI": "<MONGODB_URI>"
}
}
}
}Use .cursor/mcp.json in a project to share it with the project.
Add to ~/.copilot/mcp-config.json
{
"mcpServers": {
"mongodb-readonly-mcp": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@fean-developer/mongodb-readonly-mcp"
],
"env": {
"MONGODB_URI": "<MONGODB_URI>"
}
}
}
}Or put the same entry in .mcp.json at your workspace root to share it.
Add with the CLI
Run in a terminal
codex mcp add mongodb-readonly-mcp --env MONGODB_URI='<MONGODB_URI>' -- npx -y @fean-developer/mongodb-readonly-mcpOr add to config.toml
Add to ~/.codex/config.toml
[mcp_servers.mongodb-readonly-mcp]
command = "npx"
args = ["-y", "@fean-developer/mongodb-readonly-mcp"]
env = { MONGODB_URI = "<MONGODB_URI>" }Add to your client's MCP settings (most use this shape)
{
"mcpServers": {
"mongodb-readonly-mcp": {
"command": "npx",
"args": [
"-y",
"@fean-developer/mongodb-readonly-mcp"
],
"env": {
"MONGODB_URI": "<MONGODB_URI>"
}
}
}
}Gemini CLI and Antigravity
Gemini CLI
Add to ~/.gemini/settings.json
{ "mcpServers": { "mongodb-readonly-mcp": { "command": "npx", "args": [ "-y", "@fean-developer/mongodb-readonly-mcp" ], "env": { "MONGODB_URI": "<MONGODB_URI>" } } } }Or run: gemini mcp add -s user -e MONGODB_URI='<MONGODB_URI>' mongodb-readonly-mcp npx -- -y @fean-developer/mongodb-readonly-mcp
Antigravity
Add to ~/.gemini/config/mcp_config.json
{ "mcpServers": { "mongodb-readonly-mcp": { "command": "npx", "args": [ "-y", "@fean-developer/mongodb-readonly-mcp" ], "env": { "MONGODB_URI": "<MONGODB_URI>" } } } }Use .agents/mcp_config.json to add it to one workspace only.
Devin Desktop (formerly Windsurf)
Add to ~/.config/devin/mcp_config.json
{ "mcpServers": { "mongodb-readonly-mcp": { "command": "npx", "args": [ "-y", "@fean-developer/mongodb-readonly-mcp" ], "env": { "MONGODB_URI": "<MONGODB_URI>" } } } }On Windows the file is %APPDATA%\devin\mcp_config.json. Use .devin/mcp_config.json to share it with a project.
Cline
Add to cline_mcp_settings.json
{ "mcpServers": { "mongodb-readonly-mcp": { "command": "npx", "args": [ "-y", "@fean-developer/mongodb-readonly-mcp" ], "env": { "MONGODB_URI": "<MONGODB_URI>" } } } }Open it from the MCP Servers icon → Configure → Configure MCP Servers.
Zed
Add to Zed settings.json
{ "context_servers": { "mongodb-readonly-mcp": { "command": "npx", "args": [ "-y", "@fean-developer/mongodb-readonly-mcp" ], "env": { "MONGODB_URI": "<MONGODB_URI>" } } } }Open it with zed: open settings file. Merge context_servers into the settings you already have.
JetBrains AI Assistant and Junie
AI Assistant
Add to Settings → Tools → AI Assistant → Model Context Protocol (MCP) → Add
{ "mcpServers": { "mongodb-readonly-mcp": { "command": "npx", "args": [ "-y", "@fean-developer/mongodb-readonly-mcp" ], "env": { "MONGODB_URI": "<MONGODB_URI>" } } } }The AI Assistant docs only show command and args. If the env block is ignored, use Junie for this server.
Junie
Add to ~/.junie/mcp/mcp.json
{ "mcpServers": { "mongodb-readonly-mcp": { "command": "npx", "args": [ "-y", "@fean-developer/mongodb-readonly-mcp" ], "env": { "MONGODB_URI": "<MONGODB_URI>" } } } }Use .junie/mcp/mcp.json to share it with a project.
Kiro
Add to ~/.kiro/settings/mcp.json
{ "mcpServers": { "mongodb-readonly-mcp": { "command": "npx", "args": [ "-y", "@fean-developer/mongodb-readonly-mcp" ], "env": { "MONGODB_URI": "<MONGODB_URI>" } } } }Use .kiro/settings/mcp.json to add it to one workspace only.
Using several servers? Build one config file with the MCP config generator.
Configuration
MONGODB_MCP_PROFILEOptional profile previously saved with mongodb-readonly-mcp-configure.MONGODB_URIMongoDB URI, if not using a saved private configuration; may contain credentials.
About MongoDB Read-Only MCP
This server lets an AI client such as GitHub Copilot query MongoDB databases, collections and documents while being unable to change anything. It is written in TypeScript on Node.js and runs over stdio, so it plugs into local MCP clients through a standard npm package.
By default it blocks write commands before they reach the database, even when the connected user has write permissions. Queries still respect the MongoDB permissions of that user and any restrictions set in the configuration, and access can be limited to specific databases, collections and fields through saved profiles.
It suits developers and data analysts who want an assistant to explore data or answer questions about stored documents without giving it the ability to modify production collections.
Tools this server provides (6)
Taken from the project documentation; the running server may differ.
From the tool list in its README, going by the names, 5 of 6 tools read data; 1 name doesn't say.
From the server's own tool labels and tool names; not verified by us.
- listDatabasesName suggests: reads
- Lists the databases the user is authorized to access.
- listCollectionsName suggests: reads
- Lists the authorized collections of a database.
- findName suggests: reads
- Searches documents by filter, with projection, sorting and pagination.
- findOneName suggests: reads
- Returns one document matching the filter.
- countDocumentsName suggests: reads
- Counts documents matching the filter.
- distinct
- Returns distinct values of a field among documents matching the filter.
What it does
- Read-only query tools
- Exposes listing, find, findOne, count and distinct operations with no write or arbitrary command tools.
- Write command blocking
- Stops write commands before they reach MongoDB by default, regardless of the user's own permissions.
- Database and field policies
- Restricts which databases, collections and fields the assistant can reach through configuration.
- Saved configuration profiles
- Lets credentials and policies be stored in a profile instead of passed on every run.
- Filtered document retrieval
- Supports filters, projections, sorting and pagination when searching documents.
Good for
- Asking an AI assistant questions about data in a MongoDB collection without risking changes
- Exploring unfamiliar databases to see which collections and fields exist
- Counting or summarizing distinct values in production data for reporting
- Letting teammates query shared MongoDB data from Copilot under restricted access
Pricing
Open source
MongoDB Read-Only MCP FAQ
Can MongoDB Read-Only MCP modify data in MongoDB?
No. It only offers read tools and blocks write commands by default.
How is the server installed?
It is distributed as the npm package @fean-developer/mongodb-readonly-mcp and runs over stdio. The README links to beginner and advanced tutorials for setup.
Which MongoDB credentials are needed?
A MongoDB URI can be supplied through the MONGODB_URI variable, or a saved profile can be used instead. Queries follow the permissions of that MongoDB user.
Is MongoDB Read-Only MCP free?
Yes. MongoDB Read-Only MCP is open source, so you can use and self-host it for free.
How do I add MongoDB Read-Only MCP to Claude Code?
Run this command in your terminal: claude mcp add mongodb-readonly-mcp --env MONGODB_URI='<MONGODB_URI>' -- npx -y @fean-developer/mongodb-readonly-mcp
What are the best alternatives to MongoDB Read-Only MCP?
The closest alternatives to MongoDB Read-Only MCP are Mongodb MCP Server, Mongo Scout MCP, Custom MCP Database, Databases (read-only, switchable) and MCP DB Connect.
Where this comes from
- Description: written from the project's README and its MCP Registry entry.
- Install steps: from the official MCP Registry entry.