Skip to content

Commit 735d1dd

Browse files
committed
update
1 parent b4f0395 commit 735d1dd

File tree

1 file changed

+96
-15
lines changed

1 file changed

+96
-15
lines changed

README.md

Lines changed: 96 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,32 +35,33 @@ A Model Context Protocol server for interacting with MongoDB Atlas. This project
3535
Common prerequisites:
3636

3737
- Node.js v20.x
38-
- A MongoDB connection string or Atlas API credentials
38+
- A MongoDB connection string or Atlas API credentials, the Server will not start unless configured, see [configuration](#configuration) section for more details.
3939

4040
### WindSurf
4141

4242
The latest instructions can be found at https://docs.windsurf.com/windsurf/mcp
4343

4444
Step 1: Create MCP configuration file
4545

46-
4746
Create or edit the configuration file at `~/.codeium/windsurf/mcp_config.json`:
4847

4948
```json
5049
{
5150
"servers": {
5251
"MongoDB": {
5352
"command": "npx",
54-
"args": [
55-
"-y",
56-
"mongodb-mcp-server"
57-
]
53+
"args": ["-y", "mongodb-mcp-server"]
5854
}
5955
}
6056
}
6157
```
6258

63-
Step 2: Follow the [configuration](#configuration) section for more details on how to connect to a MongoDB instance or Atlas.
59+
Step 2: Setup a connection string or Atlas API credentials
60+
61+
- Option 1: Connection String via args [example](#connection-string-with-args)
62+
- Option 2: Atlas API credentials via args [example](#atlas-api-credentials-with-args)
63+
- Option 3: Connection String via environment variables [example](#connection-string-with-environment-variables)
64+
- Option 4: Atlas API credentials via environment variables [example](#atlas-api-credentials-with-environment-variables)
6465

6566
### VSCode
6667

@@ -89,16 +90,16 @@ Note: the file should look like:
8990
}
9091
```
9192

92-
Step 2: Follow the [configuration](#configuration) section for more details on how to connect to a MongoDB instance or Atlas.
93+
Step 2: Setup a connection string or Atlas API credentials
9394

95+
- Option 1: Connection String via args [example](#connection-string-with-args)
96+
- Option 2: Atlas API credentials via args [example](#atlas-api-credentials-with-args)
97+
- Option 3: Connection String via environment variables [example](#connection-string-with-environment-variables)
98+
- Option 4: Atlas API credentials via environment variables [example](#atlas-api-credentials-with-environment-variables)
9499

95100
### Claude Desktop
96101

97-
Step 1: Install claude and login
98-
99-
Note: follow instructions at https://claude.ai/download
100-
101-
Step 2: Launch Claude Settings -> Developer -> Edit Config
102+
Step 1: Launch Claude Settings -> Developer -> Edit Config
102103

103104
Paste the mcp server configuration into the file
104105

@@ -113,9 +114,12 @@ Paste the mcp server configuration into the file
113114
}
114115
```
115116

116-
Step 3: Close and Relaunch Claude Desktop and click on the hammer icon, the MongoDB MCP server should be detected.
117+
Step 2: Setup a connection string or Atlas API credentials
117118

118-
Follow the [configuration](#configuration) section for more details on how to connect to a MongoDB instance or Atlas.
119+
- Option 1: Connection String via args [example](#connection-string-with-args)
120+
- Option 2: Atlas API credentials via args [example](#atlas-api-credentials-with-args)
121+
- Option 3: Connection String via environment variables [example](#connection-string-with-environment-variables)
122+
- Option 4: Atlas API credentials via environment variables [example](#atlas-api-credentials-with-environment-variables)
119123

120124
## 🛠️ Supported Tools
121125

@@ -275,6 +279,41 @@ export MDB_MCP_LOG_PATH="/path/to/logs"
275279

276280
```
277281

282+
#### MCP configuration file examples
283+
284+
##### Connection String with environment variables
285+
286+
```json
287+
{
288+
"servers": {
289+
"MongoDB": {
290+
"command": "npx",
291+
"args": ["-y", "mongodb-mcp-server"],
292+
"env": {
293+
"MDB_MCP_CONNECTION_STRING": "mongodb+srv://username:[email protected]/myDatabase"
294+
}
295+
}
296+
}
297+
}
298+
```
299+
300+
##### Atlas API credentials with environment variables
301+
302+
```json
303+
{
304+
"servers": {
305+
"MongoDB": {
306+
"command": "npx",
307+
"args": ["-y", "mongodb-mcp-server"],
308+
"env": {
309+
"MDB_MCP_API_CLIENT_ID": "your-atlas-client-id",
310+
"MDB_MCP_API_CLIENT_SECRET": "your-atlas-client-secret"
311+
}
312+
}
313+
}
314+
}
315+
```
316+
278317
#### Command-Line Arguments
279318

280319
Pass configuration options as command-line arguments when starting the server:
@@ -283,6 +322,48 @@ Pass configuration options as command-line arguments when starting the server:
283322
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
284323
```
285324

325+
#### MCP configuration file examples
326+
327+
##### Connection String with command-line arguments
328+
329+
```json
330+
{
331+
"servers": {
332+
"MongoDB": {
333+
"command": "npx",
334+
"args": [
335+
"-y",
336+
"mongodb-mcp-server",
337+
"--connectionString",
338+
"mongodb+srv://username:[email protected]/myDatabase",
339+
"--logPath",
340+
"/path/to/logs"
341+
]
342+
}
343+
}
344+
}
345+
```
346+
347+
##### Atlas API credentials with command-line arguments
348+
349+
```json
350+
{
351+
"servers": {
352+
"MongoDB": {
353+
"command": "npx",
354+
"args": [
355+
"-y",
356+
"mongodb-mcp-server",
357+
"--apiClientId",
358+
"your-atlas-client-id",
359+
"--apiClientSecret",
360+
"your-atlas-client-secret"
361+
]
362+
}
363+
}
364+
}
365+
```
366+
286367
## 🤝 Contributing
287368

288369
Interested in contributing? Great! Please check our [Contributing Guide](CONTRIBUTING.md) for guidelines on code contributions, standards, adding new tools, and troubleshooting information.

0 commit comments

Comments
 (0)