-
Notifications
You must be signed in to change notification settings - Fork 96
chore: update config docs #170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 9 commits
c5d5c13
b4f0395
735d1dd
1fb6375
525e589
240e199
6282952
aa4bf7b
484390d
78705ad
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,96 +1,96 @@ | ||||||
# MongoDB MCP Server | ||||||
|
||||||
A Model Context Protocol server for interacting with MongoDB Atlas. This project implements a Model Context Protocol (MCP) server enabling AI assistants to interact with MongoDB Atlas resources through natural language. | ||||||
|
||||||
> [!CAUTION] | ||||||
> Do not use this in production. This is a work in progress and is not intended for production use. It is meant for demonstration purposes only. | ||||||
A Model Context Protocol server for interacting with MongoDB Databases and MongoDB Atlas. | ||||||
|
||||||
## 📚 Table of Contents | ||||||
|
||||||
- [🚀 Getting Started](#getting-started) | ||||||
- [Prerequisites](#prerequisites) | ||||||
- [Installation](#installation) | ||||||
- [VSCode](#vscode) | ||||||
- [Claude Desktop](#claude) | ||||||
- [Setup](#setup) | ||||||
- [Quick Start](#quick-start) | ||||||
- [🛠️ Supported Tools](#supported-tools) | ||||||
- [Tool List](#tool-list) | ||||||
- [MongoDB Atlas Tools](#mongodb-atlas-tools) | ||||||
- [MongoDB Database Tools](#mongodb-database-tools) | ||||||
- [⚙️ Configuration](#configuration) | ||||||
- [Configuration Options](#configuration-options) | ||||||
- [Atlas API Access](#atlas-api-access) | ||||||
- [Configuration Methods](#configuration-methods) | ||||||
- [👩💻 Client Integration](#client-integration) | ||||||
- [VSCode](#vscode) | ||||||
- [Claude](#claude) | ||||||
- [Environment Variables](#environment-variables) | ||||||
- [Command-Line Arguments](#command-line-arguments) | ||||||
- [MCP Client Configuration](#mcp-configuration-file-examples) | ||||||
- [🤝 Contributing](#contributing) | ||||||
|
||||||
## Prerequisites | ||||||
|
||||||
- Node.js (v20 or later) | ||||||
- MongoDB Atlas account | ||||||
|
||||||
## Installation | ||||||
```shell | ||||||
node -v | ||||||
``` | ||||||
|
||||||
### VSCode | ||||||
- A MongoDB connection string or Atlas API credentials, **_the Server will not start unless configured_**. | ||||||
- **_Atlas API credentials_** are required to use the Atlas tools. You can create a service account in MongoDB Atlas and use its credentials for authentication. See [Atlas API Access](#atlas-api-access) for more details. | ||||||
- If you have a MongoDB connection string, you can use it directly to connect to your MongoDB instance. | ||||||
|
||||||
Prerequisites: | ||||||
## Setup | ||||||
|
||||||
- Node.js v20.x | ||||||
### Quick Start | ||||||
|
||||||
Step 1: Add the mcp server to VSCode configuration | ||||||
Most MCP clients require a configuration file to be created or modified to add the MCP server. | ||||||
|
||||||
- Press `Cmd + Shift + P` and type `MCP: Add MCP Server` and select it. | ||||||
- Select command (Stdio). | ||||||
- Input command `npx -y mongodb-mcp-server`. | ||||||
- Choose between user / workspace | ||||||
- Add arguments to the file | ||||||
- **Windsurf**: On MacOS, save the file in `~/.codeium/windsurf/mcp_config.json` or check the[latest instructions](https://docs.windsurf.com/windsurf/mcp) for your environment | ||||||
- **VSCode**: https://docs.codeium.com/docs/mcp | ||||||
- **Claude Desktop**: https://modelcontextprotocol.io/quickstart/user | ||||||
- **Cursor**: follow https://docs.cursor.com/context/model-context-protocol | ||||||
|
||||||
Note: the file should look like: | ||||||
#### Option 1: Connection String args | ||||||
|
||||||
``` | ||||||
You can pass your connection string via args, make sure to use a valid username and password. | ||||||
|
||||||
```json | ||||||
{ | ||||||
"servers": { | ||||||
"MongoDB": { | ||||||
"type": "stdio", | ||||||
"command": "npx", | ||||||
"args": [ | ||||||
"-y", | ||||||
"mongodb-mcp-server" | ||||||
] | ||||||
} | ||||||
"servers": { | ||||||
"MongoDB": { | ||||||
"command": "npx", | ||||||
"args": [ | ||||||
"-y", | ||||||
"mongodb-mcp-server", | ||||||
"--connectionString", | ||||||
"mongodb+srv://username:[email protected]/myDatabase" | ||||||
] | ||||||
} | ||||||
} | ||||||
} | ||||||
``` | ||||||
|
||||||
Notes: You can configure the server with atlas access, make sure to follow configuration section for more details. | ||||||
|
||||||
Step 2: Try talking to github copilot | ||||||
|
||||||
- Can you connect to my mongodb instance? | ||||||
|
||||||
### Claude Desktop | ||||||
|
||||||
Step 1: Install claude and login | ||||||
|
||||||
Note: follow instructions at https://claude.ai/download | ||||||
|
||||||
Step 2: Launch Claude Settings -> Developer -> Edit Config | ||||||
#### Option 2: Atlas API credentials args | ||||||
|
||||||
Paste the mcp server configuration into the file | ||||||
Use your Atlas API Service Account credentials. More details in the [Atlas API Access](#atlas-api-access) section. | ||||||
|
||||||
```json | ||||||
{ | ||||||
"mcpServers": { | ||||||
"servers": { | ||||||
"MongoDB": { | ||||||
"command": "npx", | ||||||
"args": ["-y", "mongodb-mcp-server"] | ||||||
"args": [ | ||||||
"-y", | ||||||
"mongodb-mcp-server", | ||||||
"--apiClientId", | ||||||
"your-atlas-client-id", | ||||||
"--apiClientSecret", | ||||||
"your-atlas-client-secret" | ||||||
] | ||||||
} | ||||||
} | ||||||
} | ||||||
``` | ||||||
|
||||||
Step 3: Close and Relaunch Claude Desktop and click on the hammer icon, the MongoDB MCP server should be detected. | ||||||
#### Other options | ||||||
|
||||||
You may experiment asking `Can you connect to my mongodb instance?`. | ||||||
Alternatively you can use environment variables in the config file or set them and run the server via npx. | ||||||
|
||||||
- Connection String via environment variables in the MCP file [example](#connection-string-with-environment-variables) | ||||||
- Atlas API credentials via environment variables in the MCP file [example](#atlas-api-credentials-with-environment-variables) | ||||||
|
||||||
## 🛠️ Supported Tools | ||||||
|
||||||
|
@@ -154,7 +154,7 @@ The MongoDB MCP Server can be configured using multiple methods, with the follow | |||||
| `readOnly` | When set to true, only allows read and metadata operation types, disabling create/update/delete operations | | ||||||
| `telemetry` | When set to disabled, disables telemetry collection | | ||||||
|
||||||
#### `logPath` | ||||||
#### Log Path | ||||||
|
||||||
Default log location is as follows: | ||||||
|
||||||
|
@@ -250,6 +250,41 @@ export MDB_MCP_LOG_PATH="/path/to/logs" | |||||
|
||||||
``` | ||||||
|
||||||
#### MCP configuration file examples | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The section title 'MCP configuration file examples' is used again at a later section (line 296). Consider consolidating these examples or using distinct subheadings to clearly differentiate between configuration methods for environment variables and command-line arguments.
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||
|
||||||
##### Connection String with environment variables | ||||||
|
||||||
```json | ||||||
{ | ||||||
"servers": { | ||||||
"MongoDB": { | ||||||
"command": "npx", | ||||||
"args": ["-y", "mongodb-mcp-server"], | ||||||
"env": { | ||||||
"MDB_MCP_CONNECTION_STRING": "mongodb+srv://username:[email protected]/myDatabase" | ||||||
} | ||||||
} | ||||||
} | ||||||
} | ||||||
``` | ||||||
|
||||||
##### Atlas API credentials with environment variables | ||||||
|
||||||
```json | ||||||
{ | ||||||
"servers": { | ||||||
"MongoDB": { | ||||||
"command": "npx", | ||||||
"args": ["-y", "mongodb-mcp-server"], | ||||||
"env": { | ||||||
"MDB_MCP_API_CLIENT_ID": "your-atlas-client-id", | ||||||
"MDB_MCP_API_CLIENT_SECRET": "your-atlas-client-secret" | ||||||
} | ||||||
} | ||||||
} | ||||||
} | ||||||
``` | ||||||
|
||||||
#### Command-Line Arguments | ||||||
|
||||||
Pass configuration options as command-line arguments when starting the server: | ||||||
|
@@ -258,6 +293,46 @@ Pass configuration options as command-line arguments when starting the server: | |||||
npx -y mongodb-mcp-server --apiClientId="your-atlas-client-id" --apiClientSecret="your-atlas-client-secret" --connectionString="mongodb+srv://username:[email protected]/myDatabase" --logPath=/path/to/logs | ||||||
``` | ||||||
|
||||||
#### MCP configuration file examples | ||||||
|
||||||
##### Connection String with command-line arguments | ||||||
|
||||||
```json | ||||||
{ | ||||||
"servers": { | ||||||
"MongoDB": { | ||||||
"command": "npx", | ||||||
"args": [ | ||||||
"-y", | ||||||
"mongodb-mcp-server", | ||||||
"--connectionString", | ||||||
"mongodb+srv://username:[email protected]/myDatabase" | ||||||
] | ||||||
} | ||||||
} | ||||||
} | ||||||
``` | ||||||
|
||||||
##### Atlas API credentials with command-line arguments | ||||||
|
||||||
```json | ||||||
{ | ||||||
"servers": { | ||||||
"MongoDB": { | ||||||
"command": "npx", | ||||||
"args": [ | ||||||
"-y", | ||||||
"mongodb-mcp-server", | ||||||
"--apiClientId", | ||||||
"your-atlas-client-id", | ||||||
"--apiClientSecret", | ||||||
"your-atlas-client-secret" | ||||||
] | ||||||
} | ||||||
} | ||||||
} | ||||||
``` | ||||||
|
||||||
## 🤝 Contributing | ||||||
|
||||||
Interested in contributing? Great! Please check our [Contributing Guide](CONTRIBUTING.md) for guidelines on code contributions, standards, adding new tools, and troubleshooting information. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[q] Windsurf is the only one that has macos instructions, is there a reason?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated