@kubb/plugin-mcp 4.34.0 → 4.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,40 +1,12 @@
1
1
  import { t as __name } from "./chunk--u3MIqq1.js";
2
2
  import { n as PluginMcp } from "./types-CblxgOvZ.js";
3
- import { Config, FileMetaBase, Group, KubbEvents, Output, Plugin, PluginFactoryOptions, PluginManager, ResolveNameParams } from "@kubb/core";
3
+ import { AsyncEventEmitter, Config, FileMetaBase, Group, KubbEvents, Output, Plugin, PluginFactoryOptions, PluginManager, ResolveNameParams } from "@kubb/core";
4
4
  import { Fabric } from "@kubb/react-fabric";
5
5
  import { KubbFile } from "@kubb/fabric-core/types";
6
6
  import { FabricReactNode } from "@kubb/react-fabric/types";
7
+ import { OperationNode, SchemaNode } from "@kubb/ast/types";
7
8
  import { HttpMethod, Oas, Operation, SchemaObject, contentType } from "@kubb/oas";
8
9
 
9
- //#region ../../internals/utils/src/asyncEventEmitter.d.ts
10
- /** A function that can be registered as an event listener, synchronous or async. */
11
- type AsyncListener<TArgs extends unknown[]> = (...args: TArgs) => void | Promise<void>;
12
- /**
13
- * A typed EventEmitter that awaits all async listeners before resolving.
14
- * Wraps Node's `EventEmitter` with full TypeScript event-map inference.
15
- */
16
- declare class AsyncEventEmitter<TEvents extends { [K in keyof TEvents]: unknown[] }> {
17
- #private;
18
- /**
19
- * `maxListener` controls the maximum number of listeners per event before Node emits a memory-leak warning.
20
- * @default 10
21
- */
22
- constructor(maxListener?: number);
23
- /**
24
- * Emits an event and awaits all registered listeners in parallel.
25
- * Throws if any listener rejects, wrapping the cause with the event name and serialized arguments.
26
- */
27
- emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArgs: TEvents[TEventName]): Promise<void>;
28
- /** Registers a persistent listener for the given event. */
29
- on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: AsyncListener<TEvents[TEventName]>): void;
30
- /** Registers a one-shot listener that removes itself after the first invocation. */
31
- onOnce<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: AsyncListener<TEvents[TEventName]>): void;
32
- /** Removes a previously registered listener. */
33
- off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: AsyncListener<TEvents[TEventName]>): void;
34
- /** Removes all listeners from every event channel. */
35
- removeAll(): void;
36
- }
37
- //#endregion
38
10
  //#region ../plugin-oas/src/types.d.ts
39
11
  type GetOasOptions = {
40
12
  validate?: boolean;
@@ -161,7 +133,7 @@ declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = P
161
133
  method: HttpMethod;
162
134
  operation: Operation;
163
135
  }>>;
164
- build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
136
+ build(...generators: Array<Generator<TPluginOptions, Version>>): Promise<Array<KubbFile.File<TFileMeta>>>;
165
137
  }
166
138
  //#endregion
167
139
  //#region ../plugin-oas/src/SchemaMapper.d.ts
@@ -451,32 +423,46 @@ declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGe
451
423
  static deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): Array<SchemaKeywordMapper[T]>;
452
424
  static find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
453
425
  static combineObjects(tree: Schema[] | undefined): Schema[];
454
- build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
426
+ build(...generators: Array<Generator<TPluginOptions, Version>>): Promise<Array<KubbFile.File<TFileMeta>>>;
455
427
  }
456
428
  //#endregion
457
429
  //#region ../plugin-oas/src/generators/createGenerator.d.ts
458
- type CoreGenerator<TOptions extends PluginFactoryOptions> = {
430
+ type CoreGenerator<TOptions extends PluginFactoryOptions, TVersion extends Version> = {
459
431
  name: string;
460
432
  type: 'core';
461
- operations: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>;
462
- operation: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>;
463
- schema: (props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>;
433
+ version: TVersion;
434
+ operations: (props: OperationsProps<TOptions, TVersion>) => Promise<KubbFile.File[]>;
435
+ operation: (props: OperationProps<TOptions, TVersion>) => Promise<KubbFile.File[]>;
436
+ schema: (props: SchemaProps<TOptions, TVersion>) => Promise<KubbFile.File[]>;
464
437
  };
465
438
  //#endregion
466
439
  //#region ../plugin-oas/src/generators/types.d.ts
467
- type OperationsProps<TOptions extends PluginFactoryOptions> = {
440
+ type Version = '1' | '2';
441
+ type OperationsV1Props<TOptions extends PluginFactoryOptions> = {
468
442
  config: Config;
469
443
  generator: Omit<OperationGenerator<TOptions>, 'build'>;
470
444
  plugin: Plugin<TOptions>;
471
445
  operations: Array<Operation>;
472
446
  };
473
- type OperationProps<TOptions extends PluginFactoryOptions> = {
447
+ type OperationsV2Props<TOptions extends PluginFactoryOptions> = {
448
+ config: Config;
449
+ plugin: Plugin<TOptions>;
450
+ nodes: Array<OperationNode>;
451
+ };
452
+ type OperationV1Props<TOptions extends PluginFactoryOptions> = {
474
453
  config: Config;
475
454
  generator: Omit<OperationGenerator<TOptions>, 'build'>;
476
455
  plugin: Plugin<TOptions>;
477
456
  operation: Operation;
478
457
  };
479
- type SchemaProps<TOptions extends PluginFactoryOptions> = {
458
+ type OperationV2Props<TOptions extends PluginFactoryOptions> = {
459
+ config: Config;
460
+ plugin: Plugin<TOptions>;
461
+ node: OperationNode;
462
+ };
463
+ type OperationsProps<TOptions extends PluginFactoryOptions, TVersion extends Version = '1'> = TVersion extends '2' ? OperationsV2Props<TOptions> : OperationsV1Props<TOptions>;
464
+ type OperationProps<TOptions extends PluginFactoryOptions, TVersion extends Version = '1'> = TVersion extends '2' ? OperationV2Props<TOptions> : OperationV1Props<TOptions>;
465
+ type SchemaV1Props<TOptions extends PluginFactoryOptions> = {
480
466
  config: Config;
481
467
  generator: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>;
482
468
  plugin: Plugin<TOptions>;
@@ -486,22 +472,29 @@ type SchemaProps<TOptions extends PluginFactoryOptions> = {
486
472
  value: SchemaObject;
487
473
  };
488
474
  };
489
- type Generator<TOptions extends PluginFactoryOptions> = CoreGenerator<TOptions> | ReactGenerator<TOptions>;
475
+ type SchemaV2Props<TOptions extends PluginFactoryOptions> = {
476
+ config: Config;
477
+ plugin: Plugin<TOptions>;
478
+ node: SchemaNode;
479
+ };
480
+ type SchemaProps<TOptions extends PluginFactoryOptions, TVersion extends Version = '1'> = TVersion extends '2' ? SchemaV2Props<TOptions> : SchemaV1Props<TOptions>;
481
+ type Generator<TOptions extends PluginFactoryOptions, TVersion extends Version = Version> = CoreGenerator<TOptions, TVersion> | ReactGenerator<TOptions, TVersion>;
490
482
  //#endregion
491
483
  //#region ../plugin-oas/src/generators/createReactGenerator.d.ts
492
- type ReactGenerator<TOptions extends PluginFactoryOptions> = {
484
+ type ReactGenerator<TOptions extends PluginFactoryOptions, TVersion extends Version> = {
493
485
  name: string;
494
486
  type: 'react';
495
- Operations: (props: OperationsProps<TOptions>) => FabricReactNode;
496
- Operation: (props: OperationProps<TOptions>) => FabricReactNode;
497
- Schema: (props: SchemaProps<TOptions>) => FabricReactNode;
487
+ version: TVersion;
488
+ Operations: (props: OperationsProps<TOptions, TVersion>) => FabricReactNode;
489
+ Operation: (props: OperationProps<TOptions, TVersion>) => FabricReactNode;
490
+ Schema: (props: SchemaProps<TOptions, TVersion>) => FabricReactNode;
498
491
  };
499
492
  //#endregion
500
493
  //#region src/generators/mcpGenerator.d.ts
501
- declare const mcpGenerator: ReactGenerator<PluginMcp>;
494
+ declare const mcpGenerator: ReactGenerator<PluginMcp, "1">;
502
495
  //#endregion
503
496
  //#region src/generators/serverGenerator.d.ts
504
- declare const serverGenerator: ReactGenerator<PluginMcp>;
497
+ declare const serverGenerator: ReactGenerator<PluginMcp, "1">;
505
498
  //#endregion
506
499
  export { mcpGenerator, serverGenerator };
507
500
  //# sourceMappingURL=generators.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-mcp",
3
- "version": "4.34.0",
3
+ "version": "4.35.0",
4
4
  "description": "Model Context Protocol (MCP) plugin for Kubb, generating MCP-compatible tools and schemas from OpenAPI specifications for AI assistants.",
5
5
  "keywords": [
6
6
  "mcp",
@@ -74,12 +74,12 @@
74
74
  ],
75
75
  "dependencies": {
76
76
  "@kubb/react-fabric": "0.13.3",
77
- "@kubb/core": "4.34.0",
78
- "@kubb/oas": "4.34.0",
79
- "@kubb/plugin-client": "4.34.0",
80
- "@kubb/plugin-oas": "4.34.0",
81
- "@kubb/plugin-ts": "4.34.0",
82
- "@kubb/plugin-zod": "4.34.0"
77
+ "@kubb/core": "4.35.0",
78
+ "@kubb/oas": "4.35.0",
79
+ "@kubb/plugin-client": "4.35.0",
80
+ "@kubb/plugin-oas": "4.35.0",
81
+ "@kubb/plugin-ts": "4.35.0",
82
+ "@kubb/plugin-zod": "4.35.0"
83
83
  },
84
84
  "devDependencies": {
85
85
  "@internals/utils": "0.0.0"