Skip to content

mongodb-js/mongodb-mcp-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Atlas MCP Server PoC

Table of Contents

Setting up your environment

npm install

Running the MCP Server

npm run build

Troubleshooting (Via VSCode Insiders)

Restart server

  • Run npm run build to re-build the server if you made changes to the code
  • Press Cmd + Shift + P and type List MCP Servers
  • Select the MCP server you want to restart
  • Select the option to restart the server

Logs

To see MCP logs, check https://code.visualstudio.com/docs/copilot/chat/mcp-servers.

  • Press Cmd + Shift + P and type List MCP Servers
  • Select the MCP server you want to see logs for
  • Select the option to view logs in the output panel

Debugging

We can use @modelcontextprotocol/inspector to debug the server - https://github.com/modelcontextprotocol/inspector

From the root of this repository, run:

npx @modelcontextprotocol/inspector dist/index.js

Supported tools

VSCode

Prerequisites:

Step 1: Add the mcp server to VSCode configuration

  • Press Cmd + Shift + P and type MCP: Add MCP Server and select it.
  • Select the first option for a local MCP server.
  • Add the path to dist/index.js in the prompt

Step 2: Verify the created mcp file

It should look like this

{ "servers": { "demo-atlas-server": { "type": "stdio", "command": "/Users/<user>/workplace/atlas-mcp-server/dist/index.js", "args": [] } } }

Step 3: Open the copilot chat and check that the toolbox icon is visible and has the mcp server listed.

Step 4: Try running a command

  • Can you list my clusters?

Claude

Step 1: Install claude and login

brew install claude

Step 2: Create a configuration file for your MCP server

Open the file

code ~/Library/Application\ Support/Claude/claude_desktop_config.json 

Paste the mcp server configuration into the file

{ "mcpServers": { "Demo": { "command": "path/to/this/repo/atlas-mc-server/dist/index.js" } } } 

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.

  • Detailed instructions with screenshots can be found in this document.

Note: If you make changes to your MCP server code, rebuild the project with npm run build and restart the server and Claude Desktop.

About

A Model Context Protocol server to connect to MongoDB databases and MongoDB Atlas Clusters.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published