Skip to content
Reference

Options

Configuration options for @kubb/plugin-mcp.

Pass these options to pluginMcp(). Shared options link to Shared plugin options, which documents their behavior once.

Options overview

OptionPurposeDefault
outputWhere the generated handlers are written and exported.{ path: 'mcp', barrel: { type: 'named' } }
↳ output.pathChoose the output folder.'mcp'
↳ output.modeDirectory output only.'directory'
↳ output.barrelConfigure barrel exports.{ type: 'named' }
↳ output.bannerAdd content before generated code.None
↳ output.footerAdd content after generated code.None
groupSplit handlers into per-tag or per-path folders.None
↳ group.typeGroup operations by tag or URL path.Required with group
↳ group.nameCustomize output group names.camelCased tag or raw path segment
clientWhich registered client plugin the handlers call.Auto-detected
includeKeep only operations that match.None
excludeSkip operations that match.[]
overrideApply different options per pattern.[]
resolverCustomize generated names and file paths.resolverMcp
macrosRewrite AST nodes before printing.[]

Option details

output

Where the generated MCP handler files are written. The plugin writes server.ts and .mcp.json at the root of output.path, next to the per-operation handlers, so keep output.path an extensionless directory name such as the default 'mcp'. A single-file output (output.mode: 'file', or a path with an extension) has nowhere to put those files. With group, the handlers move into subfolders while server.ts and .mcp.json keep their place at the root.

TypeOutput
Requiredfalse
Default{ path: 'mcp', barrel: { type: 'named' } }

client

Selects which registered client plugin the handlers call. A single registered client is auto-detected. Set client when several are registered.

Type'fetch' | 'axios'
Requiredfalse
'fetch'
Calls the operations generated by @kubb/plugin-fetch.
'axios'
Calls the operations generated by @kubb/plugin-axios.

Each handler passes grouped { path, query, headers, body } options. Configure transport settings such as baseURL on the client plugin.

Generated handlers follow the client plugin's returnType option. With 'full' (the client default) handlers read the success body from res.data, and with 'data' they use the resolved call result directly as the tool response body. Handlers always pass throwOnError: true so non-2xx responses throw and surface as tool errors, regardless of the client's throwOnErrorDefault.

The handlers call a client plugin's functions, so register @kubb/plugin-fetch or @kubb/plugin-axios alongside this one.

resolver

Overrides generated file and symbol names. Omitted members keep resolverMcp. The shared members (name, file, imports) and the this context are described under resolver.

TypeResolverPatch<ResolverMcp>
Requiredfalse
Partial override
type ResolverMcpPatch = {
  name?(name: string): string
  file?: {
    baseName?(params: { name: string; extname: string }): string
    path?(params: { baseName: string; output: Output }): string
  }
  imports?(options: ResolveImportsOptions): Array<ImportNode>
  handler?: {
    name?(node: OperationNode): string  // → 'showPetByIdHandler'
  }
}