Skip to content

Commit 82a227f

Browse files
committed
add link to service accounts
1 parent 23fde12 commit 82a227f

File tree

1 file changed

+39
-17
lines changed

1 file changed

+39
-17
lines changed

README.md

Lines changed: 39 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ node -v
3838

3939
Most MCP clients require a configuration file to be created or modified to add the MCP server.
4040

41-
- **Windsurf**:https://docs.windsurf.com/windsurf/mcp
41+
- **Windsurf**: https://docs.windsurf.com/windsurf/mcp
4242
- **VSCode**: https://docs.codeium.com/docs/mcp
4343
- **Claude Desktop**: https://modelcontextprotocol.io/quickstart/user
4444
- **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
8989

9090
Alternatively you can use environment variables in the config file or set them and run the server via npx.
9191

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)
9495

9596
## 🛠️ Supported Tools
9697

@@ -220,6 +221,9 @@ To use the Atlas API tools, you'll need to create a service account in MongoDB A
220221
- Select appropriate permissions (for full access, use Organization Owner)
221222
- Click "Create"
222223

224+
To learn more about Service Accounts, check the [MongoDB Atlas documentation](https://www.mongodb.com/docs/atlas/api/service-accounts-overview/).
225+
226+
223227
2. **Save Client Credentials:**
224228

225229
- 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
234238

235239
### Configuration Methods
236240

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+
237246
#### Environment Variables
238247

239248
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"
247256
export MDB_MCP_CONNECTION_STRING="mongodb+srv://username:[email protected]/myDatabase"
248257

249258
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
250272

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
251277
```
252278

253-
#### MCP configuration file examples
279+
#### MCP Client Configuration Examples
254280

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
256286

257287
```json
258288
{
@@ -268,7 +298,7 @@ export MDB_MCP_LOG_PATH="/path/to/logs"
268298
}
269299
```
270300

271-
##### Atlas API credentials with environment variables
301+
###### Atlas API Credentials Configuration
272302

273303
```json
274304
{
@@ -285,17 +315,9 @@ export MDB_MCP_LOG_PATH="/path/to/logs"
285315
}
286316
```
287317

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
297319

298-
##### Connection String with command-line arguments
320+
###### Connection String Configuration
299321

300322
```json
301323
{
@@ -313,7 +335,7 @@ npx -y mongodb-mcp-server --apiClientId="your-atlas-client-id" --apiClientSecret
313335
}
314336
```
315337

316-
##### Atlas API credentials with command-line arguments
338+
###### Atlas API Credentials Configuration
317339

318340
```json
319341
{

0 commit comments

Comments
 (0)