Skip to content
Plugin
MCP
plugins: [pluginMcp()]
Officialv5.1.1kubb >=5.8.0node >=22

MCP

@kubb/plugin-mcp

Generates a Model Context Protocol server from your OpenAPI spec, so AI assistants can call each operation as a typed tool.

kubb add plugin-mcp
mcpmodel-context-protocolaiclaudellmcodegenopenapi

Generates a Model Context Protocol (MCP) server from your OpenAPI spec. Each operation becomes a typed tool that AI assistants can call.

The tool handlers call a function generated by a client plugin, and Zod schemas from @kubb/plugin-zod validate the tool input. The plugin writes server.ts and .mcp.json next to the handlers.

Installation

bun add -d @kubb/plugin-mcp

Or run kubb add plugin-mcp to install the version the Kubb registry pins and add pluginMcp() to kubb.config.ts.

Setup

  • Add @kubb/plugin-ts, @kubb/plugin-zod, and a client plugin: @kubb/plugin-fetch or @kubb/plugin-axios.
  • Install @modelcontextprotocol/server v2 or higher and zod 4.2 or higher in the app that runs the server.

Options worth knowing

  • client picks fetch or axios when both client plugins are registered. A single client is detected automatically.
  • Keep output.path a folder name, such as the default mcp. Single-file output has no place for server.ts and .mcp.json.

Dependencies

No extension dependencies.