mongodb-mcp-server 0.0.4 → 0.0.6
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.
- package/.github/CODEOWNERS +3 -0
- package/.github/dependabot.yml +10 -0
- package/.github/workflows/code_health.yaml +53 -22
- package/.github/workflows/code_health_fork.yaml +106 -0
- package/.github/workflows/codeql.yml +34 -0
- package/.github/workflows/lint.yml +37 -0
- package/.github/workflows/prepare_release.yaml +6 -4
- package/.github/workflows/publish.yaml +6 -3
- package/.prettierrc.json +1 -1
- package/README.md +18 -0
- package/dist/common/atlas/apiClient.js +28 -4
- package/dist/common/atlas/apiClient.js.map +1 -1
- package/dist/config.js +4 -7
- package/dist/config.js.map +1 -1
- package/dist/errors.js +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/index.js +12 -7
- package/dist/index.js.map +1 -1
- package/dist/logger.js +72 -28
- package/dist/logger.js.map +1 -1
- package/dist/packageInfo.js +6 -0
- package/dist/packageInfo.js.map +1 -0
- package/dist/server.js +114 -10
- package/dist/server.js.map +1 -1
- package/dist/session.js +66 -16
- package/dist/session.js.map +1 -1
- package/dist/telemetry/constants.js +15 -0
- package/dist/telemetry/constants.js.map +1 -0
- package/dist/telemetry/eventCache.js +53 -0
- package/dist/telemetry/eventCache.js.map +1 -0
- package/dist/telemetry/telemetry.js +97 -0
- package/dist/telemetry/telemetry.js.map +1 -0
- package/dist/telemetry/types.js +2 -0
- package/dist/telemetry/types.js.map +1 -0
- package/dist/tools/atlas/atlasTool.js +8 -3
- package/dist/tools/atlas/atlasTool.js.map +1 -1
- package/dist/tools/atlas/{createAccessList.js → create/createAccessList.js} +1 -2
- package/dist/tools/atlas/create/createAccessList.js.map +1 -0
- package/dist/tools/atlas/{createDBUser.js → create/createDBUser.js} +1 -2
- package/dist/tools/atlas/create/createDBUser.js.map +1 -0
- package/dist/tools/atlas/{createFreeCluster.js → create/createFreeCluster.js} +5 -3
- package/dist/tools/atlas/create/createFreeCluster.js.map +1 -0
- package/dist/tools/atlas/{createProject.js → create/createProject.js} +1 -2
- package/dist/tools/atlas/create/createProject.js.map +1 -0
- package/dist/tools/atlas/metadata/connectCluster.js +97 -0
- package/dist/tools/atlas/metadata/connectCluster.js.map +1 -0
- package/dist/tools/atlas/{inspectAccessList.js → read/inspectAccessList.js} +1 -2
- package/dist/tools/atlas/read/inspectAccessList.js.map +1 -0
- package/dist/tools/atlas/{inspectCluster.js → read/inspectCluster.js} +1 -2
- package/dist/tools/atlas/read/inspectCluster.js.map +1 -0
- package/dist/tools/atlas/{listClusters.js → read/listClusters.js} +1 -2
- package/dist/tools/atlas/read/listClusters.js.map +1 -0
- package/dist/tools/atlas/{listDBUsers.js → read/listDBUsers.js} +1 -2
- package/dist/tools/atlas/read/listDBUsers.js.map +1 -0
- package/dist/tools/atlas/{listOrgs.js → read/listOrgs.js} +1 -2
- package/dist/tools/atlas/read/listOrgs.js.map +1 -0
- package/dist/tools/atlas/{listProjects.js → read/listProjects.js} +11 -5
- package/dist/tools/atlas/read/listProjects.js.map +1 -0
- package/dist/tools/atlas/tools.js +12 -10
- package/dist/tools/atlas/tools.js.map +1 -1
- package/dist/tools/mongodb/create/insertMany.js +1 -1
- package/dist/tools/mongodb/create/insertMany.js.map +1 -1
- package/dist/tools/mongodb/delete/deleteMany.js +1 -2
- package/dist/tools/mongodb/delete/deleteMany.js.map +1 -1
- package/dist/tools/mongodb/metadata/collectionSchema.js +15 -13
- package/dist/tools/mongodb/metadata/collectionSchema.js.map +1 -1
- package/dist/tools/mongodb/metadata/collectionStorageSize.js +32 -3
- package/dist/tools/mongodb/metadata/collectionStorageSize.js.map +1 -1
- package/dist/tools/mongodb/metadata/connect.js +59 -72
- package/dist/tools/mongodb/metadata/connect.js.map +1 -1
- package/dist/tools/mongodb/metadata/dbStats.js +6 -1
- package/dist/tools/mongodb/metadata/dbStats.js.map +1 -1
- package/dist/tools/mongodb/metadata/explain.js +14 -7
- package/dist/tools/mongodb/metadata/explain.js.map +1 -1
- package/dist/tools/mongodb/metadata/logs.js +45 -0
- package/dist/tools/mongodb/metadata/logs.js.map +1 -0
- package/dist/tools/mongodb/mongodbTool.js +42 -36
- package/dist/tools/mongodb/mongodbTool.js.map +1 -1
- package/dist/tools/mongodb/read/aggregate.js +4 -4
- package/dist/tools/mongodb/read/aggregate.js.map +1 -1
- package/dist/tools/mongodb/read/collectionIndexes.js +24 -5
- package/dist/tools/mongodb/read/collectionIndexes.js.map +1 -1
- package/dist/tools/mongodb/read/count.js +1 -2
- package/dist/tools/mongodb/read/count.js.map +1 -1
- package/dist/tools/mongodb/read/find.js +5 -6
- package/dist/tools/mongodb/read/find.js.map +1 -1
- package/dist/tools/mongodb/tools.js +6 -2
- package/dist/tools/mongodb/tools.js.map +1 -1
- package/dist/tools/mongodb/update/renameCollection.js +28 -4
- package/dist/tools/mongodb/update/renameCollection.js.map +1 -1
- package/dist/tools/mongodb/update/updateMany.js +7 -11
- package/dist/tools/mongodb/update/updateMany.js.map +1 -1
- package/dist/tools/tool.js +68 -15
- package/dist/tools/tool.js.map +1 -1
- package/eslint.config.js +29 -10
- package/global.d.ts +1 -0
- package/package.json +7 -3
- package/scripts/apply.ts +9 -7
- package/scripts/filter.ts +3 -2
- package/src/common/atlas/apiClient.ts +44 -11
- package/src/config.ts +16 -17
- package/src/errors.ts +1 -1
- package/src/index.ts +12 -8
- package/src/logger.ts +92 -29
- package/src/packageInfo.ts +6 -0
- package/src/server.ts +160 -11
- package/src/session.ts +102 -22
- package/src/telemetry/constants.ts +15 -0
- package/src/telemetry/eventCache.ts +62 -0
- package/src/telemetry/telemetry.ts +125 -0
- package/src/telemetry/types.ts +77 -0
- package/src/tools/atlas/atlasTool.ts +7 -5
- package/src/tools/atlas/{createAccessList.ts → create/createAccessList.ts} +2 -4
- package/src/tools/atlas/{createDBUser.ts → create/createDBUser.ts} +3 -5
- package/src/tools/atlas/{createFreeCluster.ts → create/createFreeCluster.ts} +7 -6
- package/src/tools/atlas/{createProject.ts → create/createProject.ts} +3 -4
- package/src/tools/atlas/metadata/connectCluster.ts +114 -0
- package/src/tools/atlas/{inspectAccessList.ts → read/inspectAccessList.ts} +2 -4
- package/src/tools/atlas/{inspectCluster.ts → read/inspectCluster.ts} +3 -5
- package/src/tools/atlas/{listClusters.ts → read/listClusters.ts} +3 -5
- package/src/tools/atlas/{listDBUsers.ts → read/listDBUsers.ts} +3 -5
- package/src/tools/atlas/{listOrgs.ts → read/listOrgs.ts} +2 -4
- package/src/tools/atlas/{listProjects.ts → read/listProjects.ts} +15 -7
- package/src/tools/atlas/tools.ts +12 -10
- package/src/tools/mongodb/create/insertMany.ts +1 -1
- package/src/tools/mongodb/delete/deleteMany.ts +1 -2
- package/src/tools/mongodb/metadata/collectionSchema.ts +16 -14
- package/src/tools/mongodb/metadata/collectionStorageSize.ts +41 -3
- package/src/tools/mongodb/metadata/connect.ts +78 -76
- package/src/tools/mongodb/metadata/dbStats.ts +6 -1
- package/src/tools/mongodb/metadata/explain.ts +20 -7
- package/src/tools/mongodb/metadata/logs.ts +55 -0
- package/src/tools/mongodb/mongodbTool.ts +47 -40
- package/src/tools/mongodb/read/aggregate.ts +4 -4
- package/src/tools/mongodb/read/collectionIndexes.ts +29 -5
- package/src/tools/mongodb/read/count.ts +1 -2
- package/src/tools/mongodb/read/find.ts +5 -6
- package/src/tools/mongodb/tools.ts +6 -2
- package/src/tools/mongodb/update/renameCollection.ts +33 -4
- package/src/tools/mongodb/update/updateMany.ts +7 -11
- package/src/tools/tool.ts +89 -26
- package/tests/integration/helpers.ts +94 -107
- package/tests/integration/inMemoryTransport.ts +3 -2
- package/tests/integration/server.test.ts +75 -23
- package/tests/integration/tools/atlas/accessLists.test.ts +13 -15
- package/tests/integration/tools/atlas/atlasHelpers.ts +10 -13
- package/tests/integration/tools/atlas/clusters.test.ts +79 -16
- package/tests/integration/tools/atlas/dbUsers.test.ts +9 -9
- package/tests/integration/tools/atlas/orgs.test.ts +4 -4
- package/tests/integration/tools/atlas/projects.test.ts +10 -12
- package/tests/integration/tools/mongodb/create/createCollection.test.ts +19 -62
- package/tests/integration/tools/mongodb/create/createIndex.test.ts +41 -87
- package/tests/integration/tools/mongodb/create/insertMany.test.ts +35 -78
- package/tests/integration/tools/mongodb/delete/deleteMany.test.ts +25 -62
- package/tests/integration/tools/mongodb/delete/dropCollection.test.ts +22 -71
- package/tests/integration/tools/mongodb/delete/dropDatabase.test.ts +29 -63
- package/tests/integration/tools/mongodb/metadata/collectionSchema.test.ts +154 -0
- package/tests/integration/tools/mongodb/metadata/collectionStorageSize.test.ts +86 -0
- package/tests/integration/tools/mongodb/metadata/connect.test.ts +88 -93
- package/tests/integration/tools/mongodb/metadata/dbStats.test.ts +104 -0
- package/tests/integration/tools/mongodb/metadata/explain.test.ts +171 -0
- package/tests/integration/tools/mongodb/metadata/listCollections.test.ts +28 -56
- package/tests/integration/tools/mongodb/metadata/listDatabases.test.ts +32 -26
- package/tests/integration/tools/mongodb/metadata/logs.test.ts +83 -0
- package/tests/integration/tools/mongodb/mongodbHelpers.ts +176 -0
- package/tests/integration/tools/mongodb/read/aggregate.test.ts +99 -0
- package/tests/integration/tools/mongodb/read/collectionIndexes.test.ts +99 -0
- package/tests/integration/tools/mongodb/read/count.test.ts +31 -79
- package/tests/integration/tools/mongodb/read/find.test.ts +182 -0
- package/tests/integration/tools/mongodb/update/renameCollection.test.ts +194 -0
- package/tests/integration/tools/mongodb/update/updateMany.test.ts +238 -0
- package/tests/unit/telemetry.test.ts +200 -0
- package/tsconfig.jest.json +2 -1
- package/tsconfig.json +1 -1
- package/tsconfig.lint.json +8 -0
- package/dist/tools/atlas/createAccessList.js.map +0 -1
- package/dist/tools/atlas/createDBUser.js.map +0 -1
- package/dist/tools/atlas/createFreeCluster.js.map +0 -1
- package/dist/tools/atlas/createProject.js.map +0 -1
- package/dist/tools/atlas/inspectAccessList.js.map +0 -1
- package/dist/tools/atlas/inspectCluster.js.map +0 -1
- package/dist/tools/atlas/listClusters.js.map +0 -1
- package/dist/tools/atlas/listDBUsers.js.map +0 -1
- package/dist/tools/atlas/listOrgs.js.map +0 -1
- package/dist/tools/atlas/listProjects.js.map +0 -1
|
@@ -5,11 +5,21 @@ on:
|
|
|
5
5
|
branches:
|
|
6
6
|
- main
|
|
7
7
|
pull_request:
|
|
8
|
+
|
|
9
|
+
permissions: {}
|
|
10
|
+
|
|
8
11
|
jobs:
|
|
9
|
-
|
|
10
|
-
|
|
12
|
+
run-tests:
|
|
13
|
+
name: Run MongoDB tests
|
|
14
|
+
if: github.event.pull_request.user.login != 'dependabot[bot]' && github.event.pull_request.head.repo.full_name == github.repository
|
|
15
|
+
strategy:
|
|
16
|
+
matrix:
|
|
17
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
18
|
+
fail-fast: false
|
|
19
|
+
runs-on: ${{ matrix.os }}
|
|
11
20
|
steps:
|
|
12
21
|
- uses: GitHubSecurityLab/actions-permissions/monitor@v1
|
|
22
|
+
if: matrix.os != 'windows-latest'
|
|
13
23
|
- uses: actions/checkout@v4
|
|
14
24
|
- uses: actions/setup-node@v4
|
|
15
25
|
with:
|
|
@@ -17,10 +27,18 @@ jobs:
|
|
|
17
27
|
cache: "npm"
|
|
18
28
|
- name: Install dependencies
|
|
19
29
|
run: npm ci
|
|
20
|
-
- name: Run
|
|
21
|
-
run: npm
|
|
30
|
+
- name: Run tests
|
|
31
|
+
run: npm test
|
|
32
|
+
- name: Upload test results
|
|
33
|
+
if: always() && matrix.os == 'ubuntu-latest'
|
|
34
|
+
uses: actions/upload-artifact@v4
|
|
35
|
+
with:
|
|
36
|
+
name: test-results
|
|
37
|
+
path: coverage/lcov.info
|
|
22
38
|
|
|
23
|
-
|
|
39
|
+
run-atlas-tests:
|
|
40
|
+
name: Run Atlas tests
|
|
41
|
+
if: github.event.pull_request.user.login != 'dependabot[bot]' && github.event.pull_request.head.repo.full_name == github.repository
|
|
24
42
|
runs-on: ubuntu-latest
|
|
25
43
|
steps:
|
|
26
44
|
- uses: GitHubSecurityLab/actions-permissions/monitor@v1
|
|
@@ -31,18 +49,25 @@ jobs:
|
|
|
31
49
|
cache: "npm"
|
|
32
50
|
- name: Install dependencies
|
|
33
51
|
run: npm ci
|
|
34
|
-
- name: Run
|
|
35
|
-
|
|
52
|
+
- name: Run tests
|
|
53
|
+
env:
|
|
54
|
+
MDB_MCP_API_CLIENT_ID: ${{ secrets.TEST_ATLAS_CLIENT_ID }}
|
|
55
|
+
MDB_MCP_API_CLIENT_SECRET: ${{ secrets.TEST_ATLAS_CLIENT_SECRET }}
|
|
56
|
+
MDB_MCP_API_BASE_URL: ${{ vars.TEST_ATLAS_BASE_URL }}
|
|
57
|
+
run: npm test -- --testPathIgnorePatterns "tests/integration/tools/mongodb" --testPathIgnorePatterns "tests/integration/[^/]+\.ts"
|
|
58
|
+
- name: Upload test results
|
|
59
|
+
uses: actions/upload-artifact@v4
|
|
60
|
+
if: always()
|
|
61
|
+
with:
|
|
62
|
+
name: atlas-test-results
|
|
63
|
+
path: coverage/lcov.info
|
|
36
64
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
runs-on: ${{ matrix.os }}
|
|
65
|
+
coverage:
|
|
66
|
+
name: Report Coverage
|
|
67
|
+
if: always() && github.event.pull_request.user.login != 'dependabot[bot]' && github.event.pull_request.head.repo.full_name == github.repository
|
|
68
|
+
runs-on: ubuntu-latest
|
|
69
|
+
needs: [run-tests, run-atlas-tests]
|
|
43
70
|
steps:
|
|
44
|
-
- uses: GitHubSecurityLab/actions-permissions/monitor@v1
|
|
45
|
-
if: matrix.os != 'windows-latest'
|
|
46
71
|
- uses: actions/checkout@v4
|
|
47
72
|
- uses: actions/setup-node@v4
|
|
48
73
|
with:
|
|
@@ -50,15 +75,21 @@ jobs:
|
|
|
50
75
|
cache: "npm"
|
|
51
76
|
- name: Install dependencies
|
|
52
77
|
run: npm ci
|
|
53
|
-
- name:
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
78
|
+
- name: Download test results
|
|
79
|
+
uses: actions/download-artifact@v4
|
|
80
|
+
with:
|
|
81
|
+
name: test-results
|
|
82
|
+
path: coverage/mongodb
|
|
83
|
+
- name: Download atlas test results
|
|
84
|
+
uses: actions/download-artifact@v4
|
|
85
|
+
with:
|
|
86
|
+
name: atlas-test-results
|
|
87
|
+
path: coverage/atlas
|
|
88
|
+
- name: Merge coverage reports
|
|
89
|
+
run: |
|
|
90
|
+
npx -y lcov-result-merger@5.0.1 "coverage/*/lcov.info" "coverage/lcov.info"
|
|
59
91
|
- name: Coveralls GitHub Action
|
|
60
92
|
uses: coverallsapp/github-action@v2.3.6
|
|
61
|
-
if: matrix.os == 'ubuntu-latest'
|
|
62
93
|
with:
|
|
63
94
|
file: coverage/lcov.info
|
|
64
95
|
git-branch: ${{ github.head_ref || github.ref_name }}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Code Health (fork)
|
|
3
|
+
on:
|
|
4
|
+
pull_request_target:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
|
|
8
|
+
permissions: {}
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
run-tests:
|
|
12
|
+
name: Run MongoDB tests
|
|
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
|
|
15
|
+
steps:
|
|
16
|
+
- uses: GitHubSecurityLab/actions-permissions/monitor@v1
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
- uses: actions/setup-node@v4
|
|
19
|
+
with:
|
|
20
|
+
node-version-file: package.json
|
|
21
|
+
cache: "npm"
|
|
22
|
+
- name: Install dependencies
|
|
23
|
+
run: npm ci
|
|
24
|
+
- name: Run tests
|
|
25
|
+
run: npm test
|
|
26
|
+
- name: Upload test results
|
|
27
|
+
if: always()
|
|
28
|
+
uses: actions/upload-artifact@v4
|
|
29
|
+
with:
|
|
30
|
+
name: test-results
|
|
31
|
+
path: coverage/lcov.info
|
|
32
|
+
|
|
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
|
+
merge-dependabot-pr:
|
|
93
|
+
name: Merge Dependabot PR
|
|
94
|
+
if: github.event.pull_request.user.login == 'dependabot[bot]'
|
|
95
|
+
runs-on: ubuntu-latest
|
|
96
|
+
permissions:
|
|
97
|
+
pull-requests: write
|
|
98
|
+
contents: write
|
|
99
|
+
needs:
|
|
100
|
+
- coverage
|
|
101
|
+
steps:
|
|
102
|
+
- name: Enable auto-merge for Dependabot PRs
|
|
103
|
+
run: gh pr merge --auto --squash "$PR_URL"
|
|
104
|
+
env:
|
|
105
|
+
PR_URL: ${{github.event.pull_request.html_url}}
|
|
106
|
+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
name: "CodeQL Advanced"
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: ["main"]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: ["main"]
|
|
8
|
+
schedule:
|
|
9
|
+
- cron: "35 4 * * 4"
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
analyze:
|
|
13
|
+
name: Analyze (${{ matrix.language }})
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
permissions:
|
|
16
|
+
security-events: write
|
|
17
|
+
|
|
18
|
+
strategy:
|
|
19
|
+
fail-fast: false
|
|
20
|
+
matrix:
|
|
21
|
+
language:
|
|
22
|
+
- actions
|
|
23
|
+
- javascript-typescript
|
|
24
|
+
steps:
|
|
25
|
+
- name: Checkout repository
|
|
26
|
+
uses: actions/checkout@v4
|
|
27
|
+
- name: Initialize CodeQL
|
|
28
|
+
uses: github/codeql-action/init@v3
|
|
29
|
+
with:
|
|
30
|
+
languages: ${{ matrix.language }}
|
|
31
|
+
- name: Perform CodeQL Analysis
|
|
32
|
+
uses: github/codeql-action/analyze@v3
|
|
33
|
+
with:
|
|
34
|
+
category: "/language:${{matrix.language}}"
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Lint
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
pull_request:
|
|
8
|
+
|
|
9
|
+
permissions: {}
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
check-style:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- uses: GitHubSecurityLab/actions-permissions/monitor@v1
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
- uses: actions/setup-node@v4
|
|
18
|
+
with:
|
|
19
|
+
node-version-file: package.json
|
|
20
|
+
cache: "npm"
|
|
21
|
+
- name: Install dependencies
|
|
22
|
+
run: npm ci
|
|
23
|
+
- name: Run style check
|
|
24
|
+
run: npm run check
|
|
25
|
+
|
|
26
|
+
check-generate:
|
|
27
|
+
runs-on: ubuntu-latest
|
|
28
|
+
steps:
|
|
29
|
+
- uses: GitHubSecurityLab/actions-permissions/monitor@v1
|
|
30
|
+
- uses: actions/checkout@v4
|
|
31
|
+
- uses: actions/setup-node@v4
|
|
32
|
+
with:
|
|
33
|
+
node-version-file: package.json
|
|
34
|
+
cache: "npm"
|
|
35
|
+
- name: Install dependencies
|
|
36
|
+
run: npm ci
|
|
37
|
+
- run: npm run generate
|
|
@@ -10,6 +10,8 @@ on:
|
|
|
10
10
|
required: true
|
|
11
11
|
default: "patch"
|
|
12
12
|
|
|
13
|
+
permissions: {}
|
|
14
|
+
|
|
13
15
|
jobs:
|
|
14
16
|
create-pr:
|
|
15
17
|
runs-on: ubuntu-latest
|
|
@@ -33,13 +35,13 @@ jobs:
|
|
|
33
35
|
- name: Create release PR
|
|
34
36
|
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # 7.0.8
|
|
35
37
|
with:
|
|
36
|
-
title: "
|
|
38
|
+
title: "chore: release ${{ steps.bump-version.outputs.NEW_VERSION }}"
|
|
37
39
|
token: ${{ steps.app-token.outputs.token }}
|
|
38
|
-
commit-message: "
|
|
40
|
+
commit-message: "chore: release ${{ steps.bump-version.outputs.NEW_VERSION }}"
|
|
39
41
|
body: |
|
|
40
|
-
This PR bumps the package version to
|
|
42
|
+
This PR bumps the package version to ${{ steps.bump-version.outputs.NEW_VERSION }}.
|
|
41
43
|
Once merged, the new version will be published to npm.
|
|
42
44
|
base: main
|
|
43
|
-
branch:
|
|
45
|
+
branch: chore_release_${{ steps.bump-version.outputs.NEW_VERSION }}
|
|
44
46
|
author: "${{ steps.app-token.outputs.app-slug}}[bot] <${{ steps.app-token.outputs.app-email }}>"
|
|
45
47
|
committer: "${{ steps.app-token.outputs.app-slug}}[bot] <${{ steps.app-token.outputs.app-email }}>"
|
|
@@ -4,11 +4,11 @@ on:
|
|
|
4
4
|
push:
|
|
5
5
|
branches:
|
|
6
6
|
- main
|
|
7
|
-
|
|
8
|
-
contents: write
|
|
7
|
+
|
|
9
8
|
jobs:
|
|
10
9
|
check:
|
|
11
10
|
runs-on: ubuntu-latest
|
|
11
|
+
permissions: {}
|
|
12
12
|
outputs:
|
|
13
13
|
VERSION_EXISTS: ${{ steps.check-version.outputs.VERSION_EXISTS }}
|
|
14
14
|
VERSION: ${{ steps.get-version.outputs.VERSION }}
|
|
@@ -45,7 +45,10 @@ jobs:
|
|
|
45
45
|
publish:
|
|
46
46
|
runs-on: ubuntu-latest
|
|
47
47
|
environment: Production
|
|
48
|
-
|
|
48
|
+
permissions:
|
|
49
|
+
contents: write
|
|
50
|
+
needs:
|
|
51
|
+
- check
|
|
49
52
|
if: needs.check.outputs.VERSION_EXISTS == 'false'
|
|
50
53
|
steps:
|
|
51
54
|
- uses: GitHubSecurityLab/actions-permissions/monitor@v1
|
package/.prettierrc.json
CHANGED
package/README.md
CHANGED
|
@@ -104,11 +104,14 @@ You may experiment asking `Can you connect to my mongodb instance?`.
|
|
|
104
104
|
- `atlas-list-clusters` - Lists MongoDB Atlas clusters
|
|
105
105
|
- `atlas-inspect-cluster` - Inspect a specific MongoDB Atlas cluster
|
|
106
106
|
- `atlas-create-free-cluster` - Create a free MongoDB Atlas cluster
|
|
107
|
+
- `atlas-connect-cluster` - Connects to MongoDB Atlas cluster
|
|
107
108
|
- `atlas-inspect-access-list` - Inspect IP/CIDR ranges with access to MongoDB Atlas clusters
|
|
108
109
|
- `atlas-create-access-list` - Configure IP/CIDR access list for MongoDB Atlas clusters
|
|
109
110
|
- `atlas-list-db-users` - List MongoDB Atlas database users
|
|
110
111
|
- `atlas-create-db-user` - List MongoDB Atlas database users
|
|
111
112
|
|
|
113
|
+
NOTE: atlas tools are only available when you set credentials on [configuration](#configuration) section.
|
|
114
|
+
|
|
112
115
|
#### MongoDB Database Tools
|
|
113
116
|
|
|
114
117
|
- `connect` - Connect to a MongoDB instance
|
|
@@ -148,6 +151,7 @@ The MongoDB MCP Server can be configured using multiple methods, with the follow
|
|
|
148
151
|
| `connectionString` | MongoDB connection string for direct database connections (optional users may choose to inform it on every tool call) |
|
|
149
152
|
| `logPath` | Folder to store logs |
|
|
150
153
|
| `disabledTools` | An array of tool names, operation types, and/or categories of tools that will be disabled. |
|
|
154
|
+
| `readOnly` | When set to true, only allows read and metadata operation types, disabling create/update/delete operations |
|
|
151
155
|
|
|
152
156
|
#### `logPath`
|
|
153
157
|
|
|
@@ -179,6 +183,19 @@ Operation types:
|
|
|
179
183
|
- `read` - Tools that read resources, such as find, aggregate, list clusters, etc.
|
|
180
184
|
- `metadata` - Tools that read metadata, such as list databases, list collections, collection schema, etc.
|
|
181
185
|
|
|
186
|
+
#### Read-Only Mode
|
|
187
|
+
|
|
188
|
+
The `readOnly` configuration option allows you to restrict the MCP server to only use tools with "read" and "metadata" operation types. When enabled, all tools that have "create", "update" or "delete" operation types will not be registered with the server.
|
|
189
|
+
|
|
190
|
+
This is useful for scenarios where you want to provide access to MongoDB data for analysis without allowing any modifications to the data or infrastructure.
|
|
191
|
+
|
|
192
|
+
You can enable read-only mode using:
|
|
193
|
+
|
|
194
|
+
- **Environment variable**: `export MDB_MCP_READ_ONLY=true`
|
|
195
|
+
- **Command-line argument**: `--readOnly`
|
|
196
|
+
|
|
197
|
+
When read-only mode is active, you'll see a message in the server logs indicating which tools were prevented from registering due to this restriction.
|
|
198
|
+
|
|
182
199
|
### Atlas API Access
|
|
183
200
|
|
|
184
201
|
To use the Atlas API tools, you'll need to create a service account in MongoDB Atlas:
|
|
@@ -219,6 +236,7 @@ export MDB_MCP_API_CLIENT_SECRET="your-atlas-client-secret"
|
|
|
219
236
|
export MDB_MCP_CONNECTION_STRING="mongodb+srv://username:password@cluster.mongodb.net/myDatabase"
|
|
220
237
|
|
|
221
238
|
export MDB_MCP_LOG_PATH="/path/to/logs"
|
|
239
|
+
|
|
222
240
|
```
|
|
223
241
|
|
|
224
242
|
#### Command-Line Arguments
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import config from "../../config.js";
|
|
2
1
|
import createClient from "openapi-fetch";
|
|
3
2
|
import { ClientCredentials } from "simple-oauth2";
|
|
4
3
|
import { ApiClientError } from "./apiClientError.js";
|
|
4
|
+
import { packageInfo } from "../../packageInfo.js";
|
|
5
5
|
const ATLAS_API_VERSION = "2025-03-12";
|
|
6
6
|
export class ApiClient {
|
|
7
7
|
constructor(options) {
|
|
@@ -35,9 +35,8 @@ export class ApiClient {
|
|
|
35
35
|
};
|
|
36
36
|
this.options = {
|
|
37
37
|
...options,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
`AtlasMCP/${config.version} (${process.platform}; ${process.arch}; ${process.env.HOSTNAME || "unknown"})`,
|
|
38
|
+
userAgent: options.userAgent ||
|
|
39
|
+
`AtlasMCP/${packageInfo.version} (${process.platform}; ${process.arch}; ${process.env.HOSTNAME || "unknown"})`,
|
|
41
40
|
};
|
|
42
41
|
this.client = createClient({
|
|
43
42
|
baseUrl: this.options.baseUrl,
|
|
@@ -61,6 +60,9 @@ export class ApiClient {
|
|
|
61
60
|
}
|
|
62
61
|
this.client.use(this.errorMiddleware);
|
|
63
62
|
}
|
|
63
|
+
hasCredentials() {
|
|
64
|
+
return !!(this.oauth2Client && this.accessToken);
|
|
65
|
+
}
|
|
64
66
|
async getIpInfo() {
|
|
65
67
|
const accessToken = await this.getAccessToken();
|
|
66
68
|
const endpoint = "api/private/ipinfo";
|
|
@@ -78,6 +80,28 @@ export class ApiClient {
|
|
|
78
80
|
}
|
|
79
81
|
return (await response.json());
|
|
80
82
|
}
|
|
83
|
+
async sendEvents(events) {
|
|
84
|
+
let endpoint = "api/private/unauth/telemetry/events";
|
|
85
|
+
const headers = {
|
|
86
|
+
Accept: "application/json",
|
|
87
|
+
"Content-Type": "application/json",
|
|
88
|
+
"User-Agent": this.options.userAgent,
|
|
89
|
+
};
|
|
90
|
+
const accessToken = await this.getAccessToken();
|
|
91
|
+
if (accessToken) {
|
|
92
|
+
endpoint = "api/private/v1.0/telemetry/events";
|
|
93
|
+
headers["Authorization"] = `Bearer ${accessToken}`;
|
|
94
|
+
}
|
|
95
|
+
const url = new URL(endpoint, this.options.baseUrl);
|
|
96
|
+
const response = await fetch(url, {
|
|
97
|
+
method: "POST",
|
|
98
|
+
headers,
|
|
99
|
+
body: JSON.stringify(events),
|
|
100
|
+
});
|
|
101
|
+
if (!response.ok) {
|
|
102
|
+
throw await ApiClientError.fromResponse(response);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
81
105
|
// DO NOT EDIT. This is auto-generated code.
|
|
82
106
|
async listClustersForAllProjects(options) {
|
|
83
107
|
const { data } = await this.client.GET("/api/atlas/v2/clusters", options);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiClient.js","sourceRoot":"","sources":["../../../src/common/atlas/apiClient.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"apiClient.js","sourceRoot":"","sources":["../../../src/common/atlas/apiClient.ts"],"names":[],"mappings":"AAAA,OAAO,YAAoC,MAAM,eAAe,CAAC;AAEjE,OAAO,EAAe,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAGrD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,MAAM,iBAAiB,GAAG,YAAY,CAAC;AAavC,MAAM,OAAO,SAAS;IA4ClB,YAAY,OAAyB;QA/B7B,mBAAc,GAAG,KAAK,IAAI,EAAE;YAChC,IAAI,IAAI,CAAC,YAAY,IAAI,CAAC,CAAC,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC;gBACzE,IAAI,CAAC,WAAW,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;YAC5D,CAAC;YACD,OAAO,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,YAAkC,CAAC;QACtE,CAAC,CAAC;QAEM,mBAAc,GAAe;YACjC,SAAS,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,UAAU,EA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mC,EAAE,OAAO,CAAC,CAAC;QACrF,OAAO,IAAI,CAAC;IAChB,CAAC;CAGJ"}
|
package/dist/config.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import os from "os";
|
|
3
3
|
import argv from "yargs-parser";
|
|
4
|
-
import packageJson from "../package.json" with { type: "json" };
|
|
5
4
|
const defaults = {
|
|
5
|
+
apiBaseUrl: "https://cloud.mongodb.com/",
|
|
6
6
|
logPath: getLogPath(),
|
|
7
7
|
connectOptions: {
|
|
8
8
|
readConcern: "local",
|
|
@@ -11,17 +11,14 @@ const defaults = {
|
|
|
11
11
|
timeoutMS: 30000,
|
|
12
12
|
},
|
|
13
13
|
disabledTools: [],
|
|
14
|
+
telemetry: "disabled",
|
|
15
|
+
readOnly: false,
|
|
14
16
|
};
|
|
15
|
-
const
|
|
17
|
+
export const config = {
|
|
16
18
|
...defaults,
|
|
17
19
|
...getEnvConfig(),
|
|
18
20
|
...getCliConfig(),
|
|
19
21
|
};
|
|
20
|
-
const config = {
|
|
21
|
-
...mergedUserConfig,
|
|
22
|
-
version: packageJson.version,
|
|
23
|
-
};
|
|
24
|
-
export default config;
|
|
25
22
|
function getLogPath() {
|
|
26
23
|
const localDataPath = process.platform === "win32"
|
|
27
24
|
? path.join(process.env.LOCALAPPDATA || process.env.APPDATA || os.homedir(), "mongodb")
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI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CAAC,UAAU,EAAE,EAAE,CAAC;aACvB,KAAK,CAAC,GAAG,CAAC;aACV,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC,CAAC;QAEjD,QAAQ,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IACvC,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,SAAS,sBAAsB,CAAC,GAAW;IACvC,OAAO,GAAG,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC;AACtG,CAAC;AAED,+DAA+D;AAC/D,SAAS,YAAY;IACjB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;QAC/B,KAAK,EAAE,CAAC,eAAe,CAAC;KAC3B,CAAmC,CAAC;AACzC,CAAC"}
|
package/dist/errors.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export var ErrorCodes;
|
|
2
2
|
(function (ErrorCodes) {
|
|
3
3
|
ErrorCodes[ErrorCodes["NotConnectedToMongoDB"] = 1000000] = "NotConnectedToMongoDB";
|
|
4
|
-
ErrorCodes[ErrorCodes["
|
|
4
|
+
ErrorCodes[ErrorCodes["MisconfiguredConnectionString"] = 1000001] = "MisconfiguredConnectionString";
|
|
5
5
|
})(ErrorCodes || (ErrorCodes = {}));
|
|
6
6
|
export class MongoDBError extends Error {
|
|
7
7
|
constructor(code, message) {
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,UAGX;AAHD,WAAY,UAAU;IAClB,mFAAiC,CAAA;IACjC,
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,UAGX;AAHD,WAAY,UAAU;IAClB,mFAAiC,CAAA;IACjC,mGAAyC,CAAA;AAC7C,CAAC,EAHW,UAAU,KAAV,UAAU,QAGrB;AAED,MAAM,OAAO,YAAa,SAAQ,KAAK;IACnC,YACW,IAAgB,EACvB,OAAe;QAEf,KAAK,CAAC,OAAO,CAAC,CAAC;QAHR,SAAI,GAAJ,IAAI,CAAY;IAI3B,CAAC;CACJ"}
|
package/dist/index.js
CHANGED
|
@@ -1,26 +1,31 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
3
|
-
import logger from "./logger.js";
|
|
4
|
-
import { mongoLogId } from "mongodb-log-writer";
|
|
3
|
+
import logger, { LogId } from "./logger.js";
|
|
5
4
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
6
|
-
import config from "./config.js";
|
|
5
|
+
import { config } from "./config.js";
|
|
7
6
|
import { Session } from "./session.js";
|
|
8
7
|
import { Server } from "./server.js";
|
|
8
|
+
import { packageInfo } from "./packageInfo.js";
|
|
9
9
|
try {
|
|
10
|
-
const session = new Session(
|
|
10
|
+
const session = new Session({
|
|
11
|
+
apiBaseUrl: config.apiBaseUrl,
|
|
12
|
+
apiClientId: config.apiClientId,
|
|
13
|
+
apiClientSecret: config.apiClientSecret,
|
|
14
|
+
});
|
|
11
15
|
const mcpServer = new McpServer({
|
|
12
|
-
name:
|
|
13
|
-
version:
|
|
16
|
+
name: packageInfo.mcpServerName,
|
|
17
|
+
version: packageInfo.version,
|
|
14
18
|
});
|
|
15
19
|
const server = new Server({
|
|
16
20
|
mcpServer,
|
|
17
21
|
session,
|
|
22
|
+
userConfig: config,
|
|
18
23
|
});
|
|
19
24
|
const transport = new StdioServerTransport();
|
|
20
25
|
await server.connect(transport);
|
|
21
26
|
}
|
|
22
27
|
catch (error) {
|
|
23
|
-
logger.emergency(
|
|
28
|
+
logger.emergency(LogId.serverStartFailure, "server", `Fatal error running server: ${error}`);
|
|
24
29
|
process.exit(1);
|
|
25
30
|
}
|
|
26
31
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,IAAI,CAAC;IACD,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC;QACxB,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,eAAe,EAAE,MAAM,CAAC,eAAe;KAC1C,CAAC,CAAC;IACH,MAAM,SAAS,GAAG,IAAI,SAAS,CAAC;QAC5B,IAAI,EAAE,WAAW,CAAC,aAAa;QAC/B,OAAO,EAAE,WAAW,CAAC,OAAO;KAC/B,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC;QACtB,SAAS;QACT,OAAO;QACP,UAAU,EAAE,MAAM;KACrB,CAAC,CAAC;IAEH,MAAM,SAAS,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