@@ -10,38 +10,88 @@ A Model Context Protocol server for interacting with MongoDB Atlas. This project
1010- [ 🚀 Getting Started] ( #getting-started )
1111 - [ Prerequisites] ( #prerequisites )
1212 - [ Installation] ( #installation )
13- - [ Running the MCP Server] ( #running-the-mcp-server )
13+ - [ VSCode] ( #vscode )
14+ - [ Claude Desktop] ( #claude )
1415- [ 🛠️ Supported Tools] ( #supported-tools )
1516 - [ Tool List] ( #tool-list )
17+ - [ ⚙️ Configuration] ( #configuration )
18+ - [ Configuration Options] ( #configuration-options )
19+ - [ Atlas API Access] ( #atlas-api-access )
20+ - [ Configuration Methods] ( #configuration-methods )
1621- [ 👩💻 Client Integration] ( #client-integration )
1722 - [ VSCode] ( #vscode )
1823 - [ Claude] ( #claude )
1924- [ 🤝 Contributing] ( #contributing )
2025
21- ## 🚀 Getting Started
22-
23- ### Prerequisites
26+ ## Prerequisites
2427
2528- Node.js (v20 or later)
2629- MongoDB Atlas account
2730
28- ### Installation
31+ ## Installation
2932
30- ``` shell
31- # Clone the repository
32- git clone https://github.com/mongodb-labs/mongodb-mcp-server.git
33- cd mongodb-mcp-server
33+ ### VSCode
34+
35+ Prerequisites:
36+
37+ - Node.js v20.x
38+
39+ Step 1: Add the mcp server to VSCode configuration
40+
41+ - Press ` Cmd + Shift + P ` and type ` MCP: Add MCP Server ` and select it.
42+ - Select command (Stdio).
43+ - Input command ` npx -y @mongodb-js/mongodb-mcp-server ` .
44+ - Choose between user / workspace
45+ - Add arguments to the file
46+
47+ Note: the file should look like:
3448
35- # Install dependencies
36- npm install
3749```
50+ {
51+ "servers": {
52+ "MongoDB": {
53+ "type": "stdio",
54+ "command": "npx",
55+ "args": [
56+ "-y",
57+ "@mongodb-js/mongodb-mcp-server"
58+ ]
59+ }
60+ }
61+ }
62+ ```
63+
64+ Notes: You can configure the server with atlas access, make sure to follow configuration section for more details.
3865
39- ### Running the MCP Server
66+ Step 2: Try talking to github copilot
4067
41- ``` shell
42- npm run build
68+ - Can you connect to my mongodb instance?
69+
70+ ### Claude Desktop
71+
72+ Step 1: Install claude and login
73+
74+ Note: follow instructions at https://claude.ai/download
75+
76+ Step 2: Launch Claude Settings -> Developer -> Edit Config
77+
78+ Paste the mcp server configuration into the file
79+
80+ ``` json
81+ {
82+ "mcpServers" : {
83+ "MongoDB" : {
84+ "command" : " npx" ,
85+ "args" : [" -y" , " @mongodb-js/mongodb-mcp-server" ]
86+ }
87+ }
88+ }
4389```
4490
91+ Step 3: Close and Relaunch Claude Desktop and click on the hammer icon, the MongoDB MCP server should be detected.
92+
93+ You may experiment asking ` Can you connect to my mongodb instance? ` .
94+
4595## 🛠️ Supported Tools
4696
4797### Tool List
@@ -80,77 +130,6 @@ npm run build
80130- ` collection-storage-size ` - Get the size of a collection in MB
81131- ` db-stats ` - Return statistics about a MongoDB database
82132
83- ## 👩💻 Client Integration (Use the server!)
84-
85- ### VSCode
86-
87- Prerequisites:
88-
89- - Use VSCode Insiders (https://code.visualstudio.com/insiders/ )
90- - Setup copilot in VSCode Insiders
91-
92- Step 1: Add the mcp server to VSCode configuration
93-
94- - Press ` Cmd + Shift + P ` and type ` MCP: Add MCP Server ` and select it.
95- - Select the first option for a local MCP server.
96- - Add the path to dist/index.js in the prompt
97-
98- Step 2: Verify the created mcp file
99-
100- It should look like this
101-
102- ``` json
103- {
104- "servers" : {
105- "mongodb-mcp-server" : {
106- "type" : " stdio" ,
107- "command" : " /Users/<user>/workplace/atlas-mcp-server/dist/index.js" ,
108- "args" : []
109- }
110- }
111- }
112- ```
113-
114- Notes: You can configure the server with atlas access, make sure to follow configuration section for more details.
115-
116- Step 3: Open the copilot chat and check that the toolbox icon is visible and has the mcp server listed.
117-
118- Step 4: Try running a command
119-
120- - Can you list my clusters?
121-
122- ### Claude
123-
124- Step 1: Install claude and login
125-
126- ``` shell
127- brew install claude
128- ```
129-
130- Step 2: Create a configuration file for your MCP server
131-
132- Open the file
133-
134- ``` shell
135- code ~ /Library/Application\ Support/Claude/claude_desktop_config.json
136- ```
137-
138- Paste the mcp server configuration into the file
139-
140- ``` json
141- {
142- "mcpServers" : {
143- "Demo" : {
144- "command" : " path/to/this/repo/atlas-mc-server/dist/index.js"
145- }
146- }
147- }
148- ```
149-
150- Step 3: Launch Claude Desktop and click on the hammer icon, the Demo MCP server should be detected. Type in the chat "show me a demo of MCP" and allow the tool to get access.
151-
152- Note: If you make changes to your MCP server code, rebuild the project with ` npm run build ` and restart the server and Claude Desktop.
153-
154133## Configuration
155134
156135The MongoDB MCP Server can be configured using multiple methods, with the following precedence (highest to lowest):
@@ -240,7 +219,7 @@ export MDB_MCP_LOG_PATH="/path/to/logs"
240219Pass configuration options as command-line arguments when starting the server:
241220
242221``` shell
243- node dist/index.js --apiClientId=" your-atlas-client-id" --apiClientSecret=" your-atlas-client-secret" --connectionString=" mongodb+srv://username:password@cluster.mongodb.net/myDatabase" --logPath=/path/to/logs
222+ npx -y @mongodb-js/mongodb-mcp-server --apiClientId=" your-atlas-client-id" --apiClientSecret=" your-atlas-client-secret" --connectionString=" mongodb+srv://username:password@cluster.mongodb.net/myDatabase" --logPath=/path/to/logs
244223```
245224
246225## 🤝 Contributing
0 commit comments