You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -876,6 +882,75 @@ Start by generating the backup with `mongodump`. Next, spin up a fresh MongoDB i
876
882
877
883
This approach gives you a sandbox to test complex or destructive operations against without risking accidental corruption of your live data.
878
884
885
+
### Data Protection: Data Flow Considerations
886
+
887
+
-[How Your Data Flows Through the System](#data-flow-considerations-how-your-data-flows-through-the-system)
888
+
-[Protecting Sensitive Data with Projection](#data-flow-considerations-protecting-sensitive-data-with-projection)
889
+
-[Connection Aliases and Passwords](#data-flow-considerations-connection-aliases-and-passwords)
890
+
-[Local Setup for Maximum Safety](#data-flow-considerations-local-setup-for-maximum-safety)
891
+
892
+
#### Data Flow Considerations: How Your Data Flows Through the System
893
+
894
+
When using an MCP Server with a remote LLM provider (such as Anthropic via Claude Desktop) understanding how your data moves through the system is key to protecting sensitive information from unintended exposure.
895
+
896
+
When you send a MongoDB Lens related query through your MCP client, here’s what happens:
897
+
898
+
```mermaid
899
+
sequenceDiagram
900
+
actor User
901
+
box Local Machine #d4f1f9
902
+
participant Client as MCP Client
903
+
participant Lens as MongoDB Lens
904
+
participant MongoDB as MongoDB Database
905
+
end
906
+
box Remote Server #ffe6cc
907
+
participant LLM as Remote LLM Provider
908
+
end
909
+
910
+
User->>Client: 1. Query request<br>"Show me all users older than 30"
911
+
Client->>LLM: 2. Original request + available tools
912
+
Note over LLM: Interprets request<br>Chooses appropriate tool
913
+
LLM->>Client: 3. Tool selection (find-documents)
914
+
Client->>Lens: 4. Run tool with parameters
915
+
Lens->>MongoDB: 5. Database query
916
+
MongoDB-->>Lens: 6. Query results
917
+
Lens-->>Client: 7. Tool results (formatted data)
918
+
Client->>LLM: 8. Tool results (raw data)
919
+
Note over LLM: Processes results<br>Formats response
920
+
LLM-->>Client: 9. Processed response
921
+
Client-->>User: 10. Final answer
922
+
```
923
+
924
+
1.**You sumbit a request**: e.g. _"Show me all users older than 30"_
925
+
1.**Your client sends the request to the remote LLM**: The LLM provider receives your exact words, along with a list of currently available MCP tools and their parameters.
926
+
1.**The remote LLM interprets your request**: It determines your intent and instructs the client to use a specific MCP tool, such as `find-documents`, with appropriate parameters.
927
+
1.**The client asks MongoDB Lens to run the tool**: This occurs locally on your machine via stdio.
928
+
1.**MongoDB Lens queries your MongoDB database**
929
+
1.**MongoDB Lens retreves your MongoDB query results**
930
+
1.**MongoDB Lens sends the data back to the client**: The client receives results formatted by MongoDB Lens.
931
+
1.**The client forwards the data to the remote LLM**: The LLM provider sees the exact data returned by MongoDB Lens.
932
+
1.**The remote LLM processes the data**: It may summarize or format the results further.
933
+
1.**The remote LLM sends the final response to the client**: The client displays the answer to you.
934
+
935
+
The remote LLM provider sees both your original request and the full response from MongoDB Lens. If your database includes sensitive fields (e.g. passwords, personal details, etc), this data could be unintentionally transmitted to the remote provider unless you take precautions.
936
+
937
+
#### Data Flow Considerations: Protecting Sensitive Data with Projection
938
+
939
+
To prevent sensitive data from being sent to the remote LLM provider, use the concept of projection when using tools like `find-documents`, `aggregate-data`, or `export-data`. Projection allows you to specify which fields to include or exclude in query results, ensuring sensitive information stays local.
940
+
941
+
Example projection usage:
942
+
943
+
-_"Show me all users older than 30, but use projection to hide their passwords."_<br>
944
+
<sup>➥ Uses `find-documents` tool with projection</sup>
945
+
946
+
#### Data Flow Considerations: Connection Aliases and Passwords
947
+
948
+
When adding new connection aliases using the `add-connection-alias` tool, avoid added aliases to URIs that contain passwords if you're using a remote LLM provider. Since your request is sent to the LLM, any passwords in the URI could be exposed. Instead, define aliases with passwords in the MongoDB Lens [config file](#configuration-multiple-mongodb-connections), where they remain local and are not transmitted to the LLM.
949
+
950
+
#### Data Flow Considerations: Local Setup for Maximum Safety
951
+
952
+
While outside the scope of this document, for the highest level of data privacy, consider using a local MCP client paired with a locally hosted LLM model. This approach keeps all requests and data within your local environment, eliminating the risk of sensitive information being sent to a remote provider.
953
+
879
954
### Data Protection: Confirmation for Destructive Operations
880
955
881
956
MongoDB Lens implements a token-based confirmation system for potentially destructive operations, requiring a two-step process to execute tools that may otherwise result in unchecked data loss:
@@ -944,6 +1020,19 @@ MongoDB Lens includes several tools that can modify or delete data. To disable s
944
1020
}
945
1021
```
946
1022
1023
+
To disable all tools (keeping `resources` and `prompts`), set `disabled.tools` to `true`:
1024
+
1025
+
```json
1026
+
{
1027
+
"disabled": {
1028
+
"tools": true
1029
+
}
1030
+
}
1031
+
```
1032
+
1033
+
> [!NOTE]<br>
1034
+
> Resources and prompts can also be disabled via `disabled.resources` and `disabled.prompts` settings.
1035
+
947
1036
#### High-Risk Tools
948
1037
949
1038
These tools can cause immediate data loss and should be considered for disabling in sensitive environments:
@@ -995,6 +1084,30 @@ For a complete read-only configuration, disable all potentially destructive tool
995
1084
996
1085
This configuration allows MongoDB Lens to query and analyze data while preventing any modifications, providing multiple layers of protection against accidental data loss.
997
1086
1087
+
#### Selective Component Enabling
1088
+
1089
+
In addition to [disabling components](#disabling-tools), specify exactly which components should be enabled (implicitly disabling all others) using the `enabled` settings in your [configuration file](#configuration-config-file):
1090
+
1091
+
```json
1092
+
{
1093
+
"enabled": {
1094
+
"tools": [
1095
+
"use-database",
1096
+
"find-documents",
1097
+
"count-documents",
1098
+
"aggregate-data"
1099
+
]
1100
+
},
1101
+
"disabled": {
1102
+
"resources": true,
1103
+
"prompts": true
1104
+
}
1105
+
}
1106
+
```
1107
+
1108
+
> [!IMPORTANT]<br>
1109
+
> If a component appears in both `enabled` and `disabled` lists, the `enabled` setting takes precedence.
1110
+
998
1111
## Tutorial
999
1112
1000
1113
This following tutorial guides you through setting up a MongoDB container with sample data, then using MongoDB Lens to interact with it through natural language queries:
0 commit comments