Skip to content

Commit 7b4dff6

Browse files
committed
Merge branch 'main' into ni/disable-tools
2 parents 0bdfc03 + c692587 commit 7b4dff6

File tree

17 files changed

+484
-432
lines changed

17 files changed

+484
-432
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Prepare release
2+
description: |
3+
Bumps the version in package.json and creates a release PR. Once merged, the new
4+
version will be published to npm.
5+
on:
6+
workflow_dispatch:
7+
inputs:
8+
version:
9+
description: "Exact version to bump to or one of major, minor, patch"
10+
required: true
11+
default: "patch"
12+
13+
jobs:
14+
create-pr:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: mongodb-js/devtools-shared/actions/setup-bot-token@main
18+
id: app-token
19+
with:
20+
app-id: ${{ vars.DEVTOOLS_BOT_APP_ID }}
21+
private-key: ${{ secrets.DEVTOOLS_BOT_PRIVATE_KEY }}
22+
- uses: GitHubSecurityLab/actions-permissions/monitor@v1
23+
- uses: actions/checkout@v4
24+
- uses: actions/setup-node@v4
25+
with:
26+
node-version-file: package.json
27+
registry-url: "https://registry.npmjs.org"
28+
cache: "npm"
29+
- name: Bump version
30+
id: bump-version
31+
run: |
32+
echo "NEW_VERSION=$(npm version ${{ inputs.version }} --no-git-tag-version)" >> $GITHUB_OUTPUT
33+
- name: Create release PR
34+
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # 7.0.8
35+
with:
36+
title: "Release v${{ steps.bump-version.outputs.NEW_VERSION }}"
37+
token: ${{ steps.app-token.outputs.token }}
38+
commit-message: "Bump version to v${{ steps.bump-version.outputs.NEW_VERSION }}"
39+
body: |
40+
This PR bumps the package version to v${{ steps.bump-version.outputs.NEW_VERSION }}.
41+
Once merged, the new version will be published to npm.
42+
base: main
43+
branch: release/v${{ steps.bump-version.outputs.NEW_VERSION }}
44+
author: "${{ steps.app-token.outputs.app-slug}}[bot] <${{ steps.app-token.outputs.app-email }}>"
45+
committer: "${{ steps.app-token.outputs.app-slug}}[bot] <${{ steps.app-token.outputs.app-email }}>"

.github/workflows/publish.yaml

Lines changed: 45 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,51 @@
22
name: Publish
33
on:
44
push:
5-
tags:
6-
- v*
5+
branches:
6+
- main
7+
permissions:
8+
contents: write
79
jobs:
10+
check:
11+
runs-on: ubuntu-latest
12+
outputs:
13+
VERSION_EXISTS: ${{ steps.check-version.outputs.VERSION_EXISTS }}
14+
VERSION: ${{ steps.get-version.outputs.VERSION }}
15+
steps:
16+
- uses: GitHubSecurityLab/actions-permissions/monitor@v1
17+
- uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
- uses: actions/setup-node@v4
21+
with:
22+
node-version-file: package.json
23+
registry-url: "https://registry.npmjs.org"
24+
cache: "npm"
25+
- name: Get version
26+
id: get-version
27+
shell: bash
28+
run: |
29+
set +e
30+
31+
VERSION=v$(jq -r '.version' < package.json)
32+
echo "VERSION=${VERSION}" >> "$GITHUB_OUTPUT"
33+
- name: Check if version already exists
34+
id: check-version
35+
shell: bash
36+
run: |
37+
set +e
38+
39+
git rev-parse "${{ steps.get-version.outputs.VERSION }}" >/dev/null 2>&1
40+
if [[ $? -eq 0 ]]; then
41+
echo "VERSION_EXISTS=true" >> "$GITHUB_OUTPUT"
42+
else
43+
echo "VERSION_EXISTS=false" >> "$GITHUB_OUTPUT"
44+
fi
845
publish:
946
runs-on: ubuntu-latest
1047
environment: Production
48+
needs: check
49+
if: needs.check.outputs.VERSION_EXISTS == 'false'
1150
steps:
1251
- uses: GitHubSecurityLab/actions-permissions/monitor@v1
1352
- uses: actions/checkout@v4
@@ -24,6 +63,8 @@ jobs:
2463
run: npm publish
2564
env:
2665
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
27-
- name: Publish Github release
66+
- name: Publish git release
67+
env:
68+
GH_TOKEN: ${{ github.token }}
2869
run: |
29-
gh release create ${{ github.ref }} --title "${{ github.ref }}" --notes "Release ${{ github.ref }}" --generate-notes
70+
gh release create ${{ needs.check.outputs.VERSION }} --title "${{ needs.check.outputs.VERSION }}" --generate-notes --target ${{ github.sha }}

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
git-tag-version=false

CONTRIBUTING.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,41 @@ When adding new tools to the MCP server:
141141
4. Add proper documentation for the tool
142142
5. Include examples of how to use the tool
143143

144+
## Release Process
145+
146+
Our release process is automated using GitHub Actions workflows:
147+
148+
### Version Bumping
149+
150+
1. To create a new version, go to the GitHub repository Actions tab
151+
2. Select the "Version Bump" workflow
152+
3. Click "Run workflow" and choose one of the following options:
153+
- `patch` (e.g., 1.0.0 → 1.0.1) for backward-compatible bug fixes
154+
- `minor` (e.g., 1.0.0 → 1.1.0) for backward-compatible new features
155+
- `major` (e.g., 1.0.0 → 2.0.0) for breaking changes
156+
- A specific version number (e.g., `1.2.3`)
157+
4. This creates a pull request with the version change
158+
5. Once approved and merged, the version is updated
159+
160+
### Automatic Publishing
161+
162+
When a version bump is merged to the main branch:
163+
164+
1. The "Publish" workflow automatically runs
165+
2. It checks if the version already exists as a git tag
166+
3. If the version is new, it:
167+
- Builds the package
168+
- Publishes to NPM
169+
- Creates a git tag for the version
170+
- Creates a GitHub release with auto-generated release notes
171+
172+
### Code Quality
173+
174+
All pull requests automatically run through the "Code Health" workflow, which:
175+
176+
- Verifies code style and formatting
177+
- Runs tests on multiple platforms (Ubuntu, macOS, Windows)
178+
144179
## License
145180

146181
By contributing to this project, you agree that your contributions will be licensed under the project's license.

README.md

Lines changed: 65 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -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

156135
The 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"
240219
Pass 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:[email protected]/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:[email protected]/myDatabase" --logPath=/path/to/logs
244223
```
245224

246225
## 🤝 Contributing

jest.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ export default {
1616
],
1717
},
1818
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
19+
setupFilesAfterEnv: ["jest-extended/all"],
1920
};

0 commit comments

Comments
 (0)