@kubb/plugin-mcp 4.29.1 → 4.31.1
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.
- package/dist/components.d.ts +2 -2
- package/dist/generators.d.ts +5 -5
- package/dist/index.d.ts +2 -2
- package/package.json +10 -9
- package/dist/types-DigTVU-V.d.ts +0 -64
- package/src/generators/__snapshots__/.mcp.json +0 -9
- package/src/generators/__snapshots__/createPet.ts +0 -28
- package/src/generators/__snapshots__/deletePet.ts +0 -18
- package/src/generators/__snapshots__/getPets.ts +0 -20
- package/src/generators/__snapshots__/getPetsTemplateString.ts +0 -12
- package/src/generators/__snapshots__/server.ts +0 -44
- package/src/generators/__snapshots__/showPetById.ts +0 -25
package/dist/components.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as __name } from "./chunk-
|
|
2
|
-
import { KubbFile } from "@kubb/fabric-core/types";
|
|
1
|
+
import { t as __name } from "./chunk-DKWOrOAv.js";
|
|
3
2
|
import { OperationSchemas } from "@kubb/plugin-oas";
|
|
3
|
+
import { KubbFile } from "@kubb/fabric-core/types";
|
|
4
4
|
import { FabricReactNode } from "@kubb/react-fabric/types";
|
|
5
5
|
|
|
6
6
|
//#region src/components/Server.d.ts
|
package/dist/generators.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { t as __name } from "./chunk-
|
|
2
|
-
import { n as PluginMcp } from "./types-
|
|
3
|
-
import { KubbFile } from "@kubb/fabric-core/types";
|
|
4
|
-
import { FabricReactNode } from "@kubb/react-fabric/types";
|
|
1
|
+
import { t as __name } from "./chunk-DKWOrOAv.js";
|
|
2
|
+
import { n as PluginMcp } from "./types-BTZNpUo1.js";
|
|
5
3
|
import { BaseGenerator, Config, FileMetaBase, Group, KubbEvents, Output, Plugin, PluginFactoryOptions, PluginManager, ResolveNameParams } from "@kubb/core";
|
|
4
|
+
import { Fabric } from "@kubb/react-fabric";
|
|
6
5
|
import { HttpMethod, Oas, Operation, SchemaObject, contentType } from "@kubb/oas";
|
|
6
|
+
import { KubbFile } from "@kubb/fabric-core/types";
|
|
7
|
+
import { FabricReactNode } from "@kubb/react-fabric/types";
|
|
7
8
|
import { AsyncEventEmitter } from "@kubb/core/utils";
|
|
8
|
-
import { Fabric } from "@kubb/react-fabric";
|
|
9
9
|
|
|
10
10
|
//#region ../plugin-oas/src/types.d.ts
|
|
11
11
|
type GetOasOptions = {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as __name } from "./chunk-
|
|
2
|
-
import { n as PluginMcp, t as Options } from "./types-
|
|
1
|
+
import { t as __name } from "./chunk-DKWOrOAv.js";
|
|
2
|
+
import { n as PluginMcp, t as Options } from "./types-BTZNpUo1.js";
|
|
3
3
|
import * as _kubb_core0 from "@kubb/core";
|
|
4
4
|
|
|
5
5
|
//#region src/plugin.d.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-mcp",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.31.1",
|
|
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",
|
|
@@ -62,7 +62,8 @@
|
|
|
62
62
|
"src",
|
|
63
63
|
"dist",
|
|
64
64
|
"!/**/**.test.**",
|
|
65
|
-
"!/**/__tests__/**"
|
|
65
|
+
"!/**/__tests__/**",
|
|
66
|
+
"!/**/__snapshots__/**"
|
|
66
67
|
],
|
|
67
68
|
"size-limit": [
|
|
68
69
|
{
|
|
@@ -72,13 +73,13 @@
|
|
|
72
73
|
}
|
|
73
74
|
],
|
|
74
75
|
"dependencies": {
|
|
75
|
-
"@kubb/react-fabric": "0.13.
|
|
76
|
-
"@kubb/core": "4.
|
|
77
|
-
"@kubb/oas": "4.
|
|
78
|
-
"@kubb/plugin-client": "4.
|
|
79
|
-
"@kubb/plugin-oas": "4.
|
|
80
|
-
"@kubb/plugin-ts": "4.
|
|
81
|
-
"@kubb/plugin-zod": "4.
|
|
76
|
+
"@kubb/react-fabric": "0.13.3",
|
|
77
|
+
"@kubb/core": "4.31.1",
|
|
78
|
+
"@kubb/oas": "4.31.1",
|
|
79
|
+
"@kubb/plugin-client": "4.31.1",
|
|
80
|
+
"@kubb/plugin-oas": "4.31.1",
|
|
81
|
+
"@kubb/plugin-ts": "4.31.1",
|
|
82
|
+
"@kubb/plugin-zod": "4.31.1"
|
|
82
83
|
},
|
|
83
84
|
"devDependencies": {},
|
|
84
85
|
"engines": {
|
package/dist/types-DigTVU-V.d.ts
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { t as __name } from "./chunk-cy2TeOE5.cjs";
|
|
2
|
-
import { Exclude, Include, Override, ResolvePathOptions } from "@kubb/plugin-oas";
|
|
3
|
-
import { Group, Output, PluginFactoryOptions, ResolveNameParams } from "@kubb/core";
|
|
4
|
-
import { Oas, contentType } from "@kubb/oas";
|
|
5
|
-
import { ClientImportPath, PluginClient } from "@kubb/plugin-client";
|
|
6
|
-
import { Generator } from "@kubb/plugin-oas/generators";
|
|
7
|
-
|
|
8
|
-
//#region src/types.d.ts
|
|
9
|
-
type Options = {
|
|
10
|
-
/**
|
|
11
|
-
* Specify the export location for the files and define the behavior of the output
|
|
12
|
-
* @default { path: 'mcp', barrelType: 'named' }
|
|
13
|
-
*/
|
|
14
|
-
output?: Output<Oas>;
|
|
15
|
-
/**
|
|
16
|
-
* Define which contentType should be used.
|
|
17
|
-
* By default, the first JSON valid mediaType is used
|
|
18
|
-
*/
|
|
19
|
-
contentType?: contentType;
|
|
20
|
-
client?: ClientImportPath & Pick<PluginClient['options'], 'clientType' | 'dataReturnType' | 'baseURL' | 'bundle' | 'paramsCasing'>;
|
|
21
|
-
/**
|
|
22
|
-
* Transform parameter names to a specific casing format.
|
|
23
|
-
* When set to 'camelcase', parameter names in path, query, and header params will be transformed to camelCase.
|
|
24
|
-
* This should match the paramsCasing setting used in @kubb/plugin-ts.
|
|
25
|
-
* @default undefined
|
|
26
|
-
*/
|
|
27
|
-
paramsCasing?: 'camelcase';
|
|
28
|
-
/**
|
|
29
|
-
* Group the mcp requests based on the provided name.
|
|
30
|
-
*/
|
|
31
|
-
group?: Group;
|
|
32
|
-
/**
|
|
33
|
-
* Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
|
|
34
|
-
*/
|
|
35
|
-
exclude?: Array<Exclude>;
|
|
36
|
-
/**
|
|
37
|
-
* Array containing include parameters to include tags/operations/methods/paths.
|
|
38
|
-
*/
|
|
39
|
-
include?: Array<Include>;
|
|
40
|
-
/**
|
|
41
|
-
* Array containing override parameters to override `options` based on tags/operations/methods/paths.
|
|
42
|
-
*/
|
|
43
|
-
override?: Array<Override<ResolvedOptions>>;
|
|
44
|
-
transformers?: {
|
|
45
|
-
/**
|
|
46
|
-
* Customize the names based on the type that is provided by the plugin.
|
|
47
|
-
*/
|
|
48
|
-
name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
|
|
49
|
-
};
|
|
50
|
-
/**
|
|
51
|
-
* Define some generators next to the Mcp generators.
|
|
52
|
-
*/
|
|
53
|
-
generators?: Array<Generator<PluginMcp>>;
|
|
54
|
-
};
|
|
55
|
-
type ResolvedOptions = {
|
|
56
|
-
output: Output<Oas>;
|
|
57
|
-
group: Options['group'];
|
|
58
|
-
client: Pick<PluginClient['options'], 'client' | 'clientType' | 'dataReturnType' | 'importPath' | 'baseURL' | 'bundle' | 'paramsCasing'>;
|
|
59
|
-
paramsCasing: Options['paramsCasing'];
|
|
60
|
-
};
|
|
61
|
-
type PluginMcp = PluginFactoryOptions<'plugin-mcp', Options, ResolvedOptions, never, ResolvePathOptions>;
|
|
62
|
-
//#endregion
|
|
63
|
-
export { PluginMcp as n, Options as t };
|
|
64
|
-
//# sourceMappingURL=types-DigTVU-V.d.ts.map
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { ResponseErrorConfig } from './test/.kubb/fetch'
|
|
2
|
-
import type { CallToolResult } from '@modelcontextprotocol/sdk/types'
|
|
3
|
-
import { fetch } from './test/.kubb/fetch'
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @description Creates a pet in the store.
|
|
7
|
-
* This is an arbitrary description with lots of `strange` but likely formatting from the real world.
|
|
8
|
-
* - We like to make lists - And we need to escape: some, type, of `things`
|
|
9
|
-
* @summary Create a pet
|
|
10
|
-
* {@link /pets}
|
|
11
|
-
*/
|
|
12
|
-
export async function createPetsHandler({ data }: { data: CreatePetsMutationRequest }): Promise<Promise<CallToolResult>> {
|
|
13
|
-
const requestData = data
|
|
14
|
-
|
|
15
|
-
const res = await fetch<CreatePetsMutationResponse, ResponseErrorConfig<Error>, CreatePetsMutationRequest>({
|
|
16
|
-
method: 'POST',
|
|
17
|
-
url: `/pets`,
|
|
18
|
-
data: requestData,
|
|
19
|
-
})
|
|
20
|
-
return {
|
|
21
|
-
content: [
|
|
22
|
-
{
|
|
23
|
-
type: 'text',
|
|
24
|
-
text: JSON.stringify(res.data),
|
|
25
|
-
},
|
|
26
|
-
],
|
|
27
|
-
}
|
|
28
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { ResponseErrorConfig } from './test/.kubb/fetch'
|
|
2
|
-
import type { CallToolResult } from '@modelcontextprotocol/sdk/types'
|
|
3
|
-
import { fetch } from './test/.kubb/fetch'
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* {@link /pets/:petId}
|
|
7
|
-
*/
|
|
8
|
-
export async function deletePetsPetidHandler(): Promise<Promise<CallToolResult>> {
|
|
9
|
-
const res = await fetch<DeletePetsPetidMutationResponse, ResponseErrorConfig<Error>, unknown>({ method: 'DELETE', url: `/pets/${petId}` })
|
|
10
|
-
return {
|
|
11
|
-
content: [
|
|
12
|
-
{
|
|
13
|
-
type: 'text',
|
|
14
|
-
text: JSON.stringify(res.data),
|
|
15
|
-
},
|
|
16
|
-
],
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { ResponseErrorConfig } from './test/.kubb/fetch'
|
|
2
|
-
import type { CallToolResult } from '@modelcontextprotocol/sdk/types'
|
|
3
|
-
import { fetch } from './test/.kubb/fetch'
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @description Returns all `pets` from the system \n that the user has access to
|
|
7
|
-
* @summary List all pets
|
|
8
|
-
* {@link /pets}
|
|
9
|
-
*/
|
|
10
|
-
export async function listPetsHandler({ params }: { params?: ListPetsQueryParams } = {}): Promise<Promise<CallToolResult>> {
|
|
11
|
-
const res = await fetch<ListPetsQueryResponse, ResponseErrorConfig<Error>, unknown>({ method: 'GET', url: `/pets`, params })
|
|
12
|
-
return {
|
|
13
|
-
content: [
|
|
14
|
-
{
|
|
15
|
-
type: 'text',
|
|
16
|
-
text: JSON.stringify(res.data),
|
|
17
|
-
},
|
|
18
|
-
],
|
|
19
|
-
}
|
|
20
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { ResponseErrorConfig } from './test/.kubb/fetch'
|
|
2
|
-
import type { CallToolResult } from '@modelcontextprotocol/sdk/types'
|
|
3
|
-
import { fetch } from './test/.kubb/fetch'
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @description Returns all `pets` from the system \n that the user has access to
|
|
7
|
-
* @summary List all pets
|
|
8
|
-
* {@link /pets}
|
|
9
|
-
*/
|
|
10
|
-
export async function listPetsHandler({ params }: { params?: ListPetsQueryParams } = {}): Promise<Promise<CallToolResult>> {
|
|
11
|
-
const res = await fetch<ListPetsQueryResponse, ResponseErrorConfig<Error>, unknown>({ method: 'GET', url: `/pets`, baseURL: `${123456}`, params })
|
|
12
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generated by Kubb (https://kubb.dev/).
|
|
3
|
-
* Do not edit manually.
|
|
4
|
-
*/
|
|
5
|
-
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp'
|
|
6
|
-
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio'
|
|
7
|
-
import { createPetsHandler, createPetsMutationRequest, listPetsHandler, listPetsQueryParams, showPetByIdHandler, showPetByIdPathParams } from './showPetById'
|
|
8
|
-
|
|
9
|
-
export const server = new McpServer({
|
|
10
|
-
name: 'Swagger PetStore',
|
|
11
|
-
version: '3.0.0',
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
server.tool('listPets', 'Returns all `pets` from the system \\n that the user has access to', { params: listPetsQueryParams }, async ({ params }) => {
|
|
15
|
-
return listPetsHandler({ params })
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
server.tool(
|
|
19
|
-
'createPets',
|
|
20
|
-
'Creates a pet in the store.\nThis is an arbitrary description with lots of `strange` but likely formatting from the real world.\n- We like to make lists - And we need to escape: some, type, of `things`\n',
|
|
21
|
-
{ data: createPetsMutationRequest },
|
|
22
|
-
async ({ data }) => {
|
|
23
|
-
return createPetsHandler({ data })
|
|
24
|
-
},
|
|
25
|
-
)
|
|
26
|
-
|
|
27
|
-
server.tool(
|
|
28
|
-
'showPetById',
|
|
29
|
-
'Make a GET request to /pets/{petId}',
|
|
30
|
-
{ petId: showPetByIdPathParams.shape['petId'], testId: showPetByIdPathParams.shape['testId'] },
|
|
31
|
-
async ({ petId, testId }) => {
|
|
32
|
-
return showPetByIdHandler({ petId, testId })
|
|
33
|
-
},
|
|
34
|
-
)
|
|
35
|
-
|
|
36
|
-
export async function startServer() {
|
|
37
|
-
try {
|
|
38
|
-
const transport = new StdioServerTransport()
|
|
39
|
-
await server.connect(transport)
|
|
40
|
-
} catch (error) {
|
|
41
|
-
console.error('Failed to start server:', error)
|
|
42
|
-
process.exit(1)
|
|
43
|
-
}
|
|
44
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { ResponseErrorConfig } from './test/.kubb/fetch'
|
|
2
|
-
import type { CallToolResult } from '@modelcontextprotocol/sdk/types'
|
|
3
|
-
import { fetch } from './test/.kubb/fetch'
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @summary Info for a specific pet
|
|
7
|
-
* {@link /pets/:petId}
|
|
8
|
-
*/
|
|
9
|
-
export async function showPetByIdHandler({
|
|
10
|
-
petId,
|
|
11
|
-
testId,
|
|
12
|
-
}: {
|
|
13
|
-
petId: ShowPetByIdPathParams['petId']
|
|
14
|
-
testId: ShowPetByIdPathParams['testId']
|
|
15
|
-
}): Promise<Promise<CallToolResult>> {
|
|
16
|
-
const res = await fetch<ShowPetByIdQueryResponse, ResponseErrorConfig<Error>, unknown>({ method: 'GET', url: `/pets/${petId}` })
|
|
17
|
-
return {
|
|
18
|
-
content: [
|
|
19
|
-
{
|
|
20
|
-
type: 'text',
|
|
21
|
-
text: JSON.stringify(res.data),
|
|
22
|
-
},
|
|
23
|
-
],
|
|
24
|
-
}
|
|
25
|
-
}
|