Officialv5.0.7MITkubb >=5.0.0node >=22

@kubb/plugin-mcp

Generates a Model Context Protocol server from your OpenAPI spec, so AI assistants can call each operation as a typed tool.

mcpmodel-context-protocolaiclaudellmcodegenopenapi
Stijn Van Hulle

Stijn Van Hulle

@stijnvanhulle

Downloads
36.7K/ mo
Stars
8
Bundle size
233.7 kB
Updated
16h ago

@kubb/plugin-mcp generates MCP tools, handlers, and a server from OpenAPI operations. Each tool calls a generated HTTP client and uses Zod schemas for validation.

Installation

bun add -d @kubb/plugin-mcp

Dependencies

Add pluginTs, pluginZod, and an Axios or Fetch client plugin. Select client when both clients are configured. Generated servers require @modelcontextprotocol/sdk v1 or higher.

Example

kubb.config.ts
import { defineConfig } from 'kubb'
import { pluginTs } from '@kubb/plugin-ts'
import { pluginZod } from '@kubb/plugin-zod'
import { pluginFetch } from '@kubb/plugin-fetch'
import { pluginMcp } from '@kubb/plugin-mcp'

export default defineConfig({
  input: './petStore.yaml',
  output: { path: './src/gen' },
  plugins: [
    pluginTs(),
    pluginZod(),
    pluginFetch({ baseURL: 'https://petstore.swagger.io/v2' }),
    pluginMcp({ output: { path: 'mcp', mode: 'directory' } }),
  ],
})

Documentation

See also