MCP
Officialv5.6.0@kubb/plugin-mcp
kubb add plugin-mcp
Options
Pass these options to pluginMcp(). Shared options link to Shared plugin options, and this page gives only their default here.
Options overview
| Option | Purpose | Default |
|---|---|---|
output | Where handlers are written. | { path: 'mcp', barrel: { type: 'named' } } |
group | Split output by tag or path. | None |
client | Registered client plugin the handlers call. | Detected |
include | Keep only operations that match. | None |
exclude | Skip operations that match. | [] |
override | Apply different options per pattern. | [] |
resolver | Customize generated names and file paths. See resolver members. | resolverMcp |
macros | Rewrite AST nodes before printing. | [] |
Keep
output.path a folder name, such as the default 'mcp'. The plugin writes server.ts, start.ts, and .mcp.json at its root, and single-file output (output.mode: 'file', or a path with an extension) has no room for them. With group, only the handlers move into subfolders.Option details
client
Selects the registered client plugin that the handlers call. When client is unset, the handlers call the only registered client plugin. Set transport options such as baseURL on that plugin, or in your own client module with 'client'.
| Type | 'fetch' | 'axios' | 'ky' | 'client' |
| Required | false |
'fetch'
The handlers call
@kubb/plugin-fetch.'axios'
The handlers call
@kubb/plugin-axios.'ky'
The handlers call
@kubb/plugin-ky.'client'
The handlers call
@kubb/plugin-client.The build fails when no client plugin is registered, when several are registered and
client is unset, or when client names a plugin that is not registered.Resolver members
Members you leave out of a resolver patch keep resolverMcp. Besides the shared name, file, and imports members of resolver, resolverMcp has these:
Partial override
type ResolverMcpPatch = {
handler?: {
name?(node: OperationNode): string // → 'showPetByIdHandler'
}
}