Skip to content
Officialv5.0.8MITkubb >=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
41.3K/ mo
Stars
8
Bundle size
233.7 kB
Updated
4d ago

Generate an MCP server from OpenAPI.

  • Tools and handlers call a generated HTTP client.
  • Zod schemas validate tool input.

Installation

bun add -d @kubb/plugin-mcp

Dependencies

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

Example

kubb.config.ts
import { defineConfig } from 'kubb/config'
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' } }),
  ],
})

See also