Skip to content
MCP logo

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

OptionPurposeDefault
outputWhere handlers are written.{ path: 'mcp', barrel: { type: 'named' } }
groupSplit output by tag or path.None
clientRegistered client plugin the handlers call.Detected
includeKeep only operations that match.None
excludeSkip operations that match.[]
overrideApply different options per pattern.[]
resolverCustomize generated names and file paths. See resolver members.resolverMcp
macrosRewrite 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'
Requiredfalse
'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.

See Tool calls and results.

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'
  }
}