From fd0a38e3e2d87537e60243f152e025a4e955759f Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Tue, 29 Apr 2025 00:29:44 +0200 Subject: [PATCH 01/18] feat: add smithery config --- .dockerignore | 13 +++++++++++++ Dockerfile | 28 ++++++++++++++++++++++++++++ smithery.yaml | 22 ++++++++++++++++++++++ 3 files changed, 63 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 smithery.yaml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..4e3f7a54 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,13 @@ +dist +node_modules +.vscode/mcp.json +.github/prompts/* + +# Environment variables +.env + +# Sensitive +state.json + +tests/tmp +coverage diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..10195ecf --- /dev/null +++ b/Dockerfile @@ -0,0 +1,28 @@ +# Use a base image with Node.js +FROM node:23-bookworm-slim + +# Install MongoDB Community Edition +RUN apt-get update && \ + apt-get install -y gnupg curl python3 build-essential && \ + curl -fsSL https://www.mongodb.org/static/pgp/server-8.0.asc | gpg -o /usr/share/keyrings/mongodb-server-8.0.gpg --dearmor && \ + echo "deb [ signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] http://repo.mongodb.org/apt/debian bookworm/mongodb-org/8.0 main" | tee /etc/apt/sources.list.d/mongodb-org-8.0.list && \ + apt-get update && \ + apt-get install -y mongodb-org && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +# Create a directory for the application +WORKDIR /app + +# Copy package.json and package-lock.json +COPY . . + +# Install application dependencies +RUN npm ci + +RUN npm run build + +RUN mongod --fork --logpath /var/log/mongodb.log + +# Start MongoDB and the application +CMD ["node", "dist/index.js --connectionString mongodb://localhost:27017"] diff --git a/smithery.yaml b/smithery.yaml new file mode 100644 index 00000000..aab11cf9 --- /dev/null +++ b/smithery.yaml @@ -0,0 +1,22 @@ +# Smithery.ai configuration +startCommand: +type: stdio +configSchema: + type: object + properties: + connectionString: + type: string + required: + - connectionString +commandFunction: + # A function that produces the CLI command to start the MCP on stdio. + |- + (config) => ({ + "command": "node", + "args": [ + "dist/index.js" + ], + "env": { + "MDB_MCP_CONNECTION_STRING": config.connectionString + } + }) From f07d9e8cf8939c234811ec067ec7a33113c2268a Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Tue, 29 Apr 2025 00:31:55 +0200 Subject: [PATCH 02/18] indent yaml --- smithery.yaml | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/smithery.yaml b/smithery.yaml index aab11cf9..c7e6b0f4 100644 --- a/smithery.yaml +++ b/smithery.yaml @@ -1,22 +1,22 @@ # Smithery.ai configuration startCommand: -type: stdio -configSchema: - type: object - properties: - connectionString: - type: string - required: - - connectionString -commandFunction: - # A function that produces the CLI command to start the MCP on stdio. - |- - (config) => ({ - "command": "node", - "args": [ - "dist/index.js" - ], - "env": { - "MDB_MCP_CONNECTION_STRING": config.connectionString - } - }) + type: stdio + configSchema: + type: object + properties: + connectionString: + type: string + required: + - connectionString + commandFunction: + # A function that produces the CLI command to start the MCP on stdio. + |- + (config) => ({ + "command": "node", + "args": [ + "dist/index.js" + ], + "env": { + "MDB_MCP_CONNECTION_STRING": config.connectionString + } + }) From ba5c16c36d730e9689c60961eae6927ddaa2d253 Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Tue, 29 Apr 2025 00:34:28 +0200 Subject: [PATCH 03/18] more yaml fixes --- smithery.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/smithery.yaml b/smithery.yaml index c7e6b0f4..18d7a03a 100644 --- a/smithery.yaml +++ b/smithery.yaml @@ -3,11 +3,12 @@ startCommand: type: stdio configSchema: type: object + required: + - connectionString properties: connectionString: type: string - required: - - connectionString + description: The connection string to use to connect to MongoDB. commandFunction: # A function that produces the CLI command to start the MCP on stdio. |- From ec2643bc114dcce2c971d37b7372958e80cac277 Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Tue, 29 Apr 2025 00:49:56 +0200 Subject: [PATCH 04/18] move things around, add entrypoint.sh --- Dockerfile => .smithery/Dockerfile | 12 +++++++----- .smithery/entrypoint.sh | 7 +++++++ smithery.yaml => .smithery/smithery.yaml | 3 +++ 3 files changed, 17 insertions(+), 5 deletions(-) rename Dockerfile => .smithery/Dockerfile (74%) create mode 100644 .smithery/entrypoint.sh rename smithery.yaml => .smithery/smithery.yaml (90%) diff --git a/Dockerfile b/.smithery/Dockerfile similarity index 74% rename from Dockerfile rename to .smithery/Dockerfile index 10195ecf..118503c0 100644 --- a/Dockerfile +++ b/.smithery/Dockerfile @@ -14,15 +14,17 @@ RUN apt-get update && \ # Create a directory for the application WORKDIR /app -# Copy package.json and package-lock.json -COPY . . +COPY ../ . # Install application dependencies RUN npm ci RUN npm run build -RUN mongod --fork --logpath /var/log/mongodb.log +# Copy the entrypoint script +COPY ./.smithery/entrypoint.sh /usr/local/bin/entrypoint.sh +RUN chmod +x /usr/local/bin/entrypoint.sh -# Start MongoDB and the application -CMD ["node", "dist/index.js --connectionString mongodb://localhost:27017"] +CMD ["node", "dist/index.js", "--connectionString", "mongodb://localhost:27017"] + +ENTRYPOINT ["entrypoint.sh"] diff --git a/.smithery/entrypoint.sh b/.smithery/entrypoint.sh new file mode 100644 index 00000000..3f7038fd --- /dev/null +++ b/.smithery/entrypoint.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +# Start MongoDB +mongod --fork --logpath /var/log/mongodb.log --dbpath /data/db + +# Execute the provided command or default to the application +exec "$@" diff --git a/smithery.yaml b/.smithery/smithery.yaml similarity index 90% rename from smithery.yaml rename to .smithery/smithery.yaml index 18d7a03a..4a1e9878 100644 --- a/smithery.yaml +++ b/.smithery/smithery.yaml @@ -1,4 +1,7 @@ # Smithery.ai configuration +build: + dockerfile: Dockerfile + dockerBuildPath: ../ startCommand: type: stdio configSchema: From 463405c9c615512c1c76d1d63f0a379fa3432cd4 Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Tue, 29 Apr 2025 01:14:53 +0200 Subject: [PATCH 05/18] another attempt --- .smithery/Dockerfile | 2 -- .smithery/smithery.yaml | 4 +--- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/.smithery/Dockerfile b/.smithery/Dockerfile index 118503c0..60cebf0a 100644 --- a/.smithery/Dockerfile +++ b/.smithery/Dockerfile @@ -25,6 +25,4 @@ RUN npm run build COPY ./.smithery/entrypoint.sh /usr/local/bin/entrypoint.sh RUN chmod +x /usr/local/bin/entrypoint.sh -CMD ["node", "dist/index.js", "--connectionString", "mongodb://localhost:27017"] - ENTRYPOINT ["entrypoint.sh"] diff --git a/.smithery/smithery.yaml b/.smithery/smithery.yaml index 4a1e9878..063e5d40 100644 --- a/.smithery/smithery.yaml +++ b/.smithery/smithery.yaml @@ -6,8 +6,6 @@ startCommand: type: stdio configSchema: type: object - required: - - connectionString properties: connectionString: type: string @@ -21,6 +19,6 @@ startCommand: "dist/index.js" ], "env": { - "MDB_MCP_CONNECTION_STRING": config.connectionString + "MDB_MCP_CONNECTION_STRING": config.connectionString || "mongodb://localhost:27017" } }) From 3b07c85cd5c48c6f39c2e42c856d137c31a646b5 Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Tue, 29 Apr 2025 01:35:08 +0200 Subject: [PATCH 06/18] more dockerfile tweaks --- .smithery/Dockerfile | 11 +++-------- .smithery/entrypoint.sh | 7 ------- 2 files changed, 3 insertions(+), 15 deletions(-) delete mode 100644 .smithery/entrypoint.sh diff --git a/.smithery/Dockerfile b/.smithery/Dockerfile index 60cebf0a..0bf0be3a 100644 --- a/.smithery/Dockerfile +++ b/.smithery/Dockerfile @@ -1,4 +1,3 @@ -# Use a base image with Node.js FROM node:23-bookworm-slim # Install MongoDB Community Edition @@ -11,18 +10,14 @@ RUN apt-get update && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* -# Create a directory for the application WORKDIR /app COPY ../ . -# Install application dependencies RUN npm ci RUN npm run build -# Copy the entrypoint script -COPY ./.smithery/entrypoint.sh /usr/local/bin/entrypoint.sh -RUN chmod +x /usr/local/bin/entrypoint.sh - -ENTRYPOINT ["entrypoint.sh"] +RUN mongod --fork --logpath /var/log/mongodb.log +ENV MDB_MCP_CONNECTION_STRING mongodb://localhost:27017 +CMD ["sh", "-c", "mongod --fork --logpath /var/log/mongodb.log --dbpath /data/db && node dist/index.js"] diff --git a/.smithery/entrypoint.sh b/.smithery/entrypoint.sh deleted file mode 100644 index 3f7038fd..00000000 --- a/.smithery/entrypoint.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -# Start MongoDB -mongod --fork --logpath /var/log/mongodb.log --dbpath /data/db - -# Execute the provided command or default to the application -exec "$@" From f1e8c2738159ab6a7b8f765ddf44d2f729acf107 Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Tue, 29 Apr 2025 01:45:04 +0200 Subject: [PATCH 07/18] fix dockerfile --- .smithery/Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/.smithery/Dockerfile b/.smithery/Dockerfile index 0bf0be3a..15f3204c 100644 --- a/.smithery/Dockerfile +++ b/.smithery/Dockerfile @@ -18,6 +18,5 @@ RUN npm ci RUN npm run build -RUN mongod --fork --logpath /var/log/mongodb.log ENV MDB_MCP_CONNECTION_STRING mongodb://localhost:27017 CMD ["sh", "-c", "mongod --fork --logpath /var/log/mongodb.log --dbpath /data/db && node dist/index.js"] From dacb1c26e0744b012f9494cc2d41cca8ab4c4233 Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Thu, 8 May 2025 16:26:17 +0200 Subject: [PATCH 08/18] remove connection string --- .smithery/Dockerfile | 11 ----------- .smithery/smithery.yaml | 2 +- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/.smithery/Dockerfile b/.smithery/Dockerfile index 15f3204c..507eb5e3 100644 --- a/.smithery/Dockerfile +++ b/.smithery/Dockerfile @@ -1,15 +1,5 @@ FROM node:23-bookworm-slim -# Install MongoDB Community Edition -RUN apt-get update && \ - apt-get install -y gnupg curl python3 build-essential && \ - curl -fsSL https://www.mongodb.org/static/pgp/server-8.0.asc | gpg -o /usr/share/keyrings/mongodb-server-8.0.gpg --dearmor && \ - echo "deb [ signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] http://repo.mongodb.org/apt/debian bookworm/mongodb-org/8.0 main" | tee /etc/apt/sources.list.d/mongodb-org-8.0.list && \ - apt-get update && \ - apt-get install -y mongodb-org && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* - WORKDIR /app COPY ../ . @@ -18,5 +8,4 @@ RUN npm ci RUN npm run build -ENV MDB_MCP_CONNECTION_STRING mongodb://localhost:27017 CMD ["sh", "-c", "mongod --fork --logpath /var/log/mongodb.log --dbpath /data/db && node dist/index.js"] diff --git a/.smithery/smithery.yaml b/.smithery/smithery.yaml index 063e5d40..cef13b3e 100644 --- a/.smithery/smithery.yaml +++ b/.smithery/smithery.yaml @@ -19,6 +19,6 @@ startCommand: "dist/index.js" ], "env": { - "MDB_MCP_CONNECTION_STRING": config.connectionString || "mongodb://localhost:27017" + "MDB_MCP_CONNECTION_STRING": config.connectionString } }) From 8afc2ea307032b29c0c8aed591122559932e47d4 Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Tue, 20 May 2025 05:01:05 +0200 Subject: [PATCH 09/18] tweak dockerfile --- .smithery/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.smithery/Dockerfile b/.smithery/Dockerfile index 507eb5e3..d8ae183c 100644 --- a/.smithery/Dockerfile +++ b/.smithery/Dockerfile @@ -1,4 +1,4 @@ -FROM node:23-bookworm-slim +FROM node:22-alpine WORKDIR /app @@ -8,4 +8,4 @@ RUN npm ci RUN npm run build -CMD ["sh", "-c", "mongod --fork --logpath /var/log/mongodb.log --dbpath /data/db && node dist/index.js"] +CMD ["node", "dist/index.js"] From 8a54f66ee8d3a646701b5e40faa013202dbcd1ea Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Fri, 23 May 2025 13:41:41 +0200 Subject: [PATCH 10/18] update dockerfile --- .smithery/Dockerfile | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/.smithery/Dockerfile b/.smithery/Dockerfile index d8ae183c..f3d1ecfe 100644 --- a/.smithery/Dockerfile +++ b/.smithery/Dockerfile @@ -1,11 +1,31 @@ -FROM node:22-alpine +# Generated by https://smithery.ai. See: https://smithery.ai/docs/config#dockerfile +# ----- Build Stage ----- +FROM node:lts-alpine AS builder +WORKDIR /app + +# Copy package and configuration +COPY ../package.json ../package-lock.json ../tsconfig.json ../tsconfig.build.json ./ + +# Copy source code +COPY ../src ./src +# Install dependencies and build +RUN npm ci && npm run build + +# ----- Production Stage ----- +FROM node:lts-alpine WORKDIR /app -COPY ../ . +# Copy built artifacts +COPY --from=builder /app/dist ./dist + +# Copy package.json for production install +COPY ../package.json package-lock.json ./ -RUN npm ci +# Install only production dependencies +RUN npm ci --production --ignore-scripts -RUN npm run build +# Expose no ports (stdio only) +# Default command CMD ["node", "dist/index.js"] From 08a72b1981b5a19a115da799824586ccad59035e Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Fri, 23 May 2025 14:31:36 +0200 Subject: [PATCH 11/18] remove config --- .smithery/smithery.yaml | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/.smithery/smithery.yaml b/.smithery/smithery.yaml index cef13b3e..e880bef2 100644 --- a/.smithery/smithery.yaml +++ b/.smithery/smithery.yaml @@ -4,12 +4,6 @@ build: dockerBuildPath: ../ startCommand: type: stdio - configSchema: - type: object - properties: - connectionString: - type: string - description: The connection string to use to connect to MongoDB. commandFunction: # A function that produces the CLI command to start the MCP on stdio. |- @@ -17,8 +11,5 @@ startCommand: "command": "node", "args": [ "dist/index.js" - ], - "env": { - "MDB_MCP_CONNECTION_STRING": config.connectionString - } + ] }) From da40b72eec1090f0061e38cdef09d4445ca1348b Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Fri, 23 May 2025 14:45:53 +0200 Subject: [PATCH 12/18] tweak docker ignore --- .dockerignore | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.dockerignore b/.dockerignore index 4e3f7a54..05384e6f 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,13 +1,11 @@ dist node_modules -.vscode/mcp.json -.github/prompts/* - +.vscode +.github +.git # Environment variables .env -# Sensitive -state.json - -tests/tmp +tests coverage +scripts From b60d0669932d6bca3a6d7afc3d065e21eedbaa38 Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Fri, 23 May 2025 14:58:08 +0200 Subject: [PATCH 13/18] Add config parameters --- .smithery/smithery.yaml | 52 ++++++++++++++++++++++++++++++++++++----- README.md | 16 ++++++------- 2 files changed, 54 insertions(+), 14 deletions(-) diff --git a/.smithery/smithery.yaml b/.smithery/smithery.yaml index e880bef2..00c81ef7 100644 --- a/.smithery/smithery.yaml +++ b/.smithery/smithery.yaml @@ -4,12 +4,52 @@ build: dockerBuildPath: ../ startCommand: type: stdio + configSchema: + type: object + properties: + atlasClientId: + type: string + title: Atlas Client Id + description: Atlas API client ID for authentication. Required for running Atlas tools. + atlasClientSecret: + type: string + title: Atlas Client Secret + description: Atlas API client secret for authentication. Required for running Atlas tools. + connectionString: + type: string + title: MongoDB Connection string + 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. + readOnly: + type: boolean + title: Read-only + description: When set to true, only allows read and metadata operation types, disabling create/update/delete operations. + commandFunction: # A function that produces the CLI command to start the MCP on stdio. |- - (config) => ({ - "command": "node", - "args": [ - "dist/index.js" - ] - }) + (config) => { + const env = {}; + if (config.atlasClientId) { + env.MDB_MCP_API_CLIENT_ID = config.atlasClientId; + } + + if (config.atlasClientSecret) { + env.MDB_MCP_API_CLIENT_SECRET = config.atlasClientSecret; + } + + if (config.readOnly) { + env.MDB_MCP_READ_ONLY = true; + } + + if (config.connectionString) { + env.MDB_MCP_CONNECTION_STRING = config.connectionString; + } + + return { + "command": "node", + "args": [ + "dist/index.js" + ], + env, + }; + } diff --git a/README.md b/README.md index 3783d3e2..00ce0b8d 100644 --- a/README.md +++ b/README.md @@ -253,15 +253,15 @@ The MongoDB MCP Server can be configured using multiple methods, with the follow ### Configuration Options -| Option | Description | +| Option | Description | | ------------------ | --------------------------------------------------------------------------------------------------------------------- | -| `apiClientId` | Atlas API client ID for authentication | -| `apiClientSecret` | Atlas API client secret for authentication | -| `connectionString` | MongoDB connection string for direct database connections (optional users may choose to inform it on every tool call) | -| `logPath` | Folder to store logs | -| `disabledTools` | An array of tool names, operation types, and/or categories of tools that will be disabled | -| `readOnly` | When set to true, only allows read and metadata operation types, disabling create/update/delete operations | -| `telemetry` | When set to disabled, disables telemetry collection | +| `apiClientId` | Atlas API client ID for authentication. Required for running Atlas tools. | +| `apiClientSecret` | Atlas API client secret for authentication. Required for running Atlas tools. | +| `connectionString` | MongoDB connection string for direct database connections. Optional, if not set, you'll need to call the `connect` tool before interacting with MongoDB data. | +| `logPath` | Folder to store logs. | +| `disabledTools` | An array of tool names, operation types, and/or categories of tools that will be disabled. | +| `readOnly` | When set to true, only allows read and metadata operation types, disabling create/update/delete operations. | +| `telemetry` | When set to disabled, disables telemetry collection. | #### Log Path From 873fc160093245aa298d86c1755b749965242181 Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Fri, 23 May 2025 15:06:21 +0200 Subject: [PATCH 14/18] try using cli args --- .smithery/smithery.yaml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.smithery/smithery.yaml b/.smithery/smithery.yaml index 00c81ef7..abbbf528 100644 --- a/.smithery/smithery.yaml +++ b/.smithery/smithery.yaml @@ -28,28 +28,28 @@ startCommand: # A function that produces the CLI command to start the MCP on stdio. |- (config) => { - const env = {}; + const args = ['dist/index.js']; if (config.atlasClientId) { - env.MDB_MCP_API_CLIENT_ID = config.atlasClientId; + args.push('--apiClientId'); + args.push(config.atlasClientId); } if (config.atlasClientSecret) { - env.MDB_MCP_API_CLIENT_SECRET = config.atlasClientSecret; + args.push('--apiClientSecret'); + args.push(config.atlasClientSecret); } if (config.readOnly) { - env.MDB_MCP_READ_ONLY = true; + args.push('--readOnly'); } if (config.connectionString) { - env.MDB_MCP_CONNECTION_STRING = config.connectionString; + args.push('--connectionString'); + args.push(config.connectionString); } return { - "command": "node", - "args": [ - "dist/index.js" - ], - env, + command: "node", + args }; } From 7c938d72bda3f29cfd3ef88998cce20a034a32d7 Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Fri, 23 May 2025 15:10:39 +0200 Subject: [PATCH 15/18] add example config --- .smithery/smithery.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.smithery/smithery.yaml b/.smithery/smithery.yaml index abbbf528..7e642f73 100644 --- a/.smithery/smithery.yaml +++ b/.smithery/smithery.yaml @@ -23,6 +23,11 @@ startCommand: type: boolean title: Read-only description: When set to true, only allows read and metadata operation types, disabling create/update/delete operations. + exampleConfig: + atlasClientId: YOUR_ATLAS_CLIENT_ID + atlasClientSecret: YOUR_ATLAS_CLIENT_SECRET + connectionString: mongodb+srv://USERNAME:PASSWORD@YOUR_CLUSTER.mongodb.net + readOnly: true commandFunction: # A function that produces the CLI command to start the MCP on stdio. From 0d9d297c957808c77c1102b620c4bf1129de611d Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Fri, 23 May 2025 15:13:25 +0200 Subject: [PATCH 16/18] Remove workdir from runner --- .smithery/Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/.smithery/Dockerfile b/.smithery/Dockerfile index f3d1ecfe..f34e2ab0 100644 --- a/.smithery/Dockerfile +++ b/.smithery/Dockerfile @@ -14,7 +14,6 @@ RUN npm ci && npm run build # ----- Production Stage ----- FROM node:lts-alpine -WORKDIR /app # Copy built artifacts COPY --from=builder /app/dist ./dist From d022bc330f74f990f7c5975052e05751c7fabc6a Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Fri, 23 May 2025 15:27:01 +0200 Subject: [PATCH 17/18] Handle missing config --- .smithery/smithery.yaml | 30 ++++++++++++++++-------------- README.md | 16 ++++++++-------- 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/.smithery/smithery.yaml b/.smithery/smithery.yaml index 7e642f73..0bfdb01d 100644 --- a/.smithery/smithery.yaml +++ b/.smithery/smithery.yaml @@ -34,23 +34,25 @@ startCommand: |- (config) => { const args = ['dist/index.js']; - if (config.atlasClientId) { - args.push('--apiClientId'); - args.push(config.atlasClientId); - } + if (config) { + if (config.atlasClientId) { + args.push('--apiClientId'); + args.push(config.atlasClientId); + } - if (config.atlasClientSecret) { - args.push('--apiClientSecret'); - args.push(config.atlasClientSecret); - } + if (config.atlasClientSecret) { + args.push('--apiClientSecret'); + args.push(config.atlasClientSecret); + } - if (config.readOnly) { - args.push('--readOnly'); - } + if (config.readOnly) { + args.push('--readOnly'); + } - if (config.connectionString) { - args.push('--connectionString'); - args.push(config.connectionString); + if (config.connectionString) { + args.push('--connectionString'); + args.push(config.connectionString); + } } return { diff --git a/README.md b/README.md index 00ce0b8d..4364dbc8 100644 --- a/README.md +++ b/README.md @@ -253,15 +253,15 @@ The MongoDB MCP Server can be configured using multiple methods, with the follow ### Configuration Options -| Option | Description | -| ------------------ | --------------------------------------------------------------------------------------------------------------------- | -| `apiClientId` | Atlas API client ID for authentication. Required for running Atlas tools. | -| `apiClientSecret` | Atlas API client secret for authentication. Required for running Atlas tools. | +| Option | Description | +| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `apiClientId` | Atlas API client ID for authentication. Required for running Atlas tools. | +| `apiClientSecret` | Atlas API client secret for authentication. Required for running Atlas tools. | | `connectionString` | MongoDB connection string for direct database connections. Optional, if not set, you'll need to call the `connect` tool before interacting with MongoDB data. | -| `logPath` | Folder to store logs. | -| `disabledTools` | An array of tool names, operation types, and/or categories of tools that will be disabled. | -| `readOnly` | When set to true, only allows read and metadata operation types, disabling create/update/delete operations. | -| `telemetry` | When set to disabled, disables telemetry collection. | +| `logPath` | Folder to store logs. | +| `disabledTools` | An array of tool names, operation types, and/or categories of tools that will be disabled. | +| `readOnly` | When set to true, only allows read and metadata operation types, disabling create/update/delete operations. | +| `telemetry` | When set to disabled, disables telemetry collection. | #### Log Path From 002a52601ed9b01e8c43c324282b4a7b2ed888d6 Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Fri, 23 May 2025 15:30:27 +0200 Subject: [PATCH 18/18] add a default --- .smithery/smithery.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.smithery/smithery.yaml b/.smithery/smithery.yaml index 0bfdb01d..e7de81be 100644 --- a/.smithery/smithery.yaml +++ b/.smithery/smithery.yaml @@ -23,6 +23,7 @@ startCommand: type: boolean title: Read-only description: When set to true, only allows read and metadata operation types, disabling create/update/delete operations. + default: false exampleConfig: atlasClientId: YOUR_ATLAS_CLIENT_ID atlasClientSecret: YOUR_ATLAS_CLIENT_SECRET