Skip to content

feat: add smithery config #263

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 20 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
dist
node_modules
.vscode
.github
.git
# Environment variables
.env

tests
coverage
scripts
30 changes: 30 additions & 0 deletions .smithery/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# 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

# Copy built artifacts
COPY --from=builder /app/dist ./dist

# Copy package.json for production install
COPY ../package.json package-lock.json ./

# Install only production dependencies
RUN npm ci --production --ignore-scripts

# Expose no ports (stdio only)

# Default command
CMD ["node", "dist/index.js"]
63 changes: 63 additions & 0 deletions .smithery/smithery.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Smithery.ai configuration
build:
dockerfile: Dockerfile
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.
default: false
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.
|-
(config) => {
const args = ['dist/index.js'];
if (config) {
if (config.atlasClientId) {
args.push('--apiClientId');
args.push(config.atlasClientId);
}

if (config.atlasClientSecret) {
args.push('--apiClientSecret');
args.push(config.atlasClientSecret);
}

if (config.readOnly) {
args.push('--readOnly');
}

if (config.connectionString) {
args.push('--connectionString');
args.push(config.connectionString);
}
}

return {
command: "node",
args
};
}
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
| `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 |
| 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. |

#### Log Path

Expand Down
Loading