Generate a type-safe MCP (Model Context Protocol) server from an OpenAPI specification.
This package allows you to generate and run a type-safe MCP server from your OpenAPI specification. It provides CLI tools for server generation, configuration management, and server execution.
If you would like to use an external configuration for a server with your MCP client, you can also use the CLI to add it to your IDE / Client with a single command.
npx -y -p @usemodel-dev/cli@latest
Generate the MCP server code from your OpenAPI specification:
npx -y -p @usemodel-dev/cli@latest cli generate <ABSOLUTE_PATH_TO_SPEC_YAML_OR_JSON>
This will create the mcp server files in the
cwd()
directory.
npx -y -p @usemodel-dev/cli@latest server
Add or Update Configuration on your MCP Client (Cursor, Windsurf et al.)
npx -y -p @usemodel-dev/cli@latest cli config add <client> '<config_json>'
Where:
<client>
can be one of:cursor
,windsurf
, orclaude
<config_json>
is a JSON string containing your configuration
Example:
# Add or update a server configuration for Cursor
npx -y -p @usemodel-dev/cli@latest cli config add cursor '{"@yourorg/mcp": {"url": "http://localhost:3000", "env": { "apiKey": "XXX" } } }'
npx -y -p @usemodel-dev/cli@latest cli config remove <client> <servername>
Example:
# Remove a server configuration from Cursor
npx -y -p @usemodel-dev/cli@latest cli config remove cursor @yourorg/mcp
Configurations are stored in the following locations based on the client:
- Cursor:
~/.cursor/mcp.json
- Windsurf:
~/.codeium/windsurf/mcp_config.json
- Claude:
~/Library/Application Support/Claude/claude_desktop_config.json
All configurations are stored under the mcpServers
key in the config file. When adding new configurations, they will be merged with existing ones, and when updating existing configurations, they will be overwritten.
- Build the server:
pnpm build
Note: You need to run the generate command before building.
- Start the server:
pnpm start
This will start the server at http://localhost:3001
The server uses dotenv for configuration. Create a .env
file in your project root with the necessary environment variables.
- @modelcontextprotocol/sdk: For MCP implementation
- express: For the server framework
- openapi-typescript: For TypeScript type generation
- zod: For runtime type validation
This project is hosted on GitHub at https://github.com/@usemodel-dev/cli.git. Feel free to open issues or submit pull requests.
MIT
Current version: 0.0.1