@kubb/cli
Version: 
Command-line interface for Kubb, enabling easy generation of TypeScript, React-Query, Zod, and other code from OpenAPI specifications.
1 lines • 1.97 kB
Source Map (JSON)
{"version":3,"file":"mcp-cORMfOlp.cjs","names":["jiti","mod: any","pc"],"sources":["../src/commands/mcp.ts"],"sourcesContent":["import type { ArgsDef, ParsedArgs } from 'citty'\nimport { defineCommand, showUsage } from 'citty'\nimport consola from 'consola'\nimport pc from 'picocolors'\nimport { createJiti } from 'jiti'\n\nconst jiti = createJiti(import.meta.url, {\n  sourceMaps: true,\n})\n\nconst args = {\n  help: {\n    type: 'boolean',\n    description: 'Show help',\n    alias: 'h',\n    default: false,\n  },\n} as const satisfies ArgsDef\n\nexport type Args = ParsedArgs<typeof args>\n\nconst command = defineCommand({\n  meta: {\n    name: 'mcp',\n    description: 'Start the server to enable the MCP client to interact with the LLM.',\n  },\n  args,\n  async run(commandContext) {\n    const { args } = commandContext\n\n    if (args.help) {\n      return showUsage(command)\n    }\n\n    let mod: any\n    try {\n      mod = await jiti.import('@kubb/mcp', { default: true })\n    } catch (_e) {\n      consola.error(`Import of '@kubb/mcp' is required to start the MCP server`)\n    }\n\n    const { startServer } = mod\n    try {\n      consola.start('Starting MCP server...')\n      consola.warn(pc.yellow('This feature is still under development — use with caution'))\n      await startServer()\n    } catch (e) {\n      consola.error((e as Error)?.message)\n    }\n  },\n})\n\nexport default command\n"],"mappings":";;;;;;;;;;;AAMA,MAAMA,6EAAmC,EACvC,YAAY,MACb,CAAC;AAaF,MAAM,mCAAwB;CAC5B,MAAM;EACJ,MAAM;EACN,aAAa;EACd;CACD,MAhBW,EACX,MAAM;EACJ,MAAM;EACN,aAAa;EACb,OAAO;EACP,SAAS;EACV,EACF;CAUC,MAAM,IAAI,gBAAgB;EACxB,MAAM,EAAE,SAAS;AAEjB,MAAI,KAAK,KACP,6BAAiB,QAAQ;EAG3B,IAAIC;AACJ,MAAI;AACF,SAAM,MAAMD,OAAK,OAAO,aAAa,EAAE,SAAS,MAAM,CAAC;WAChD,IAAI;AACX,mBAAQ,MAAM,4DAA4D;;EAG5E,MAAM,EAAE,gBAAgB;AACxB,MAAI;AACF,mBAAQ,MAAM,yBAAyB;AACvC,mBAAQ,KAAKE,mBAAG,OAAO,6DAA6D,CAAC;AACrF,SAAM,aAAa;WACZ,GAAG;AACV,mBAAQ,MAAO,GAAa,QAAQ;;;CAGzC,CAAC;AAEF,kBAAe"}