@kubb/mcp 5.8.3 → 5.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -24,9 +24,9 @@
24
24
 
25
25
  ### Model Context Protocol server for Kubb
26
26
 
27
- MCP server for Kubb. Exposes code generation as a tool over the [Model Context Protocol](https://modelcontextprotocol.io) so AI assistants like [Claude](https://claude.ai), [Cursor](https://cursor.sh), and other MCP-compatible clients can generate TypeScript types, API clients, and more using natural language.
27
+ `@kubb/mcp` is the MCP server for Kubb. It exposes Kubb code generation as tools over the [Model Context Protocol](https://modelcontextprotocol.io), so AI assistants such as [Claude](https://claude.ai) and [Cursor](https://cursor.sh) can validate a spec and generate TypeScript types and API clients from the chat.
28
28
 
29
- The server exposes a `generate` tool that runs a full Kubb build from a `kubb.config.ts`. It streams build events back to the client as real-time progress notifications. The server communicates over stdio and works with any MCP-compatible client.
29
+ The server has three tools. `generate` runs a full Kubb build from a `kubb.config.ts` and returns its build events when the build succeeds. A failed build returns its diagnostics instead. `validate` checks an OpenAPI spec, and `init` scaffolds a `kubb.config.ts`.
30
30
 
31
31
  ## Installation
32
32
 
@@ -41,11 +41,11 @@ npm install -D @kubb/mcp
41
41
  ```
42
42
 
43
43
  > [!IMPORTANT]
44
- > You also need to install `@kubb/cli` to use the `kubb mcp` command.
44
+ > The `kubb mcp` command comes from `@kubb/cli`, which the `kubb` package includes. Install `kubb` to use it.
45
45
 
46
46
  ## Usage
47
47
 
48
- ### Start the MCP Server
48
+ ### Start the MCP server
49
49
 
50
50
  Start the server using the Kubb CLI:
51
51
 
@@ -59,11 +59,11 @@ Or run it directly as a standalone package:
59
59
  npx @kubb/mcp
60
60
  ```
61
61
 
62
- This starts an MCP server that communicates via stdio (standard input/output), making it compatible with MCP clients.
62
+ Both commands start the same server over stdio.
63
63
 
64
- ### Configure MCP Client
64
+ ### Configure an MCP client
65
65
 
66
- Add to your MCP client configuration (e.g., [Claude Desktop](https://claude.ai/download)'s `claude_desktop_config.json`):
66
+ Add one of these entries to your MCP client's config, such as `claude_desktop_config.json` for [Claude Desktop](https://claude.ai/download).
67
67
 
68
68
  Using `kubb mcp`:
69
69
 
@@ -91,34 +91,39 @@ Using the standalone package:
91
91
  }
92
92
  ```
93
93
 
94
- For project-specific configurations, you can specify the working directory:
94
+ The server looks for `kubb.config.*` in the directory the client starts it in, and rejects a `config` path outside that directory. Claude Code starts it in the folder you run `claude` from, so register it from the project root:
95
+
96
+ ```bash
97
+ claude mcp add kubb -- npx kubb mcp
98
+ ```
99
+
100
+ Clients such as Claude Code ignore a `cwd` key in this config. When a client starts the server in another directory, change into the project first (macOS and Linux):
95
101
 
96
102
  ```json
97
103
  {
98
104
  "mcpServers": {
99
105
  "kubb-petstore": {
100
- "command": "npx",
101
- "args": ["@kubb/mcp"],
102
- "cwd": "/path/to/your/project"
106
+ "command": "sh",
107
+ "args": ["-c", "cd '/path/to/your/project' && npx kubb mcp"]
103
108
  }
104
109
  }
105
110
  }
106
111
  ```
107
112
 
108
- ### Available Tools
113
+ ### Available tools
109
114
 
110
115
  #### `generate`
111
116
 
112
- Generate code from OpenAPI/Swagger specifications using Kubb configuration.
117
+ Runs a Kubb build from your config. A successful build returns the build events, and a failed build returns its diagnostics.
113
118
 
114
- **Parameters:**
119
+ Parameters:
115
120
 
116
- - `config` (string, optional): Path to kubb.config.ts file. If not provided, looks for kubb.config.ts in current directory
121
+ - `config` (string, optional): Path to a config file inside the working directory. Defaults to `kubb.config.ts` (or `.mts`, `.cts`, `.js`, `.mjs`, `.cjs`) in the working directory
117
122
  - `input` (string, optional): Path to OpenAPI/Swagger spec file (overrides config file setting)
118
123
  - `output` (string, optional): Output directory path (overrides config file setting)
119
- - `logLevel` (enum, optional): Control logging verbosity, one of `'silent'`, `'info'`, `'verbose'` (default: 'info')
124
+ - `logLevel` (enum, optional): One of `'silent'`, `'info'`, `'verbose'` (default: 'info'), passed to a config that exports a function
120
125
 
121
- **Examples:**
126
+ Examples:
122
127
 
123
128
  Using default config file:
124
129
 
@@ -147,9 +152,27 @@ With verbose logging:
147
152
  }
148
153
  ```
149
154
 
155
+ #### `validate`
156
+
157
+ Validates an OpenAPI/Swagger specification from a path or URL.
158
+
159
+ Parameters:
160
+
161
+ - `input` (string, required): Path or URL to the OpenAPI/Swagger specification
162
+
163
+ #### `init`
164
+
165
+ 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.
166
+
167
+ Parameters:
168
+
169
+ - `input` (string, optional): Path to the OpenAPI spec (default: `./openapi.yaml`)
170
+ - `output` (string, optional): Output directory (default: `./src/gen`)
171
+ - `plugins` (string, optional): Comma-separated list of plugins, such as `plugin-ts,plugin-zod`
172
+
150
173
  ## Configuration
151
174
 
152
- The build tool looks for `kubb.config.ts` in the current directory by default. You can also provide an inline configuration or path to a config file.
175
+ The `generate` tool looks for `kubb.config.ts` in the working directory by default. Pass `config` to use another config file in that directory.
153
176
 
154
177
  Example `kubb.config.ts`:
155
178
 
package/dist/index.cjs CHANGED
@@ -40,7 +40,7 @@ let node_process = require("node:process");
40
40
  node_process = __toESM(node_process, 1);
41
41
  let _kubb_adapter_oas = require("@kubb/adapter-oas");
42
42
  //#region package.json
43
- var version = "5.8.3";
43
+ var version = "5.9.0";
44
44
  //#endregion
45
45
  //#region ../../internals/shared/src/constants.ts
46
46
  const KUBB_CONFIG_FILENAME = "kubb.config.ts";
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ import fs, { existsSync } from "node:fs";
14
14
  import process$1 from "node:process";
15
15
  import { adapterOas } from "@kubb/adapter-oas";
16
16
  //#region package.json
17
- var version = "5.8.3";
17
+ var version = "5.9.0";
18
18
  //#endregion
19
19
  //#region ../../internals/shared/src/constants.ts
20
20
  const KUBB_CONFIG_FILENAME = "kubb.config.ts";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/mcp",
3
- "version": "5.8.3",
3
+ "version": "5.9.0",
4
4
  "description": "MCP server for Kubb. Exposes code generation as a tool over the Model Context Protocol so AI assistants like Claude, Cursor, and other MCP-compatible clients can generate TypeScript types, clients, and more.",
5
5
  "keywords": [
6
6
  "ai",
@@ -62,8 +62,8 @@
62
62
  "registry": "https://registry.npmjs.org/"
63
63
  },
64
64
  "dependencies": {
65
- "@kubb/adapter-oas": "5.8.3",
66
- "@kubb/core": "5.8.3",
65
+ "@kubb/adapter-oas": "5.9.0",
66
+ "@kubb/core": "5.9.0",
67
67
  "@tmcp/transport-stdio": "^0.5.0",
68
68
  "jiti": "^2.7.0",
69
69
  "tmcp": "^1.20.0",
@@ -72,10 +72,10 @@
72
72
  "devDependencies": {
73
73
  "@internals/shared": "0.0.1",
74
74
  "@internals/utils": "0.0.1",
75
- "@kubb/renderer-jsx": "5.8.3"
75
+ "@kubb/renderer-jsx": "5.9.0"
76
76
  },
77
77
  "peerDependencies": {
78
- "@kubb/renderer-jsx": "5.8.3"
78
+ "@kubb/renderer-jsx": "5.9.0"
79
79
  },
80
80
  "engines": {
81
81
  "node": ">=22"