mongodb-mcp-server 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/.dockerignore +11 -0
  2. package/.github/CODEOWNERS +0 -2
  3. package/.github/ISSUE_TEMPLATE/bug_report.yml +8 -0
  4. package/.github/workflows/check-pr-title.yml +29 -0
  5. package/.github/workflows/{lint.yml → check.yml} +22 -1
  6. package/.github/workflows/code_health.yaml +0 -22
  7. package/.github/workflows/code_health_fork.yaml +7 -63
  8. package/.github/workflows/docker.yaml +57 -0
  9. package/.github/workflows/stale.yml +32 -0
  10. package/.smithery/Dockerfile +30 -0
  11. package/.smithery/smithery.yaml +63 -0
  12. package/.vscode/extensions.json +9 -0
  13. package/.vscode/settings.json +11 -0
  14. package/CONTRIBUTING.md +1 -1
  15. package/Dockerfile +10 -0
  16. package/README.md +173 -35
  17. package/dist/common/atlas/apiClient.js +151 -35
  18. package/dist/common/atlas/apiClient.js.map +1 -1
  19. package/dist/common/atlas/apiClientError.js +38 -5
  20. package/dist/common/atlas/apiClientError.js.map +1 -1
  21. package/dist/common/atlas/cluster.js +66 -0
  22. package/dist/common/atlas/cluster.js.map +1 -0
  23. package/dist/common/atlas/generatePassword.js +9 -0
  24. package/dist/common/atlas/generatePassword.js.map +1 -0
  25. package/dist/helpers/EJsonTransport.js +38 -0
  26. package/dist/helpers/EJsonTransport.js.map +1 -0
  27. package/dist/helpers/connectionOptions.js +10 -0
  28. package/dist/helpers/connectionOptions.js.map +1 -0
  29. package/dist/{packageInfo.js → helpers/packageInfo.js} +1 -1
  30. package/dist/helpers/packageInfo.js.map +1 -0
  31. package/dist/index.js +23 -3
  32. package/dist/index.js.map +1 -1
  33. package/dist/logger.js +7 -0
  34. package/dist/logger.js.map +1 -1
  35. package/dist/server.js +16 -12
  36. package/dist/server.js.map +1 -1
  37. package/dist/session.js +8 -3
  38. package/dist/session.js.map +1 -1
  39. package/dist/telemetry/constants.js +1 -3
  40. package/dist/telemetry/constants.js.map +1 -1
  41. package/dist/telemetry/eventCache.js.map +1 -1
  42. package/dist/telemetry/telemetry.js +126 -47
  43. package/dist/telemetry/telemetry.js.map +1 -1
  44. package/dist/tools/atlas/atlasTool.js +38 -0
  45. package/dist/tools/atlas/atlasTool.js.map +1 -1
  46. package/dist/tools/atlas/create/createDBUser.js +19 -2
  47. package/dist/tools/atlas/create/createDBUser.js.map +1 -1
  48. package/dist/tools/atlas/create/createProject.js +5 -1
  49. package/dist/tools/atlas/create/createProject.js.map +1 -1
  50. package/dist/tools/atlas/metadata/connectCluster.js +5 -22
  51. package/dist/tools/atlas/metadata/connectCluster.js.map +1 -1
  52. package/dist/tools/atlas/read/inspectCluster.js +4 -24
  53. package/dist/tools/atlas/read/inspectCluster.js.map +1 -1
  54. package/dist/tools/atlas/read/listAlerts.js +41 -0
  55. package/dist/tools/atlas/read/listAlerts.js.map +1 -0
  56. package/dist/tools/atlas/read/listClusters.js +9 -18
  57. package/dist/tools/atlas/read/listClusters.js.map +1 -1
  58. package/dist/tools/atlas/read/listProjects.js +3 -1
  59. package/dist/tools/atlas/read/listProjects.js.map +1 -1
  60. package/dist/tools/atlas/tools.js +2 -0
  61. package/dist/tools/atlas/tools.js.map +1 -1
  62. package/dist/tools/mongodb/metadata/listDatabases.js.map +1 -1
  63. package/dist/tools/mongodb/read/count.js +2 -2
  64. package/dist/tools/mongodb/read/count.js.map +1 -1
  65. package/dist/tools/mongodb/tools.js +2 -4
  66. package/dist/tools/mongodb/tools.js.map +1 -1
  67. package/dist/tools/tool.js +38 -6
  68. package/dist/tools/tool.js.map +1 -1
  69. package/eslint.config.js +2 -1
  70. package/{jest.config.ts → jest.config.cjs} +1 -1
  71. package/package.json +11 -9
  72. package/scripts/apply.ts +8 -5
  73. package/scripts/filter.ts +5 -0
  74. package/src/common/atlas/apiClient.ts +190 -38
  75. package/src/common/atlas/apiClientError.ts +58 -7
  76. package/src/common/atlas/cluster.ts +94 -0
  77. package/src/common/atlas/generatePassword.ts +10 -0
  78. package/src/common/atlas/openapi.d.ts +1876 -239
  79. package/src/helpers/EJsonTransport.ts +47 -0
  80. package/src/helpers/connectionOptions.ts +20 -0
  81. package/src/{packageInfo.ts → helpers/packageInfo.ts} +1 -1
  82. package/src/index.ts +27 -3
  83. package/src/logger.ts +8 -0
  84. package/src/server.ts +23 -15
  85. package/src/session.ts +8 -4
  86. package/src/telemetry/constants.ts +2 -3
  87. package/src/telemetry/eventCache.ts +1 -1
  88. package/src/telemetry/telemetry.ts +182 -64
  89. package/src/telemetry/types.ts +1 -1
  90. package/src/tools/atlas/atlasTool.ts +47 -1
  91. package/src/tools/atlas/create/createDBUser.ts +22 -2
  92. package/src/tools/atlas/create/createProject.ts +7 -1
  93. package/src/tools/atlas/metadata/connectCluster.ts +5 -27
  94. package/src/tools/atlas/read/inspectCluster.ts +4 -40
  95. package/src/tools/atlas/read/listAlerts.ts +45 -0
  96. package/src/tools/atlas/read/listClusters.ts +19 -36
  97. package/src/tools/atlas/read/listProjects.ts +4 -2
  98. package/src/tools/atlas/tools.ts +2 -0
  99. package/src/tools/mongodb/metadata/listDatabases.ts +0 -1
  100. package/src/tools/mongodb/read/count.ts +3 -2
  101. package/src/tools/mongodb/tools.ts +2 -4
  102. package/src/tools/tool.ts +45 -8
  103. package/src/types/mongodb-connection-string-url.d.ts +69 -0
  104. package/tests/integration/helpers.ts +41 -2
  105. package/tests/integration/tools/atlas/accessLists.test.ts +2 -2
  106. package/tests/integration/tools/atlas/alerts.test.ts +42 -0
  107. package/tests/integration/tools/atlas/atlasHelpers.ts +5 -3
  108. package/tests/integration/tools/atlas/clusters.test.ts +4 -4
  109. package/tests/integration/tools/atlas/dbUsers.test.ts +58 -33
  110. package/tests/integration/tools/atlas/orgs.test.ts +2 -2
  111. package/tests/integration/tools/atlas/projects.test.ts +3 -3
  112. package/tests/integration/tools/mongodb/create/createCollection.test.ts +2 -2
  113. package/tests/integration/tools/mongodb/create/createIndex.test.ts +2 -2
  114. package/tests/integration/tools/mongodb/create/insertMany.test.ts +1 -1
  115. package/tests/integration/tools/mongodb/delete/dropCollection.test.ts +1 -1
  116. package/tests/integration/tools/mongodb/metadata/collectionSchema.test.ts +2 -2
  117. package/tests/integration/tools/mongodb/metadata/connect.test.ts +2 -6
  118. package/tests/integration/tools/mongodb/metadata/dbStats.test.ts +4 -4
  119. package/tests/integration/tools/mongodb/metadata/explain.test.ts +10 -10
  120. package/tests/integration/tools/mongodb/metadata/listCollections.test.ts +1 -1
  121. package/tests/integration/tools/mongodb/metadata/listDatabases.test.ts +9 -5
  122. package/tests/integration/tools/mongodb/metadata/logs.test.ts +4 -4
  123. package/tests/integration/tools/mongodb/mongodbHelpers.ts +15 -24
  124. package/tests/integration/tools/mongodb/read/aggregate.test.ts +22 -7
  125. package/tests/integration/tools/mongodb/read/collectionIndexes.test.ts +5 -5
  126. package/tests/integration/tools/mongodb/read/count.test.ts +15 -10
  127. package/tests/integration/tools/mongodb/read/find.test.ts +32 -4
  128. package/tests/integration/tools/mongodb/update/renameCollection.test.ts +4 -4
  129. package/tests/unit/EJsonTransport.test.ts +71 -0
  130. package/tests/unit/apiClient.test.ts +193 -0
  131. package/tests/unit/session.test.ts +65 -0
  132. package/tests/unit/telemetry.test.ts +222 -80
  133. package/tsconfig.build.json +2 -1
  134. package/dist/packageInfo.js.map +0 -1
  135. package/dist/telemetry/device-id.js +0 -20
  136. package/dist/telemetry/device-id.js.map +0 -1
  137. package/src/telemetry/device-id.ts +0 -21
package/.dockerignore ADDED
@@ -0,0 +1,11 @@
1
+ dist
2
+ node_modules
3
+ .vscode
4
+ .github
5
+ .git
6
+ # Environment variables
7
+ .env
8
+
9
+ tests
10
+ coverage
11
+ scripts
@@ -1,3 +1 @@
1
1
  * @mongodb-js/mcp-server-developers
2
- **/atlas @blva @fmenezes
3
- **/mongodb @nirinchev @gagik
@@ -7,6 +7,14 @@ body:
7
7
  - type: markdown
8
8
  attributes:
9
9
  value: "Please fill out the following details to help us address the issue."
10
+ - type: textarea
11
+ id: version
12
+ attributes:
13
+ label: "Version"
14
+ description: "Please provide the version of the MCP Server where the bug occurred. (e.g., 0.1.0, main branch sha, etc.)"
15
+ placeholder: "e.g., 0.1.0"
16
+ validations:
17
+ required: true
10
18
  - type: checkboxes
11
19
  id: app
12
20
  attributes:
@@ -0,0 +1,29 @@
1
+ name: "Check PR Title"
2
+ on:
3
+ pull_request:
4
+ types:
5
+ [
6
+ opened,
7
+ synchronize,
8
+ reopened,
9
+ ready_for_review,
10
+ labeled,
11
+ unlabeled,
12
+ converted_to_draft,
13
+ edited,
14
+ ]
15
+
16
+ permissions:
17
+ pull-requests: read # to read PR title and labels
18
+
19
+ jobs:
20
+ check-pr-title:
21
+ name: Check PR Title
22
+ runs-on: ubuntu-latest
23
+ steps:
24
+ - name: Enforce conventional commit style
25
+ uses: realm/ci-actions/title-checker@d6cc8f067474759d38e6d24e272027b4c88bc0a9
26
+ with:
27
+ regex: '^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test|ops){1}(\([\w\-\.]+\))?(!)?: .*'
28
+ error-hint: 'Invalid PR title. Make sure it follows the conventional commit specification (i.e. "<type>(<optional scope>): <description>") or add the no-title-validation label'
29
+ ignore-labels: "no-title-validation"
@@ -1,10 +1,13 @@
1
1
  ---
2
- name: Lint
2
+ name: Checks
3
3
  on:
4
4
  push:
5
5
  branches:
6
6
  - main
7
7
  pull_request:
8
+ pull_request_target:
9
+ branches:
10
+ - main
8
11
 
9
12
  permissions: {}
10
13
 
@@ -35,3 +38,21 @@ jobs:
35
38
  - name: Install dependencies
36
39
  run: npm ci
37
40
  - run: npm run generate
41
+
42
+ check-dep:
43
+ name: Check dependencies
44
+ runs-on: ubuntu-latest
45
+ steps:
46
+ - uses: GitHubSecurityLab/actions-permissions/monitor@v1
47
+ - uses: actions/checkout@v4
48
+ - uses: actions/setup-node@v4
49
+ with:
50
+ node-version-file: package.json
51
+ cache: "npm"
52
+ - name: Install dependencies, build and remove dev dependencies
53
+ run: |
54
+ npm ci
55
+ rm -rf node_modules
56
+ npm pkg set scripts.prepare="exit 0"
57
+ npm install --omit=dev
58
+ - run: npx -y @modelcontextprotocol/inspector --cli --method tools/list -- node dist/index.js --connectionString "mongodb://localhost"
@@ -62,26 +62,6 @@ jobs:
62
62
  name: atlas-test-results
63
63
  path: coverage/lcov.info
64
64
 
65
- dep-check:
66
- name: Check dependencies
67
- if: github.event.pull_request.user.login != 'dependabot[bot]' && github.event.pull_request.head.repo.full_name == github.repository
68
- runs-on: ubuntu-latest
69
- steps:
70
- - uses: GitHubSecurityLab/actions-permissions/monitor@v1
71
- - uses: actions/checkout@v4
72
- - uses: actions/setup-node@v4
73
- with:
74
- node-version-file: package.json
75
- cache: "npm"
76
- - name: Install dependencies & build
77
- run: npm ci
78
- - name: Remove dev dependencies
79
- run: |
80
- rm -rf node_modules
81
- npm pkg set scripts.prepare="exit 0"
82
- npm install --omit=dev
83
- - run: npx -y @modelcontextprotocol/inspector --cli --method tools/list -- node dist/index.js --connectionString "mongodb://localhost"
84
-
85
65
  coverage:
86
66
  name: Report Coverage
87
67
  if: always() && github.event.pull_request.user.login != 'dependabot[bot]' && github.event.pull_request.head.repo.full_name == github.repository
@@ -112,5 +92,3 @@ jobs:
112
92
  uses: coverallsapp/github-action@v2.3.6
113
93
  with:
114
94
  file: coverage/lcov.info
115
- git-branch: ${{ github.head_ref || github.ref_name }}
116
- git-commit: ${{ github.event.pull_request.head.sha || github.sha }}
@@ -11,9 +11,14 @@ jobs:
11
11
  run-tests:
12
12
  name: Run MongoDB tests
13
13
  if: github.event.pull_request.user.login == 'dependabot[bot]' || github.event.pull_request.head.repo.full_name != github.repository
14
- runs-on: ubuntu-latest
14
+ strategy:
15
+ matrix:
16
+ os: [ubuntu-latest, macos-latest, windows-latest]
17
+ fail-fast: false
18
+ runs-on: ${{ matrix.os }}
15
19
  steps:
16
20
  - uses: GitHubSecurityLab/actions-permissions/monitor@v1
21
+ if: matrix.os != 'windows-latest'
17
22
  - uses: actions/checkout@v4
18
23
  - uses: actions/setup-node@v4
19
24
  with:
@@ -24,71 +29,12 @@ jobs:
24
29
  - name: Run tests
25
30
  run: npm test
26
31
  - name: Upload test results
27
- if: always()
32
+ if: always() && matrix.os == 'ubuntu-latest'
28
33
  uses: actions/upload-artifact@v4
29
34
  with:
30
35
  name: test-results
31
36
  path: coverage/lcov.info
32
37
 
33
- run-atlas-tests:
34
- name: Run Atlas tests
35
- if: github.event.pull_request.user.login == 'dependabot[bot]' || github.event.pull_request.head.repo.full_name != github.repository
36
- runs-on: ubuntu-latest
37
- steps:
38
- - uses: GitHubSecurityLab/actions-permissions/monitor@v1
39
- - uses: actions/checkout@v4
40
- - uses: actions/setup-node@v4
41
- with:
42
- node-version-file: package.json
43
- cache: "npm"
44
- - name: Install dependencies
45
- run: npm ci
46
- - name: Run tests
47
- env:
48
- MDB_MCP_API_CLIENT_ID: ${{ secrets.TEST_ATLAS_CLIENT_ID }}
49
- MDB_MCP_API_CLIENT_SECRET: ${{ secrets.TEST_ATLAS_CLIENT_SECRET }}
50
- MDB_MCP_API_BASE_URL: ${{ vars.TEST_ATLAS_BASE_URL }}
51
- run: npm test -- --testPathIgnorePatterns "tests/integration/tools/mongodb" --testPathIgnorePatterns "tests/integration/[^/]+\.ts"
52
- - name: Upload test results
53
- uses: actions/upload-artifact@v4
54
- if: always()
55
- with:
56
- name: atlas-test-results
57
- path: coverage/lcov.info
58
-
59
- coverage:
60
- name: Report Coverage
61
- if: always() && github.event.pull_request.user.login == 'dependabot[bot]' || github.event.pull_request.head.repo.full_name != github.repository
62
- runs-on: ubuntu-latest
63
- needs: [run-tests, run-atlas-tests]
64
- steps:
65
- - uses: actions/checkout@v4
66
- - uses: actions/setup-node@v4
67
- with:
68
- node-version-file: package.json
69
- cache: "npm"
70
- - name: Install dependencies
71
- run: npm ci
72
- - name: Download test results
73
- uses: actions/download-artifact@v4
74
- with:
75
- name: test-results
76
- path: coverage/mongodb
77
- - name: Download atlas test results
78
- uses: actions/download-artifact@v4
79
- with:
80
- name: atlas-test-results
81
- path: coverage/atlas
82
- - name: Merge coverage reports
83
- run: |
84
- npx -y lcov-result-merger@5.0.1 "coverage/*/lcov.info" "coverage/lcov.info"
85
- - name: Coveralls GitHub Action
86
- uses: coverallsapp/github-action@v2.3.6
87
- with:
88
- file: coverage/lcov.info
89
- git-branch: ${{ github.head_ref || github.ref_name }}
90
- git-commit: ${{ github.event.pull_request.head.sha || github.sha }}
91
-
92
38
  merge-dependabot-pr:
93
39
  name: Merge Dependabot PR
94
40
  if: github.event.pull_request.user.login == 'dependabot[bot]'
@@ -96,8 +42,6 @@ jobs:
96
42
  permissions:
97
43
  pull-requests: write
98
44
  contents: write
99
- needs:
100
- - coverage
101
45
  steps:
102
46
  - name: Enable auto-merge for Dependabot PRs
103
47
  run: gh pr merge --auto --squash "$PR_URL"
@@ -0,0 +1,57 @@
1
+ name: Daily Release Docker Image
2
+ on:
3
+ schedule:
4
+ - cron: "0 1 * * *" # Every day at 1:00 AM
5
+ workflow_dispatch: # Run the action manually
6
+ permissions:
7
+ contents: read
8
+ issues: write
9
+ jobs:
10
+ push:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: GitHubSecurityLab/actions-permissions/monitor@v1
14
+ with:
15
+ config: ${{ vars.PERMISSIONS_CONFIG }}
16
+ - name: Check out code
17
+ uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
18
+ - name: Set up Docker Buildx
19
+ uses: docker/setup-buildx-action@18ce135bb5112fa8ce4ed6c17ab05699d7f3a5e0
20
+ - name: Login to Docker Hub
21
+ uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772
22
+ with:
23
+ username: "${{ secrets.DOCKERHUB_USERNAME }}"
24
+ password: "${{ secrets.DOCKERHUB_PASSWORD }}"
25
+ - name: Set date and version
26
+ id: set-properties
27
+ run: |
28
+ DATE=$(date +'%Y-%m-%d')
29
+ VERSION=$(npm pkg get version | tr -d '"')
30
+ echo "DATE=${DATE}" >> "$GITHUB_OUTPUT"
31
+ echo "VERSION=${VERSION}" >> "$GITHUB_OUTPUT"
32
+ - name: Build and push image to dockerhub registry
33
+ uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83
34
+ with:
35
+ context: .
36
+ platforms: linux/amd64,linux/arm64
37
+ tags: ${{ vars.DOCKERHUB_IMAGE_REPOSITORY }}:latest, ${{ vars.DOCKERHUB_IMAGE_REPOSITORY }}:${{ steps.set-properties.outputs.VERSION }}, ${{ vars.DOCKERHUB_IMAGE_REPOSITORY }}:${{ steps.set-properties.outputs.VERSION }}-${{ steps.set-properties.outputs.DATE }}
38
+ file: Dockerfile
39
+ push: true
40
+ provenance: mode=max
41
+ sbom: true
42
+ build-args: |
43
+ VERSION=${{ steps.set-properties.outputs.VERSION }}
44
+ - uses: mongodb-js/devtools-shared/actions/setup-bot-token@main
45
+ id: app-token
46
+ if: ${{ failure() }}
47
+ with:
48
+ app-id: ${{ vars.DEVTOOLS_BOT_APP_ID }}
49
+ private-key: ${{ secrets.DEVTOOLS_BOT_PRIVATE_KEY }}
50
+ - name: Create Issue
51
+ if: ${{ failure() }}
52
+ uses: imjohnbo/issue-bot@572eed14422c4d6ca37e870f97e7da209422f5bd
53
+ with:
54
+ token: ${{ steps.app-token.outputs.token }}
55
+ title: Release Failure for Docker Image ${{ steps.set-properties.outputs.VERSION }}-${{ steps.set-properties.outputs.DATE }}
56
+ body: See https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
57
+ labels: "docker, release_failure"
@@ -0,0 +1,32 @@
1
+ ---
2
+ name: "Stale issues and PRs handler"
3
+ on:
4
+ workflow_dispatch:
5
+ schedule:
6
+ - cron: "0 0 * * *"
7
+
8
+ permissions: read-all
9
+
10
+ jobs:
11
+ stale:
12
+ runs-on: ubuntu-latest
13
+ permissions:
14
+ issues: write
15
+ pull-requests: write
16
+ steps:
17
+ - uses: GitHubSecurityLab/actions-permissions/monitor@v1
18
+ - uses: actions/stale@v9
19
+ id: stale
20
+ with:
21
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
22
+ stale-issue-message: |
23
+ This issue has gone 30 days without any activity and meets the project's definition of "stale". This will be auto-closed if there is no new activity over the next 30 days. If the issue is still relevant and active, you can simply comment with a "bump" to keep it open, or add the label "not_stale". Thanks for keeping our repository healthy!
24
+ stale-pr-message: |
25
+ This PR has gone 30 days without any activity and meets the project's definition of "stale". This will be auto-closed if there is no new activity over the next 30 days. If the issue is still relevant and active, you can simply comment with a "bump" to keep it open, or add the label "not_stale". Thanks for keeping our repository healthy!
26
+ stale-issue-label: "no-issue-activity"
27
+ stale-pr-label: "no-pr-activity"
28
+ days-before-stale: 30
29
+ days-before-close: 30
30
+ exempt-all-milestones: true
31
+ exempt-issue-labels: "not_stale"
32
+ exempt-pr-labels: "not_stale"
@@ -0,0 +1,30 @@
1
+ # Generated by https://smithery.ai. See: https://smithery.ai/docs/config#dockerfile
2
+ # ----- Build Stage -----
3
+ FROM node:lts-alpine AS builder
4
+ WORKDIR /app
5
+
6
+ # Copy package and configuration
7
+ COPY ../package.json ../package-lock.json ../tsconfig.json ../tsconfig.build.json ./
8
+
9
+ # Copy source code
10
+ COPY ../src ./src
11
+
12
+ # Install dependencies and build
13
+ RUN npm ci && npm run build
14
+
15
+ # ----- Production Stage -----
16
+ FROM node:lts-alpine
17
+
18
+ # Copy built artifacts
19
+ COPY --from=builder /app/dist ./dist
20
+
21
+ # Copy package.json for production install
22
+ COPY ../package.json ../package-lock.json ./
23
+
24
+ # Install only production dependencies
25
+ RUN npm ci --production --ignore-scripts
26
+
27
+ # Expose no ports (stdio only)
28
+
29
+ # Default command
30
+ CMD ["node", "dist/index.js"]
@@ -0,0 +1,63 @@
1
+ # Smithery.ai configuration
2
+ build:
3
+ dockerfile: Dockerfile
4
+ dockerBuildPath: ../
5
+ startCommand:
6
+ type: stdio
7
+ configSchema:
8
+ type: object
9
+ properties:
10
+ atlasClientId:
11
+ type: string
12
+ title: Atlas Client Id
13
+ description: Atlas API client ID for authentication. Required for running Atlas tools.
14
+ atlasClientSecret:
15
+ type: string
16
+ title: Atlas Client Secret
17
+ description: Atlas API client secret for authentication. Required for running Atlas tools.
18
+ connectionString:
19
+ type: string
20
+ title: MongoDB Connection string
21
+ description: MongoDB connection string for direct database connections. Optional, if not set, you'll need to call the `connect` tool before interacting with MongoDB data.
22
+ readOnly:
23
+ type: boolean
24
+ title: Read-only
25
+ description: When set to true, only allows read and metadata operation types, disabling create/update/delete operations.
26
+ default: false
27
+ exampleConfig:
28
+ atlasClientId: YOUR_ATLAS_CLIENT_ID
29
+ atlasClientSecret: YOUR_ATLAS_CLIENT_SECRET
30
+ connectionString: mongodb+srv://USERNAME:PASSWORD@YOUR_CLUSTER.mongodb.net
31
+ readOnly: true
32
+
33
+ commandFunction:
34
+ # A function that produces the CLI command to start the MCP on stdio.
35
+ |-
36
+ (config) => {
37
+ const args = ['dist/index.js'];
38
+ if (config) {
39
+ if (config.atlasClientId) {
40
+ args.push('--apiClientId');
41
+ args.push(config.atlasClientId);
42
+ }
43
+
44
+ if (config.atlasClientSecret) {
45
+ args.push('--apiClientSecret');
46
+ args.push(config.atlasClientSecret);
47
+ }
48
+
49
+ if (config.readOnly) {
50
+ args.push('--readOnly');
51
+ }
52
+
53
+ if (config.connectionString) {
54
+ args.push('--connectionString');
55
+ args.push(config.connectionString);
56
+ }
57
+ }
58
+
59
+ return {
60
+ command: "node",
61
+ args
62
+ };
63
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ // See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
3
+ // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
4
+
5
+ // List of extensions which should be recommended for users of this workspace.
6
+ "recommendations": ["firsttris.vscode-jest-runner", "orta.vscode-jest"],
7
+ // List of extensions recommended by VS Code that should not be recommended for users of this workspace.
8
+ "unwantedRecommendations": []
9
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "jestrunner.jestCommand": "npm test --",
3
+ "jestrunner.debugOptions": {
4
+ "runtimeExecutable": "node",
5
+ "runtimeArgs": [
6
+ "--experimental-vm-modules",
7
+ "node_modules/jest/bin/jest.js",
8
+ "--coverage"
9
+ ]
10
+ }
11
+ }
package/CONTRIBUTING.md CHANGED
@@ -55,7 +55,7 @@ This project implements a Model Context Protocol (MCP) server for MongoDB and Mo
55
55
  npm run inspect
56
56
  ```
57
57
 
58
- 4. Commit your changes with a descriptive commit message
58
+ 4. Commit your changes using [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) format.
59
59
 
60
60
  ## Adding tests to the MCP Server
61
61
 
package/Dockerfile ADDED
@@ -0,0 +1,10 @@
1
+ FROM node:22-alpine
2
+ ARG VERSION=latest
3
+ RUN addgroup -S mcp && adduser -S mcp -G mcp
4
+ RUN npm install -g mongodb-mcp-server@${VERSION}
5
+ USER mcp
6
+ WORKDIR /home/mcp
7
+ ENTRYPOINT ["mongodb-mcp-server"]
8
+ LABEL maintainer="MongoDB Inc <info@mongodb.com>"
9
+ LABEL description="MongoDB MCP Server"
10
+ LABEL version=${VERSION}