@@ -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
49+ ```
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+ }
3762```
3863
39- ### Running the MCP Server
64+ Notes: You can configure the server with atlas access, make sure to follow configuration section for more details.
4065
41- ``` shell
42- npm run build
66+ Step 2: Try talking to github copilot
67+
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- - Node.js v20.x
90-
91- Step 1: Add the mcp server to VSCode configuration
92-
93- - Press ` Cmd + Shift + P ` and type ` MCP: Add MCP Server ` and select it.
94- - Select the first option for a local MCP server.
95- - Add the path to dist/index.js in the prompt
96-
97- Step 2: Verify the created mcp file
98-
99- It should look like this
100-
101- ``` json
102- {
103- "servers" : {
104- "mongodb-mcp-server" : {
105- "type" : " stdio" ,
106- "command" : " npx" ,
107- "args" : [" -y" , " @mongodb-js/mongodb-mcp-server" ]
108- }
109- }
110- }
111- ```
112-
113- Notes: You can configure the server with atlas access, make sure to follow configuration section for more details.
114-
115- Step 3: Open the copilot chat and check that the toolbox icon is visible and has the mcp server listed.
116-
117- Step 4: Try running a command
118-
119- - Can you list my clusters?
120-
121- ### Claude
122-
123- Step 1: Install claude and login
124-
125- ``` shell
126- brew install claude
127- ```
128-
129- Step 2: Create a configuration file for your MCP server
130-
131- Open the file
132-
133- ``` shell
134- code ~ /Library/Application\ Support/Claude/claude_desktop_config.json
135- ```
136-
137- Paste the mcp server configuration into the file
138-
139- ``` json
140- {
141- "mcpServers" : {
142- "Demo" : {
143- "command" : " npx" ,
144- "args" : [" -y" , " @mongodb-js/mongodb-mcp-server" ]
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):
@@ -219,7 +198,7 @@ export MDB_MCP_LOG_PATH="/path/to/logs"
219198Pass configuration options as command-line arguments when starting the server:
220199
221200``` shell
222- node dist/index.js --apiClientId=
" your-atlas-client-id" --apiClientSecret=
" your-atlas-client-secret" --connectionString=
" mongodb+srv://username:[email protected] /myDatabase" --logPath=/path/to/logs
201+ npx -y @mongodb-js/mongodb-mcp-server --apiClientId=
" your-atlas-client-id" --apiClientSecret=
" your-atlas-client-secret" --connectionString=
" mongodb+srv://username:[email protected] /myDatabase" --logPath=/path/to/logs
223202```
224203
225204## 🤝 Contributing
0 commit comments