Skip to content

Commit 10a6256

Browse files
committed
Merge branch 'release/7.1.1'
2 parents 204aa11 + a1698fe commit 10a6256

3 files changed

Lines changed: 63 additions & 53 deletions

File tree

README.md

Lines changed: 60 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@
110110

111111
### Other Features
112112

113-
- [Other Features: Overview](#other-features-overview)
114-
- [Other Features: New Database Metadata](#other-features-new-database-metadata)
115-
- [Other Features: MongoDB Version Compatibility](#other-features-mongodb-version-compatibility)
113+
- [Overview](#other-features-overview)
114+
- [New Database Metadata](#other-features-new-database-metadata)
115+
- [MongoDB Version Compatibility](#other-features-mongodb-version-compatibility)
116116

117117
#### Other Features: Overview
118118

@@ -121,17 +121,15 @@ MongoDB Lens includes several additional features:
121121
- **Configuration File**: Custom configuration via `~/.mongodb-lens.json`
122122
- **Connection Resilience**: Automatic reconnection with exponential backoff
123123
- **Component Disabling**: Selectively disable specific tools, prompts or resources
124-
- **Smart Caching**: Enhanced caching for schemas, collection lists, and server status
125124
- **JSONRPC Error Handling**: Comprehensive error handling with proper error codes
125+
- **Smart Caching**: Optimized caching for schemas, indexes, fields, collections and more
126126
- **Memory Management**: Automatic memory monitoring and cleanup for large operations
127127

128128
#### Other Features: New Database Metadata
129129

130-
When MongoDB Lens creates a new database it adds a `metadata` collection containing a single document. This serves several purposes:
130+
MongoDB Lens inserts a `metadata` collection into each database it creates.
131131

132-
- MongoDB only persists databases containing at least one collection
133-
- Records database creation details (timestamp, tool version, user)
134-
- Captures environment information for your own diagnostics
132+
This `metadata` collection stores a single document containing contextual information serving as a permanent record of the database's origin while ensuring the new and otherwise empty database persists in MongoDB's storage system.
135133

136134
<details>
137135
<summary><strong>Example metadata document</strong></summary>
@@ -169,7 +167,10 @@ When MongoDB Lens creates a new database it adds a `metadata` collection contain
169167

170168
</details>
171169

172-
You can safely remove this collection once you've added your own collections to the new database.
170+
Once you've added your own collections to your new database, you can safely remove the `metadata` collection via the `drop-collection` tool:
171+
172+
- _"Drop the new database's metadata collection"_<br>
173+
<sup>➥ Uses `drop-collection` tool (with confirmation)</sup>
173174

174175
#### Other Features: MongoDB Version Compatibility
175176

@@ -190,17 +191,25 @@ MongoDB Lens can be installed and run in several ways:
190191
> [!NOTE]<br>
191192
> NPX requires [Node.js](https://nodejs.org/en/download) installed and running on your system (suggestion: use [Volta](https://volta.sh)).
192193
193-
The easiest way to run MongoDB Lens is using `npx`:
194+
The easiest way to run MongoDB Lens is using `npx`.
195+
196+
First, ensure Node.js is installed:
194197

195198
```console
196-
# Ensure Node.js is installed
197199
node --version # Ideally >= v22.x but MongoDB Lens is >= v18.x compatible
200+
```
201+
202+
Then, run MongoDB Lens via NPX:
198203

204+
```console
199205
# Using default connection string mongodb://localhost:27017
200206
npx -y mongodb-lens
201207

202208
# Using custom connection string
203209
npx -y mongodb-lens mongodb://your-connection-string
210+
211+
# Using "@latest" to keep the package up-to-date
212+
npx -y mongodb-lens@latest
204213
```
205214

206215
> [!TIP]<br>
@@ -211,7 +220,13 @@ npx -y mongodb-lens mongodb://your-connection-string
211220
> [!NOTE]<br>
212221
> Docker Hub requires [Docker](https://docs.docker.com/get-started/get-docker) installed and running on your system.
213222
214-
Run MongoDB Lens via Docker Hub:
223+
First, ensure Docker is installed:
224+
225+
```console
226+
docker --version # Ideally >= v27.x
227+
```
228+
229+
Then, run MongoDB Lens via Docker Hub:
215230

216231
```console
217232
# Using default connection string mongodb://localhost:27017
@@ -267,6 +282,10 @@ docker run --rm -i --network=host --pull=always furey/mongodb-lens
267282
```console
268283
cd /path/to/mongodb-lens
269284
```
285+
1. Ensure Docker is installed:<br>
286+
```console
287+
docker --version # Ideally >= v27.x
288+
```
270289
1. Build the Docker image:<br>
271290
```console
272291
docker build -t mongodb-lens .
@@ -310,7 +329,7 @@ The server accepts a MongoDB connection string as its only argument.
310329
Example NPX usage:
311330

312331
```console
313-
npx -y mongodb-lens mongodb://your-connection-string
332+
npx -y mongodb-lens@latest mongodb://your-connection-string
314333
```
315334

316335
MongoDB connection strings have the following format:
@@ -332,7 +351,7 @@ If no connection string is provided, the server will attempt to connect via loca
332351

333352
### Configuration: Config File
334353

335-
MongoDB Lens supports extensive customization via JSON config file.
354+
MongoDB Lens supports extensive customization via JSON configuration file.
336355

337356
> [!NOTE]<br>
338357
> The config file is optional. MongoDB Lens will run with default settings if no config file is provided.
@@ -437,13 +456,13 @@ To customize the config file path, set the environment variable `CONFIG_PATH` to
437456
Example NPX usage:
438457

439458
```console
440-
CONFIG_PATH='/path/to/config.json' npx -y mongodb-lens
459+
CONFIG_PATH='/path/to/config.json' npx -y mongodb-lens@latest
441460
```
442461

443462
Example Docker Hub usage:
444463

445464
```console
446-
docker run --rm -i --network=host -v /path/to/config.json:/root/.mongodb-lens.json furey/mongodb-lens
465+
docker run --rm -i --network=host --pull=always -v /path/to/config.json:/root/.mongodb-lens.json furey/mongodb-lens
447466
```
448467

449468
### Configuration: Environment Variable Overrides
@@ -460,8 +479,6 @@ CONFIG_[SETTING PATH, SNAKE CASED, UPPERCASED]
460479

461480
Example overrides:
462481

463-
<small><small>
464-
465482
| Config Setting | Environment Variable Override |
466483
| -------------------------------- | ----------------------------------------- |
467484
| `mongoUri` | `CONFIG_MONGO_URI` |
@@ -472,8 +489,6 @@ Example overrides:
472489
| `defaults.queryLimit` | `CONFIG_DEFAULTS_QUERY_LIMIT` |
473490
| `tools.export.defaultFormat` | `CONFIG_TOOLS_EXPORT_DEFAULT_FORMAT` |
474491

475-
</small></small>
476-
477492
For environment variable values:
478493

479494
- For boolean settings, use string values `'true'` or `'false'`.
@@ -483,13 +498,13 @@ For environment variable values:
483498
Example NPX usage:
484499

485500
```console
486-
CONFIG_DEFAULTS_QUERY_LIMIT='25' npx -y mongodb-lens
501+
CONFIG_DEFAULTS_QUERY_LIMIT='25' npx -y mongodb-lens@latest
487502
```
488503

489504
Example Docker Hub usage:
490505

491506
```console
492-
docker run --rm -i --network=host -e CONFIG_DEFAULTS_QUERY_LIMIT='25' furey/mongodb-lens
507+
docker run --rm -i --network=host --pull=always -e CONFIG_DEFAULTS_QUERY_LIMIT='25' furey/mongodb-lens
493508
```
494509

495510
### Configuration: Multiple MongoDB Connections
@@ -513,9 +528,7 @@ With this configuration:
513528
- The first URI in the list (e.g. `main`) becomes the default connection at startup
514529
- You can switch connections using natural language: `"Connect to backup"` or `"Connect to atlas"`
515530
- The original syntax still works: `"Connect to mongodb://localhost:27018"`
516-
- The new `list-connections` tool shows all available connection aliases
517-
518-
This feature makes it easier to manage connections to different environments (development, testing, production) or to switch between primary and replica databases.
531+
- The `list-connections` tool shows all available connection aliases
519532

520533
> [!NOTE]<br>
521534
> When using the command-line argument to specify a connection, you can use either a full MongoDB URI or an alias defined in your configuration file.
@@ -555,25 +568,26 @@ For each option:
555568
"command": "/path/to/npx",
556569
"args": [
557570
"-y",
558-
"mongodb-lens",
571+
"mongodb-lens@latest",
559572
"mongodb://your-connection-string"
560573
],
561574
"env": {
562-
"CONFIG_LOG_LEVEL": "verbose",
563-
"CONFIG_DEFAULT_DB_NAME": "analytics",
564-
"CONFIG_CONNECTION_OPTIONS_MAX_POOL_SIZE": "30"
575+
"CONFIG_LOG_LEVEL": "verbose"
565576
}
566577
```
567578
- For Docker add `-e` flags, for example:<br>
568-
```console
569-
docker run --rm -i --network=host \
570-
-e CONFIG_LOG_LEVEL='verbose' \
571-
-e CONFIG_DEFAULT_DB_NAME='analytics' \
572-
-e CONFIG_CONNECTION_OPTIONS_MAX_POOL_SIZE='30' \
573-
furey/mongodb-lens
579+
```json
580+
"command": "docker",
581+
"args": [
582+
"run", "--rm", "-i",
583+
"--network=host",
584+
"--pull=always",
585+
"-e", "CONFIG_LOG_LEVEL='verbose'",
586+
"furey/mongodb-lens",
587+
"mongodb://your-connection-string"
588+
]
574589
```
575590

576-
577591
##### Option 1: NPX (Recommended)
578592

579593
```json
@@ -583,7 +597,7 @@ For each option:
583597
"command": "/path/to/npx",
584598
"args": [
585599
"-y",
586-
"mongodb-lens",
600+
"mongodb-lens@latest",
587601
"mongodb://your-connection-string"
588602
]
589603
}
@@ -599,9 +613,7 @@ For each option:
599613
"mongodb-lens": {
600614
"command": "docker",
601615
"args": [
602-
"run",
603-
"--rm",
604-
"-i",
616+
"run", "--rm", "-i",
605617
"--network=host",
606618
"--pull=always",
607619
"furey/mongodb-lens",
@@ -636,9 +648,7 @@ For each option:
636648
"mongodb-lens": {
637649
"command": "docker",
638650
"args": [
639-
"run",
640-
"--rm",
641-
"-i",
651+
"run", "--rm", "-i",
642652
"--network=host",
643653
"mongodb-lens",
644654
"mongodb://your-connection-string"
@@ -660,13 +670,13 @@ Example NPX usage:
660670
1. Run MCP Inspector:<br>
661671
```console
662672
# Using default connection string mongodb://localhost:27017
663-
npx -y @modelcontextprotocol/inspector npx -y mongodb-lens
673+
npx -y @modelcontextprotocol/inspector npx -y mongodb-lens@latest
664674

665675
# Using custom connection string
666-
npx -y @modelcontextprotocol/inspector npx -y mongodb-lens mongodb://your-connection-string
676+
npx -y @modelcontextprotocol/inspector npx -y mongodb-lens@latest mongodb://your-connection-string
667677

668678
# Using custom ports
669-
SERVER_PORT=1234 CLIENT_PORT=5678 npx -y @modelcontextprotocol/inspector npx -y mongodb-lens
679+
SERVER_PORT=1234 CLIENT_PORT=5678 npx -y @modelcontextprotocol/inspector npx -y mongodb-lens@latest
670680
```
671681
1. Open MCP Inspector: http://localhost:5173
672682

@@ -728,7 +738,7 @@ MongoDB Lens implements a token-based confirmation system for potentially destru
728738
1. First tool invocation: Returns a 4-digit confirmation token that expires after 5 minutes
729739
1. Second tool invocation: Executes the operation if provided with the valid token
730740

731-
For an example of the confirmation process, see: [Working with Confirmation Protection](#tutorial-5-working-with-confirmation-protection).
741+
For an example of the confirmation process, see: [Working with Confirmation Protection](#tutorial-5-working-with-confirmation-protection)
732742

733743
Tools that require confirmation include:
734744

@@ -753,10 +763,10 @@ Set the environment variable `CONFIG_DISABLE_DESTRUCTIVE_OPERATION_TOKENS` to `t
753763

754764
```console
755765
# Using NPX
756-
CONFIG_DISABLE_DESTRUCTIVE_OPERATION_TOKENS=true npx -y mongodb-lens
766+
CONFIG_DISABLE_DESTRUCTIVE_OPERATION_TOKENS=true npx -y mongodb-lens@latest
757767

758768
# Using Docker
759-
docker run --rm -i --network=host -e CONFIG_DISABLE_DESTRUCTIVE_OPERATION_TOKENS='true' furey/mongodb-lens
769+
docker run --rm -i --network=host --pull=always -e CONFIG_DISABLE_DESTRUCTIVE_OPERATION_TOKENS='true' furey/mongodb-lens
760770
```
761771

762772
> [!WARNING]<br>
@@ -912,7 +922,7 @@ Example [Claude Desktop configuration](#client-setup-claude-desktop):
912922
"command": "/path/to/npx",
913923
"args": [
914924
"-y",
915-
"mongodb-lens"
925+
"mongodb-lens@latest"
916926
]
917927
}
918928
}

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mongodb-lens",
3-
"version": "7.1.0",
3+
"version": "7.1.1",
44
"author": "James Furey (https://about.me/jamesfurey)",
55
"description": "MongoDB Lens: Full Featured MCP Server for MongoDB Databases",
66
"license": "MIT",

0 commit comments

Comments
 (0)