Thank you for your interest in contributing to the MongoDB MCP Server project! This document provides guidelines and instructions for contributing.
This project implements a Model Context Protocol (MCP) server for MongoDB and MongoDB Atlas, enabling AI assistants to interact with MongoDB Atlas resources through natural language.
- Node.js (v20 or later)
- npm
-
Clone the repository:
git clone https://github.com/mongodb-labs/mongodb-mcp-server.git cd mongodb-mcp-server
-
Install dependencies:
npm install
-
Add the mcp server to your IDE of choice (see the README for detailed client integration instructions)
{ "mcpServers": { "MongoDB": { "command": "/path/to/mongodb-mcp-server/dist/index.js" } } }
-
Create a new branch for your feature or bugfix:
git checkout -b feature/your-feature-name
-
Make your changes, following the code style of the project
-
Run the inspector and double check your changes:
npm run inspect
-
Commit your changes with a descriptive commit message
When adding new features or fixing bugs, please ensure that you also add tests to cover your changes. This helps maintain the quality and reliability of the codebase.
The tests can be found in the tests
directory.
You can run tests using the following npm scripts:
npm test
: Run all tests
To run a specific test file or directory:
npm test -- path/to/test/file.test.ts
npm test -- path/to/directory
- 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
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
For debugging, we use the MCP inspector tool. From the root of this repository, run:
npm run inspect
This is equivalent to:
npx @modelcontextprotocol/inspector -- node dist/index.js
- Update documentation if necessary
- Ensure your PR includes only relevant changes
- Link any related issues in your PR description
- Keep PRs focused on a single topic
- Use TypeScript for all new code
- Follow the existing code style (indentation, naming conventions, etc.)
- Comment your code when necessary, especially for complex logic
- Use meaningful variable and function names
When reporting issues, please include:
- A clear description of the problem
- Steps to reproduce
- Expected vs. actual behavior
- Version information
- Environment details
When adding new tools to the MCP server:
- Follow the existing pattern in
server.ts
- Define clear parameter schemas using Zod
- Implement thorough error handling
- Add proper documentation for the tool
- Include examples of how to use the tool
Our release process is automated using GitHub Actions workflows:
- To create a new version, go to the GitHub repository Actions tab
- Select the "Version Bump" workflow
- Click "Run workflow" and choose one of the following options:
patch
(e.g., 1.0.0 → 1.0.1) for backward-compatible bug fixesminor
(e.g., 1.0.0 → 1.1.0) for backward-compatible new featuresmajor
(e.g., 1.0.0 → 2.0.0) for breaking changes- A specific version number (e.g.,
1.2.3
)
- This creates a pull request with the version change
- Once approved and merged, the version is updated
When a version bump is merged to the main branch:
- The "Publish" workflow automatically runs
- It checks if the version already exists as a git tag
- If the version is new, it:
- Builds the package
- Publishes to NPM
- Creates a git tag for the version
- Creates a GitHub release with auto-generated release notes
All pull requests automatically run through the "Code Health" workflow, which:
- Verifies code style and formatting
- Runs tests on multiple platforms (Ubuntu, macOS, Windows)
By contributing to this project, you agree that your contributions will be licensed under the project's license.
If you have any questions or need help, please open an issue or reach out to the maintainers.