Skip to content
Commands

kubb mcp

The mcp command starts a Model Context Protocol server so AI clients can validate your spec, scaffold a config, and run generation.

Run kubb mcp to start a Model Context Protocol server. AI clients such as Claude Code, Claude Desktop, Cursor, and VS Code can then validate your spec, scaffold a kubb.config.ts, and run generation.

This feature is under active development. Use it with caution and expect breaking changes.
kubb mcp

The server uses the stdio transport, so the client starts it as a local process. Set up the MCP server shows the client configuration.

Tools

ToolParametersDescription
generateconfig? (path to a config file inside the working directory, default kubb.config.{ts,mts,cts,js,mjs,cjs} in it), input? (spec path, overrides the config), output? (output directory, overrides the config), logLevel? (silent, info, verbose, default info, passed to a config that exports a function)Runs the Kubb pipeline. On success, it returns the file count and build events. On failure, it returns each diagnostic with its code, fix, and docs link instead. It rejects a config that exports an array.
validateinput (path or URL, required)Validates an OpenAPI or Swagger document with the bundled OpenAPI adapter.
initinput? (default ./openapi.yaml), output? (default ./src/gen), plugins? (comma-separated, such as plugin-ts,plugin-zod)Writes a kubb.config.ts in the working directory without prompts. It does not install packages, and it fails when kubb.config.ts already exists.

Working directory

The server runs in the folder the client starts it in. generate looks for its config there and rejects a config path outside it, and init writes kubb.config.ts there. Set up the MCP server shows how to start the server in your project.