Skip to content

Commit 1620e9c

Browse files
committed
chore: default examples with --readOnly
1 parent d6bd5d7 commit 1620e9c

File tree

1 file changed

+25
-13
lines changed

1 file changed

+25
-13
lines changed

README.md

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ node -v
4242

4343
### Quick Start
4444

45-
> **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.
45+
> **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.
4646
4747
Most MCP clients require a configuration file to be created or modified to add the MCP server.
4848

@@ -66,7 +66,8 @@ You can pass your connection string via args, make sure to use a valid username
6666
"-y",
6767
"mongodb-mcp-server",
6868
"--connectionString",
69-
"mongodb://localhost:27017/myDatabase"
69+
"mongodb://localhost:27017/myDatabase",
70+
"--readOnly"
7071
]
7172
}
7273
}
@@ -90,7 +91,8 @@ Use your Atlas API Service Accounts credentials. Must follow all the steps in [A
9091
"--apiClientId",
9192
"your-atlas-service-accounts-client-id",
9293
"--apiClientSecret",
93-
"your-atlas-service-accounts-client-secret"
94+
"your-atlas-service-accounts-client-secret",
95+
"--readOnly"
9496
]
9597
}
9698
}
@@ -102,7 +104,7 @@ Use your Atlas API Service Accounts credentials. Must follow all the steps in [A
102104
Start Server using npx command:
103105

104106
```shell
105-
npx -y mongodb-mcp-server --apiClientId="your-atlas-service-accounts-client-id" --apiClientSecret="your-atlas-service-accounts-client-secret"
107+
npx -y mongodb-mcp-server --apiClientId="your-atlas-service-accounts-client-id" --apiClientSecret="your-atlas-service-accounts-client-secret" --readOnly
106108
```
107109

108110
- For a complete list of arguments see [Configuration Options](#configuration-options)
@@ -111,7 +113,7 @@ Start Server using npx command:
111113
#### Option 4: Standalone Service using environment variables
112114

113115
```shell
114-
npx -y mongodb-mcp-server
116+
npx -y mongodb-mcp-server --readOnly
115117
```
116118

117119
You can use environment variables in the config file or set them and run the server via npx.
@@ -131,15 +133,15 @@ You may provide either a MongoDB connection string OR Atlas API credentials:
131133

132134
```shell
133135
docker run --rm -i \
134-
mongodb/mongodb-mcp-server:latest
136+
mongodb/mongodb-mcp-server:latest --readOnly
135137
```
136138

137139
##### Option B: With MongoDB connection string
138140

139141
```shell
140142
docker run --rm -i \
141143
-e MDB_MCP_CONNECTION_STRING="mongodb+srv://username:[email protected]/myDatabase" \
142-
mongodb/mongodb-mcp-server:latest
144+
mongodb/mongodb-mcp-server:latest --readOnly
143145
```
144146

145147
##### Option C: With Atlas API credentials
@@ -148,7 +150,7 @@ docker run --rm -i \
148150
docker run --rm -i \
149151
-e MDB_MCP_API_CLIENT_ID="your-atlas-service-accounts-client-id" \
150152
-e MDB_MCP_API_CLIENT_SECRET="your-atlas-service-accounts-client-secret" \
151-
mongodb/mongodb-mcp-server:latest
153+
mongodb/mongodb-mcp-server:latest --readOnly
152154
```
153155

154156
##### Docker in MCP Configuration File
@@ -160,7 +162,13 @@ Without options:
160162
"mcpServers": {
161163
"MongoDB": {
162164
"command": "docker",
163-
"args": ["run", "--rm", "-i", "mongodb/mongodb-mcp-server:latest"]
165+
"args": [
166+
"run",
167+
"--rm",
168+
"-i",
169+
"mongodb/mongodb-mcp-server:latest",
170+
"--readOnly"
171+
]
164172
}
165173
}
166174
}
@@ -179,7 +187,8 @@ With connection string:
179187
"-i",
180188
"-e",
181189
"MDB_MCP_CONNECTION_STRING=mongodb+srv://username:[email protected]/myDatabase",
182-
"mongodb/mongodb-mcp-server:latest"
190+
"mongodb/mongodb-mcp-server:latest",
191+
"--readOnly"
183192
]
184193
}
185194
}
@@ -201,7 +210,8 @@ With Atlas API credentials:
201210
"MDB_MCP_API_CLIENT_ID=your-atlas-service-accounts-client-id",
202211
"-e",
203212
"MDB_MCP_API_CLIENT_SECRET=your-atlas-service-accounts-client-secret",
204-
"mongodb/mongodb-mcp-server:latest"
213+
"mongodb/mongodb-mcp-server:latest",
214+
"--readOnly"
205215
]
206216
}
207217
}
@@ -462,7 +472,8 @@ npx -y mongodb-mcp-server --apiClientId="your-atlas-service-accounts-client-id"
462472
"-y",
463473
"mongodb-mcp-server",
464474
"--connectionString",
465-
"mongodb+srv://username:[email protected]/myDatabase"
475+
"mongodb+srv://username:[email protected]/myDatabase",
476+
"--readOnly"
466477
]
467478
}
468479
}
@@ -482,7 +493,8 @@ npx -y mongodb-mcp-server --apiClientId="your-atlas-service-accounts-client-id"
482493
"--apiClientId",
483494
"your-atlas-service-accounts-client-id",
484495
"--apiClientSecret",
485-
"your-atlas-service-accounts-client-secret"
496+
"your-atlas-service-accounts-client-secret",
497+
"--readOnly"
486498
]
487499
}
488500
}

0 commit comments

Comments
 (0)