Beta You're reading the docs for Kubb v5, which is currently in beta. View the stable v4 docs
Skip to content

MCP

Kubb ships a Model Context Protocol server. It exposes code-generation tools to any MCP-capable client. Once connected, your editor or agent runs Kubb generation, validates schemas, and inspects configuration without leaving the chat.

IMPORTANT

The built-in MCP server needs Kubb v5 or higher.

NOTE

This page covers using Kubb tooling inside your editor over MCP. To generate an MCP server from your OpenAPI spec, see @kubb/plugin-mcp instead.

Starting the server

Run the server with one command. It communicates over stdio, the transport every major LLM client speaks:

Terminal
shell
kubb mcp

Client configuration

Claude Desktop

Add this to your claude_desktop_config.json. On macOS it usually lives at ~/Library/Application Support/Claude/claude_desktop_config.json:

Claude Desktop
json
{
  "mcpServers": {
    "kubb": {
      "command": "npx",
      "args": ["kubb", "mcp"]
    }
  }
}

Cursor

Open Settings → MCP and add a new server entry:

Cursor
json
{
  "mcpServers": {
    "kubb": {
      "command": "npx",
      "args": ["kubb", "mcp"]
    }
  }
}

VS Code (GitHub Copilot)

Add this to your .vscode/mcp.json for the workspace. For a global setup, run MCP: Open User Configuration in the Command Palette:

.vscode/mcp.json
json
{
  "servers": {
    "kubb": {
      "command": "npx",
      "args": ["kubb", "mcp"]
    }
  }
}

See also