Skip to content

Commit 3763168

Browse files
committed
feat(deploy): add Smithery.ai deployment configuration
- Add `smithery.yaml` to configure server startup and API key handling for Smithery.ai deployments. - Modify `Dockerfile` to use `--ignore-scripts` during `npm ci`.
1 parent 8d38615 commit 3763168

File tree

2 files changed

+37
-2
lines changed

2 files changed

+37
-2
lines changed

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ WORKDIR /app
77
COPY package*.json ./
88

99
# Install dependencies
10-
RUN npm ci
10+
RUN npm ci --ignore-scripts
1111

1212
# Copy source code
1313
COPY . .
@@ -24,7 +24,7 @@ WORKDIR /app
2424
COPY package*.json ./
2525

2626
# Install production dependencies only
27-
RUN npm ci --omit=dev
27+
RUN npm ci --omit=dev --ignore-scripts
2828

2929
# Copy built files from builder
3030
COPY --from=builder /app/dist ./dist

smithery.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
startCommand:
2+
type: stdio
3+
# Define the schema for user configuration.
4+
configSchema:
5+
type: object
6+
properties:
7+
OPENAI_API_KEY:
8+
type: string
9+
description: Your OpenAI API Key for accessing embedding models.
10+
# Consider adding format: password if Smithery supports masking secrets
11+
required:
12+
- OPENAI_API_KEY
13+
additionalProperties: false # Disallow extra properties
14+
# This function receives the user's config and returns the start command details.
15+
commandFunction: |
16+
(config) => {
17+
// Ensure the config object and the key exist before accessing.
18+
const apiKey = config?.OPENAI_API_KEY;
19+
if (!apiKey) {
20+
// Smithery should prevent this based on 'required', but good practice to check.
21+
throw new Error('OPENAI_API_KEY is missing in the configuration.');
22+
}
23+
return {
24+
command: 'node',
25+
args: ['dist/server.js'],
26+
// Pass the API key from the config to the server's environment.
27+
env: {
28+
OPENAI_API_KEY: apiKey
29+
}
30+
};
31+
}
32+
# Build configuration remains the same.
33+
build:
34+
dockerfile: Dockerfile
35+
dockerBuildPath: .

0 commit comments

Comments
 (0)