You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**Note:** When using Atlas API credentials, be sure to assign only the minimum required permissions to your service account. See [Atlas API Permissions](#atlas-api-permissions) for details.
50
+
> **🔒 Security Recommendation 1:** When using Atlas API credentials, be sure to assign only the minimum required permissions to your service account. See [Atlas API Permissions](#atlas-api-permissions) for details.
51
+
52
+
> **🔒 Security Recommendation 2:** For enhanced security, we strongly recommend using environment variables to pass sensitive configuration such as connection strings and API credentials instead of command line arguments. Command line arguments can be visible in process lists and logged in various system locations, potentially exposing your secrets. Environment variables provide a more secure way to handle sensitive information.
51
53
52
54
Most MCP clients require a configuration file to be created or modified to add the MCP server.
53
55
@@ -60,30 +62,27 @@ Note: The configuration file syntax can be different across clients. Please refe
60
62
61
63
> **Default Safety Notice:** All examples below include `--readOnly` by default to ensure safe, read-only access to your data. Remove `--readOnly` if you need to enable write operations.
62
64
63
-
#### Option 1: Connection String args
65
+
#### Option 1: Connection String
64
66
65
-
You can pass your connection string via args, make sure to use a valid username and password.
67
+
You can pass your connection string via environment variables, make sure to use a valid username and password.
You can use environment variables in the config file or set them and run the server via npx.
117
+
> **💡 Platform Note:** The examples above use Unix/Linux/macOS syntax. For Windows users, see [Environment Variables](#environment-variables) for platform-specific instructions.
127
118
119
+
- For a complete list of configuration options see [Configuration Options](#configuration-options)
120
+
- To configure your Atlas Service Accounts credentials please refer to [Atlas API Access](#atlas-api-access)
128
121
- Connection String via environment variables in the MCP file [example](#connection-string-with-environment-variables)
129
122
- Atlas API credentials via environment variables in the MCP file [example](#atlas-api-credentials-with-environment-variables)
130
123
131
-
#### Option 5: Using Docker
124
+
#### Option 4: Using Docker
132
125
133
126
You can run the MongoDB MCP Server in a Docker container, which provides isolation and doesn't require a local Node.js installation.
134
127
@@ -146,22 +139,35 @@ docker run --rm -i \
146
139
##### Option B: With MongoDB connection string
147
140
148
141
```shell
142
+
# Set your credentials as environment variables first
> **💡 Platform Note:** The examples above use Unix/Linux/macOS syntax. For Windows users, see [Environment Variables](#environment-variables) for platform-specific instructions.
153
+
155
154
##### Option C: With Atlas API credentials
156
155
157
156
```shell
157
+
# Set your credentials as environment variables first
> **💡 Platform Note:** The examples above use Unix/Linux/macOS syntax. For Windows users, see [Environment Variables](#environment-variables) for platform-specific instructions.
> **⚠️ Security Notice:** This server now supports Streamable HTTP transport for remote connections. **HTTP transport is NOT recommended for production use without implementing proper authentication and security measures.**
236
249
@@ -316,6 +329,8 @@ NOTE: atlas tools are only available when you set credentials on [configuration]
316
329
317
330
## Configuration
318
331
332
+
> **🔒 Security Best Practice:** We strongly recommend using environment variables for sensitive configuration such as API credentials (`MDB_MCP_API_CLIENT_ID`, `MDB_MCP_API_CLIENT_SECRET`) and connection strings (`MDB_MCP_CONNECTION_STRING`) instead of command-line arguments. Environment variables are not visible in process lists and provide better security for your sensitive data.
333
+
319
334
The MongoDB MCP Server can be configured using multiple methods, with the following precedence (highest to lowest):
320
335
321
336
1. Command-line arguments
@@ -361,6 +376,8 @@ You can combine multiple loggers, e.g. `--loggers disk stderr` or `export MDB_MC
361
376
export MDB_MCP_LOGGERS="disk,stderr"
362
377
```
363
378
379
+
> **💡 Platform Note:** For Windows users, see [Environment Variables](#environment-variables) for platform-specific instructions.
380
+
364
381
##### Example: Set logger via command-line argument
365
382
366
383
```shell
@@ -411,6 +428,8 @@ You can enable read-only mode using:
Pass configuration options as command-line arguments when starting the server:
553
603
604
+
> **🔒 Security Note:** For sensitive configuration like API credentials and connection strings, use environment variables instead of command-line arguments.
> **💡 Platform Note:** The examples above use Unix/Linux/macOS syntax. For Windows users, see [Environment Variables](#environment-variables) for platform-specific instructions.
617
+
558
618
#### MCP configuration file examples
559
619
560
620
##### Connection String with command-line arguments
561
621
622
+
> **🔒 Security Note:** We do not recommend passing connection string as command line argument. Connection string might contain credentials which can be visible in process lists and logged in various system locations, potentially exposing your credentials. Instead configure [connection string through environment variables](#connection-string-with-environment-variables)
##### Atlas API credentials with command-line arguments
580
642
643
+
> **🔒 Security Note:** We do not recommend passing Atlas API credentials as command line argument. The provided credentials can be visible in process lists and logged in various system locations, potentially exposing your credentials. Instead configure [Atlas API credentials through environment variables](#atlas-api-credentials-with-environment-variables)
0 commit comments