Skip to content

Commit 9849f46

Browse files
nirinchevCopilot
andauthored
feat: add smithery config (#263)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 2d54ef5 commit 9849f46

File tree

4 files changed

+113
-9
lines changed

4 files changed

+113
-9
lines changed

.dockerignore

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

.smithery/Dockerfile

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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"]

.smithery/smithery.yaml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
}

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -255,15 +255,15 @@ The MongoDB MCP Server can be configured using multiple methods, with the follow
255255

256256
### Configuration Options
257257

258-
| Option | Description |
259-
| ------------------ | --------------------------------------------------------------------------------------------------------------------- |
260-
| `apiClientId` | Atlas API client ID for authentication |
261-
| `apiClientSecret` | Atlas API client secret for authentication |
262-
| `connectionString` | MongoDB connection string for direct database connections (optional users may choose to inform it on every tool call) |
263-
| `logPath` | Folder to store logs |
264-
| `disabledTools` | An array of tool names, operation types, and/or categories of tools that will be disabled |
265-
| `readOnly` | When set to true, only allows read and metadata operation types, disabling create/update/delete operations |
266-
| `telemetry` | When set to disabled, disables telemetry collection |
258+
| Option | Description |
259+
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
260+
| `apiClientId` | Atlas API client ID for authentication. Required for running Atlas tools. |
261+
| `apiClientSecret` | Atlas API client secret for authentication. Required for running Atlas tools. |
262+
| `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. |
263+
| `logPath` | Folder to store logs. |
264+
| `disabledTools` | An array of tool names, operation types, and/or categories of tools that will be disabled. |
265+
| `readOnly` | When set to true, only allows read and metadata operation types, disabling create/update/delete operations. |
266+
| `telemetry` | When set to disabled, disables telemetry collection. |
267267

268268
#### Log Path
269269

0 commit comments

Comments
 (0)