@@ -38,7 +38,7 @@ node -v
38
38
39
39
Most MCP clients require a configuration file to be created or modified to add the MCP server.
40
40
41
- - ** Windsurf** :https://docs.windsurf.com/windsurf/mcp
41
+ - ** Windsurf** : https://docs.windsurf.com/windsurf/mcp
42
42
- ** VSCode** : https://docs.codeium.com/docs/mcp
43
43
- ** Claude Desktop** : https://modelcontextprotocol.io/quickstart/user
44
44
- ** Cursor** : https://docs.cursor.com/context/model-context-protocol
@@ -89,8 +89,9 @@ Use your Atlas API Service Account credentials. More details in the [Atlas API A
89
89
90
90
Alternatively you can use environment variables in the config file or set them and run the server via npx.
91
91
92
- - Connection String via environment variables in the MCP file [ example] ( #connection-string-with-environment-variables )
93
- - Atlas API credentials via environment variables in the MCP file [ example] ( #atlas-api-credentials-with-environment-variables )
92
+ - Connection String via environment variables in the MCP file [ example] ( #connection-string-configuration )
93
+ - Atlas API credentials via environment variables in the MCP file [ example] ( #atlas-api-credentials-configuration )
94
+ - Set env variables and run the server directly [ example] ( #environment-variables )
94
95
95
96
## 🛠️ Supported Tools
96
97
@@ -220,6 +221,9 @@ To use the Atlas API tools, you'll need to create a service account in MongoDB A
220
221
- Select appropriate permissions (for full access, use Organization Owner)
221
222
- Click "Create"
222
223
224
+ To learn more about Service Accounts, check the [ MongoDB Atlas documentation] ( https://www.mongodb.com/docs/atlas/api/service-accounts-overview/ ) .
225
+
226
+
223
227
2 . ** Save Client Credentials:**
224
228
225
229
- After creation, you'll be shown the Client ID and Client Secret
@@ -234,6 +238,11 @@ To use the Atlas API tools, you'll need to create a service account in MongoDB A
234
238
235
239
### Configuration Methods
236
240
241
+ There are multiple ways to configure the MongoDB MCP Server. You can use:
242
+ 1 . Environment variables
243
+ 2 . Command-line arguments
244
+ 3 . MCP client configuration files with either method
245
+
237
246
#### Environment Variables
238
247
239
248
Set environment variables with the prefix ` MDB_MCP_ ` followed by the option name in uppercase with underscores:
@@ -247,12 +256,33 @@ export MDB_MCP_API_CLIENT_SECRET="your-atlas-client-secret"
247
256
export MDB_MCP_CONNECTION_STRING=
" mongodb+srv://username:[email protected] /myDatabase"
248
257
249
258
export MDB_MCP_LOG_PATH=" /path/to/logs"
259
+ ```
260
+
261
+ You can also set environment variables and run the server directly:
262
+
263
+ ``` shell
264
+ export MDB_MCP_API_CLIENT_ID=" your-atlas-client-id"
265
+ export MDB_MCP_API_CLIENT_SECRET=" your-atlas-client-secret"
266
+ export MDB_MCP_CONNECTION_STRING=
" mongodb+srv://username:[email protected] /myDatabase"
267
+
268
+ npx -y mongodb-mcp-server
269
+ ```
270
+
271
+ #### Command-Line Arguments
250
272
273
+ Pass configuration options as command-line arguments when starting the server:
274
+
275
+ ``` shell
276
+ 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
251
277
```
252
278
253
- #### MCP configuration file examples
279
+ #### MCP Client Configuration Examples
254
280
255
- ##### Connection String with environment variables
281
+ The examples below show how to configure various MCP clients with different configuration methods.
282
+
283
+ ##### Using Environment Variables in MCP Configuration
284
+
285
+ ###### Connection String Configuration
256
286
257
287
``` json
258
288
{
@@ -268,7 +298,7 @@ export MDB_MCP_LOG_PATH="/path/to/logs"
268
298
}
269
299
```
270
300
271
- ##### Atlas API credentials with environment variables
301
+ ###### Atlas API Credentials Configuration
272
302
273
303
``` json
274
304
{
@@ -285,17 +315,9 @@ export MDB_MCP_LOG_PATH="/path/to/logs"
285
315
}
286
316
```
287
317
288
- #### Command-Line Arguments
289
-
290
- Pass configuration options as command-line arguments when starting the server:
291
-
292
- ``` shell
293
- 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
294
- ```
295
-
296
- #### MCP configuration file examples
318
+ ##### Using Command-Line Arguments in MCP Configuration
297
319
298
- ##### Connection String with command-line arguments
320
+ ###### Connection String Configuration
299
321
300
322
``` json
301
323
{
@@ -313,7 +335,7 @@ npx -y mongodb-mcp-server --apiClientId="your-atlas-client-id" --apiClientSecret
313
335
}
314
336
```
315
337
316
- ##### Atlas API credentials with command-line arguments
338
+ ###### Atlas API Credentials Configuration
317
339
318
340
``` json
319
341
{
0 commit comments