diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..075430f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,35 @@ +# Generated by https://smithery.ai. See: https://smithery.ai/docs/config#dockerfile +# Use an official Node.js image as a base for the build stage +FROM node:23 AS builder + +# Set the working directory inside the container +WORKDIR /app + +# Copy package manager lock file and package.json files +COPY pnpm-lock.yaml package.json ./ + +# Install dependencies +RUN npm install -g pnpm && pnpm install + +# Copy the rest of the project files +COPY . . + +# Build the project +RUN pnpm build + +# Use a smaller Node.js image for the runtime environment +FROM node:23-slim + +# Set the working directory inside the container +WORKDIR /app + +# Copy built files and dependencies from the builder stage +COPY --from=builder /app ./ + +# Install only production dependencies +RUN pnpm install --prod + +# Set the command to run the server +ENTRYPOINT ["npx", "openapi-mcp-server"] + +# To run the server, you will need to provide the path to the OpenAPI JSON file as an argument diff --git a/README.md b/README.md index 6dfd66a..eb20ef6 100644 --- a/README.md +++ b/README.md @@ -167,6 +167,14 @@ You can say: 2. **Restart Claude Desktop** and start interacting with your API! +### Installing via Smithery + +To install OpenAPI MCP Server for Claude Desktop automatically via [Smithery](https://smithery.ai/server/openapi-mcp-server): + +```bash +npx -y @smithery/cli install openapi-mcp-server --client claude +``` + ## Examples This repository includes a complete example of a Petstore API server that you can use to test the OpenAPI MCP Server. The example server implements a basic CRUD API for managing pets, making it perfect for learning how to use this tool. diff --git a/smithery.yaml b/smithery.yaml new file mode 100644 index 0000000..ca0f5b6 --- /dev/null +++ b/smithery.yaml @@ -0,0 +1,17 @@ +# Smithery configuration file: https://smithery.ai/docs/config#smitheryyaml + +startCommand: + type: stdio + configSchema: + # JSON Schema defining the configuration options for the MCP. + type: object + required: + - openApiJsonPath + properties: + openApiJsonPath: + type: string + description: Path to the OpenAPI v3.1 specification in json or yaml. Either an absolute local path or a https url. + commandFunction: + # A function that produces the CLI command to start the MCP on stdio. + |- + config => ({command: 'npx', args: ['openapi-mcp-server', config.openApiJsonPath]})