@kya-os/create-mcpi-app 1.9.33 → 1.9.34

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.
Files changed (55) hide show
  1. package/.turbo/turbo-build.log +16 -12
  2. package/.turbo/turbo-test$colon$coverage.log +1829 -0
  3. package/.turbo/turbo-test.log +628 -0
  4. package/dist/bundles/blank.js +94964 -81677
  5. package/dist/bundles/ecommerce.js +94964 -81677
  6. package/dist/bundles/hardware-world.js +94979 -81692
  7. package/dist/bundles/manifest.json +14 -9
  8. package/dist/bundles/mix-station.js +112480 -0
  9. package/dist/cli-runner.d.ts.map +1 -1
  10. package/dist/cli-runner.js +23 -0
  11. package/dist/cli-runner.js.map +1 -1
  12. package/dist/helpers/fetch-cloudflare-mcpi-template.js +1 -1
  13. package/dist/helpers/generate-cloudflare-files.d.ts +1 -1
  14. package/dist/helpers/generate-cloudflare-files.d.ts.map +1 -1
  15. package/dist/helpers/generate-cloudflare-files.js +441 -7
  16. package/dist/helpers/generate-cloudflare-files.js.map +1 -1
  17. package/dist/helpers/generate-openapi-project.d.ts +36 -0
  18. package/dist/helpers/generate-openapi-project.d.ts.map +1 -0
  19. package/dist/helpers/generate-openapi-project.js +114 -0
  20. package/dist/helpers/generate-openapi-project.js.map +1 -0
  21. package/dist/helpers/generate-openapi-tools.d.ts +43 -0
  22. package/dist/helpers/generate-openapi-tools.d.ts.map +1 -0
  23. package/dist/helpers/generate-openapi-tools.js +550 -0
  24. package/dist/helpers/generate-openapi-tools.js.map +1 -0
  25. package/dist/helpers/generate-runtime-config.d.ts +16 -0
  26. package/dist/helpers/generate-runtime-config.d.ts.map +1 -0
  27. package/dist/helpers/generate-runtime-config.js +49 -0
  28. package/dist/helpers/generate-runtime-config.js.map +1 -0
  29. package/dist/helpers/get-package-versions.js +3 -3
  30. package/dist/helpers/get-package-versions.js.map +1 -1
  31. package/dist/helpers/openapi-ingestion.d.ts +21 -0
  32. package/dist/helpers/openapi-ingestion.d.ts.map +1 -0
  33. package/dist/helpers/openapi-ingestion.js +433 -0
  34. package/dist/helpers/openapi-ingestion.js.map +1 -0
  35. package/dist/helpers/wrap/command.d.ts +12 -0
  36. package/dist/helpers/wrap/command.d.ts.map +1 -0
  37. package/dist/helpers/wrap/command.js +344 -0
  38. package/dist/helpers/wrap/command.js.map +1 -0
  39. package/dist/helpers/wrap/detect-server.d.ts +30 -0
  40. package/dist/helpers/wrap/detect-server.d.ts.map +1 -0
  41. package/dist/helpers/wrap/detect-server.js +207 -0
  42. package/dist/helpers/wrap/detect-server.js.map +1 -0
  43. package/dist/helpers/wrap/index.d.ts +13 -0
  44. package/dist/helpers/wrap/index.d.ts.map +1 -0
  45. package/dist/helpers/wrap/index.js +11 -0
  46. package/dist/helpers/wrap/index.js.map +1 -0
  47. package/dist/helpers/wrap/templates.d.ts +24 -0
  48. package/dist/helpers/wrap/templates.d.ts.map +1 -0
  49. package/dist/helpers/wrap/templates.js +221 -0
  50. package/dist/helpers/wrap/templates.js.map +1 -0
  51. package/dist/types/openapi-generator.d.ts +142 -0
  52. package/dist/types/openapi-generator.d.ts.map +1 -0
  53. package/dist/types/openapi-generator.js +8 -0
  54. package/dist/types/openapi-generator.js.map +1 -0
  55. package/package.json +31 -9
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Wrapper Code Templates
3
+ *
4
+ * Generates the wrapper code that adds MCP-I identity verification
5
+ * to an existing MCP server.
6
+ */
7
+ import type { ServerDetection } from "./detect-server.js";
8
+ export interface WrapConfig {
9
+ verificationLevel: 1 | 2 | 3;
10
+ protectedTools: string[] | "all";
11
+ registerOnKnowThat: boolean;
12
+ connectToCheckpoint: boolean;
13
+ serverName: string;
14
+ reputationThreshold: number;
15
+ }
16
+ export interface GeneratedFiles {
17
+ filename: string;
18
+ content: string;
19
+ }
20
+ /**
21
+ * Generate wrapper code based on server detection and config.
22
+ */
23
+ export declare function generateWrapper(detection: ServerDetection, config: WrapConfig): GeneratedFiles[];
24
+ //# sourceMappingURL=templates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../../src/helpers/wrap/templates.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAwB,MAAM,oBAAoB,CAAC;AAIhF,MAAM,WAAW,UAAU;IACzB,iBAAiB,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC7B,cAAc,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IACjC,kBAAkB,EAAE,OAAO,CAAC;IAC5B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,mBAAmB,EAAE,MAAM,CAAC;CAC7B;AAwMD,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,eAAe,EAC1B,MAAM,EAAE,UAAU,GACjB,cAAc,EAAE,CAuBlB"}
@@ -0,0 +1,221 @@
1
+ /**
2
+ * Wrapper Code Templates
3
+ *
4
+ * Generates the wrapper code that adds MCP-I identity verification
5
+ * to an existing MCP server.
6
+ */
7
+ // ── Template Helpers ─────────────────────────────────────────────
8
+ function getExtension(detection) {
9
+ return detection.language === "typescript" ? "ts" : "js";
10
+ }
11
+ function getToolPoliciesBlock(config, tools) {
12
+ if (config.protectedTools === "all" || config.protectedTools.length === 0) {
13
+ return "";
14
+ }
15
+ const entries = config.protectedTools
16
+ .map((t) => ` "${t}": { requireVerification: true }`)
17
+ .join(",\n");
18
+ return `
19
+ toolPolicies: {
20
+ ${entries}
21
+ },`;
22
+ }
23
+ // ── HTTP Wrapper (Express/Fastify/Hono) ──────────────────────────
24
+ function generateHttpWrapper(detection, config) {
25
+ const isTs = detection.language === "typescript";
26
+ // Generate framework-appropriate imports and middleware
27
+ const verifierImport = detection.framework === "hono"
28
+ ? 'import { verifyHono } from "@kya-os/verifier/hono";'
29
+ : detection.framework === "fastify"
30
+ ? 'import { verifyFastify } from "@kya-os/verifier/fastify";'
31
+ : 'import { verifyExpress } from "@kya-os/verifier";';
32
+ const typeImport = isTs && detection.framework === "express"
33
+ ? 'import type { Request, Response, NextFunction } from "express";\n'
34
+ : "";
35
+ return `${isTs ? "" : "// @ts-check\n"}/**
36
+ * MCP-I Identity Wrapper
37
+ *
38
+ * Generated by create-mcpi-app wrap
39
+ * Adds agent identity verification to your MCP server.
40
+ *
41
+ * Run with: ${detection.packageManager} run start
42
+ */
43
+
44
+ ${typeImport}${verifierImport}
45
+ ${config.reputationThreshold > 0 ? 'import { createReputationGuard } from "@kya-os/verifier/reputation";' : ""}
46
+
47
+ // ── Configuration ────────────────────────────────────────────────
48
+
49
+ const MCPI_CONFIG = {
50
+ /** Server DID (generated during setup, stored in .env) */
51
+ serverDid: process.env.MCPI_SERVER_DID,
52
+
53
+ /** Identity verification level: 1=DID only, 2=DID+Registry, 3=DID+Delegation */
54
+ verificationLevel: ${config.verificationLevel},
55
+
56
+ /** KnowThat.ai registry URL */
57
+ registryUrl: "https://knowthat.ai",
58
+ ${config.connectToCheckpoint ? `\n /** Checkpoint project for monitoring */\n checkpointProjectId: process.env.CHECKPOINT_PROJECT_ID,\n` : ""}};
59
+
60
+ // ── Middleware Setup ─────────────────────────────────────────────
61
+
62
+ /**
63
+ * MCP-I verification middleware.
64
+ * Validates that connecting agents have a valid identity proof.
65
+ */
66
+ export const mcpiVerify = ${detection.framework === "hono" ? "verifyHono" : detection.framework === "fastify" ? "verifyFastify" : "verifyExpress"}({
67
+ audience: MCPI_CONFIG.serverDid,
68
+ verificationLevel: MCPI_CONFIG.verificationLevel,
69
+ registryUrl: MCPI_CONFIG.registryUrl,
70
+ allowlist: process.env.MCPI_ALLOWLIST?.split(","),
71
+ });
72
+ ${config.reputationThreshold > 0
73
+ ? `
74
+ /**
75
+ * Reputation guard middleware.
76
+ * Blocks agents with reputation score below threshold.
77
+ */
78
+ export const reputationGuard = createReputationGuard({
79
+ threshold: ${config.reputationThreshold},
80
+ registryUrl: "https://knowthat.ai",
81
+ });
82
+ `
83
+ : ""}
84
+ // ── Integration Instructions ─────────────────────────────────────
85
+ //
86
+ // Add to your server's middleware chain:
87
+ //
88
+ // ${detection.framework === "express" ? "app.use('/mcp', mcpiVerify);" : detection.framework === "hono" ? "app.use('/mcp/*', mcpiVerify);" : detection.framework === "fastify" ? "app.register(mcpiVerify);" : "// Add mcpiVerify to your route handlers"}
89
+ // ${config.reputationThreshold > 0 ? (detection.framework === "express" ? "app.use('/mcp', reputationGuard);" : "// Add reputationGuard to your route handlers") : ""}
90
+ //
91
+ // The verified agent context is available at: req.ctx.agent
92
+ // - req.ctx.agent.did - The agent's DID
93
+ // - req.ctx.agent.level - Verification level achieved
94
+ // - req.ctx.agent.proof - The original proof object
95
+ //
96
+ // For tool-level policies, wrap individual handlers:
97
+ //
98
+ // app.post('/mcp/tools/delete_document', mcpiVerify, (req, res) => { ... });
99
+ //
100
+ `;
101
+ }
102
+ // ── Stdio Wrapper ────────────────────────────────────────────────
103
+ function generateStdioWrapper(detection, config) {
104
+ const isTs = detection.language === "typescript";
105
+ // For TS projects, point to the compiled output in dist/
106
+ // findEntryPoint maps dist/index.js → src/index.ts for analysis,
107
+ // so we reverse that mapping for the runtime command
108
+ let entryForNode;
109
+ if (isTs) {
110
+ // If entry was mapped from dist/ to src/, point back to dist/
111
+ const distPath = detection.entryPoint
112
+ .replace(/^src\//, "dist/")
113
+ .replace(/\.ts$/, ".js");
114
+ entryForNode = "./" + distPath;
115
+ }
116
+ else {
117
+ entryForNode = "./" + detection.entryPoint.replace(/^\.\//, "");
118
+ }
119
+ return `${isTs ? "" : "// @ts-check\n"}/**
120
+ * MCP-I Stdio Wrapper
121
+ *
122
+ * Generated by create-mcpi-app wrap
123
+ * Wraps your stdio-based MCP server with agent identity verification.
124
+ *
125
+ * Original entry: ${detection.entryPoint}
126
+ * Run with: ${detection.packageManager} run start
127
+ */
128
+
129
+ import { McpiStdioProxy } from "@kya-os/mcp-i/stdio";
130
+
131
+ // ── Configuration ────────────────────────────────────────────────
132
+
133
+ const MCPI_CONFIG = {
134
+ /** Server DID (generated during setup, stored in .env) */
135
+ serverDid: process.env.MCPI_SERVER_DID || "",
136
+
137
+ /** Identity verification level */
138
+ verificationLevel: ${config.verificationLevel}${isTs ? " as const" : ""},
139
+
140
+ /** Registry URL for agent lookups */
141
+ registryUrl: "https://knowthat.ai",
142
+ ${config.reputationThreshold > 0
143
+ ? `
144
+ /** Minimum reputation score to allow tool calls */
145
+ reputationThreshold: ${config.reputationThreshold},
146
+ `
147
+ : ""}${getToolPoliciesBlock(config, detection.tools)}
148
+ };
149
+
150
+ // ── Start Wrapped Server ─────────────────────────────────────────
151
+
152
+ async function main() {
153
+ const proxy = new McpiStdioProxy({
154
+ command: "${detection.packageManager === "bun" ? "bun" : "node"}",
155
+ args: ["${entryForNode}"],
156
+ ...MCPI_CONFIG,
157
+ });
158
+
159
+ await proxy.start();
160
+
161
+ // Graceful shutdown
162
+ process.on("SIGINT", async () => {
163
+ await proxy.stop();
164
+ process.exit(0);
165
+ });
166
+ process.on("SIGTERM", async () => {
167
+ await proxy.stop();
168
+ process.exit(0);
169
+ });
170
+ }
171
+
172
+ main().catch((err) => {
173
+ console.error("Failed to start MCP-I wrapped server:", err);
174
+ process.exit(1);
175
+ });
176
+ `;
177
+ }
178
+ /**
179
+ * Generate wrapper code based on server detection and config.
180
+ */
181
+ export function generateWrapper(detection, config) {
182
+ const ext = getExtension(detection);
183
+ const files = [];
184
+ if (detection.transport === "stdio") {
185
+ files.push({
186
+ filename: `mcpi-wrapper.${ext}`,
187
+ content: generateStdioWrapper(detection, config),
188
+ });
189
+ }
190
+ else {
191
+ files.push({
192
+ filename: `mcpi-middleware.${ext}`,
193
+ content: generateHttpWrapper(detection, config),
194
+ });
195
+ }
196
+ // Generate .env.example
197
+ files.push({
198
+ filename: ".env.mcpi.example",
199
+ content: generateEnvExample(config),
200
+ });
201
+ return files;
202
+ }
203
+ function generateEnvExample(config) {
204
+ let content = `# MCP-I Configuration (generated by create-mcpi-app wrap)
205
+ # Copy this to .env and fill in the values.
206
+
207
+ # Server DID - auto-generated during setup
208
+ MCPI_SERVER_DID=
209
+
210
+ # Agent allowlist (comma-separated DIDs, optional)
211
+ # MCPI_ALLOWLIST=did:key:z6Mk...,did:key:z6Mk...
212
+ `;
213
+ if (config.connectToCheckpoint) {
214
+ content += `
215
+ # Checkpoint project ID for monitoring
216
+ CHECKPOINT_PROJECT_ID=
217
+ `;
218
+ }
219
+ return content;
220
+ }
221
+ //# sourceMappingURL=templates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/helpers/wrap/templates.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAeH,oEAAoE;AAEpE,SAAS,YAAY,CAAC,SAA0B;IAC9C,OAAO,SAAS,CAAC,QAAQ,KAAK,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AAC3D,CAAC;AAED,SAAS,oBAAoB,CAC3B,MAAkB,EAClB,KAA+B;IAE/B,IAAI,MAAM,CAAC,cAAc,KAAK,KAAK,IAAI,MAAM,CAAC,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1E,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,CAAC,cAAc;SAClC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC;SACvD,IAAI,CAAC,KAAK,CAAC,CAAC;IAEf,OAAO;;EAEP,OAAO;KACJ,CAAC;AACN,CAAC;AAED,oEAAoE;AAEpE,SAAS,mBAAmB,CAC1B,SAA0B,EAC1B,MAAkB;IAElB,MAAM,IAAI,GAAG,SAAS,CAAC,QAAQ,KAAK,YAAY,CAAC;IAEjD,wDAAwD;IACxD,MAAM,cAAc,GAAG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;;;;;;;;;CAqBzB,CAAC;AACF,CAAC;AASD;;GAEG;AACH,MAAM,UAAU,eAAe,CAC7B,SAA0B,EAC1B,MAAkB;IAElB,MAAM,GAAG,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC;IACpC,MAAM,KAAK,GAAqB,EAAE,CAAC;IAEnC,IAAI,SAAS,CAAC,SAAS,KAAK,OAAO,EAAE,CAAC;QACpC,KAAK,CAAC,IAAI,CAAC;YACT,QAAQ,EAAE,gBAAgB,GAAG,EAAE;YAC/B,OAAO,EAAE,oBAAoB,CAAC,SAAS,EAAE,MAAM,CAAC;SACjD,CAAC,CAAC;IACL,CAAC;SAAM,CAAC;QACN,KAAK,CAAC,IAAI,CAAC;YACT,QAAQ,EAAE,mBAAmB,GAAG,EAAE;YAClC,OAAO,EAAE,mBAAmB,CAAC,SAAS,EAAE,MAAM,CAAC;SAChD,CAAC,CAAC;IACL,CAAC;IAED,wBAAwB;IACxB,KAAK,CAAC,IAAI,CAAC;QACT,QAAQ,EAAE,mBAAmB;QAC7B,OAAO,EAAE,kBAAkB,CAAC,MAAM,CAAC;KACpC,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,kBAAkB,CAAC,MAAkB;IAC5C,IAAI,OAAO,GAAG;;;;;;;;CAQf,CAAC;IAEA,IAAI,MAAM,CAAC,mBAAmB,EAAE,CAAC;QAC/B,OAAO,IAAI;;;CAGd,CAAC;IACA,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,142 @@
1
+ /**
2
+ * Types for the OpenAPI to MCP-I generator
3
+ *
4
+ * These types model the intermediate representation between an OpenAPI spec
5
+ * and the generated MCP-I tool files.
6
+ */
7
+ /**
8
+ * A JSON Schema property definition (subset of JSON Schema 7)
9
+ */
10
+ export interface SchemaProperty {
11
+ type?: string | string[];
12
+ description?: string;
13
+ enum?: unknown[];
14
+ minimum?: number;
15
+ maximum?: number;
16
+ minLength?: number;
17
+ maxLength?: number;
18
+ format?: string;
19
+ default?: unknown;
20
+ items?: SchemaProperty;
21
+ properties?: Record<string, SchemaProperty>;
22
+ required?: string[];
23
+ allOf?: SchemaProperty[];
24
+ oneOf?: SchemaProperty[];
25
+ anyOf?: SchemaProperty[];
26
+ [key: string]: unknown;
27
+ }
28
+ /**
29
+ * The input schema for a tool (JSON Schema object)
30
+ */
31
+ export interface InputSchema {
32
+ type: "object";
33
+ properties: Record<string, SchemaProperty>;
34
+ required?: string[];
35
+ }
36
+ /**
37
+ * A path parameter (always required in OpenAPI)
38
+ */
39
+ export interface PathParam {
40
+ name: string;
41
+ description?: string;
42
+ schema: SchemaProperty;
43
+ required: true;
44
+ }
45
+ /**
46
+ * A query parameter (may be optional)
47
+ */
48
+ export interface QueryParam {
49
+ name: string;
50
+ description?: string;
51
+ schema: SchemaProperty;
52
+ required: boolean;
53
+ }
54
+ /**
55
+ * A request body specification
56
+ */
57
+ export interface RequestBodySpec {
58
+ description?: string;
59
+ required: boolean;
60
+ schema: SchemaProperty;
61
+ }
62
+ /**
63
+ * Bearer token HTTP authentication
64
+ */
65
+ export interface BearerSecurityScheme {
66
+ type: "bearer";
67
+ }
68
+ /**
69
+ * API key authentication (header or query)
70
+ */
71
+ export interface ApiKeySecurityScheme {
72
+ type: "apiKey";
73
+ in: "header" | "query";
74
+ name: string;
75
+ }
76
+ /**
77
+ * Unsupported or unknown security scheme
78
+ */
79
+ export interface UnsupportedSecurityScheme {
80
+ type: "unsupported";
81
+ scheme: string;
82
+ }
83
+ /**
84
+ * Resolved security scheme discriminated union
85
+ */
86
+ export type ResolvedSecurityScheme = BearerSecurityScheme | ApiKeySecurityScheme | UnsupportedSecurityScheme;
87
+ /**
88
+ * Map of security scheme name to resolved scheme
89
+ */
90
+ export type SecuritySchemeMap = Record<string, ResolvedSecurityScheme>;
91
+ /**
92
+ * Represents one OpenAPI operation mapped to an MCP-I tool
93
+ */
94
+ export interface OperationModel {
95
+ /** Unique snake_case tool name (collision-resolved) */
96
+ toolName: string;
97
+ /** Human-readable description (summary > description > fallback) */
98
+ description: string;
99
+ /** HTTP method (lowercase) */
100
+ method: string;
101
+ /** Path template (e.g., /users/{userId}) */
102
+ path: string;
103
+ /** Path parameters (always required) */
104
+ pathParams: PathParam[];
105
+ /** Query parameters (optional or required per spec) */
106
+ queryParams: QueryParam[];
107
+ /** Request body if present */
108
+ requestBody?: RequestBodySpec;
109
+ /** Merged JSON Schema for all inputs */
110
+ inputSchema: InputSchema;
111
+ /** Resolved security schemes applicable to this operation */
112
+ securitySchemes: ResolvedSecurityScheme[];
113
+ /** OpenAPI tags */
114
+ tags: string[];
115
+ /** Whether the operation is marked deprecated */
116
+ deprecated: boolean;
117
+ }
118
+ /**
119
+ * A non-fatal warning produced during ingestion
120
+ */
121
+ export interface IngestionWarning {
122
+ operationId?: string;
123
+ path: string;
124
+ method: string;
125
+ message: string;
126
+ }
127
+ /**
128
+ * Result of ingesting an OpenAPI spec
129
+ */
130
+ export interface IngestionResult {
131
+ operations: OperationModel[];
132
+ securitySchemes: SecuritySchemeMap;
133
+ warnings: IngestionWarning[];
134
+ }
135
+ /**
136
+ * Options for ingesting an OpenAPI spec
137
+ */
138
+ export interface IngestionOptions {
139
+ /** If true, operations marked deprecated are excluded from output */
140
+ filterDeprecated?: boolean;
141
+ }
142
+ //# sourceMappingURL=openapi-generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openapi-generator.d.ts","sourceRoot":"","sources":["../../src/types/openapi-generator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAA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,EAAE,CAAC;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,qEAAqE;IACrE,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Types for the OpenAPI to MCP-I generator
3
+ *
4
+ * These types model the intermediate representation between an OpenAPI spec
5
+ * and the generated MCP-I tool files.
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=openapi-generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openapi-generator.js","sourceRoot":"","sources":["../../src/types/openapi-generator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kya-os/create-mcpi-app",
3
- "version": "1.9.33",
3
+ "version": "1.9.34",
4
4
  "description": "Scaffold a new MCP-I application",
5
5
  "type": "module",
6
6
  "main": "./dist/helpers/index.js",
@@ -17,6 +17,26 @@
17
17
  "./generate-cloudflare-files": {
18
18
  "types": "./dist/helpers/generate-cloudflare-files.d.ts",
19
19
  "import": "./dist/helpers/generate-cloudflare-files.js"
20
+ },
21
+ "./helpers/openapi-ingestion": {
22
+ "types": "./dist/helpers/openapi-ingestion.d.ts",
23
+ "import": "./dist/helpers/openapi-ingestion.js"
24
+ },
25
+ "./helpers/generate-openapi-tools": {
26
+ "types": "./dist/helpers/generate-openapi-tools.d.ts",
27
+ "import": "./dist/helpers/generate-openapi-tools.js"
28
+ },
29
+ "./helpers/generate-openapi-project": {
30
+ "types": "./dist/helpers/generate-openapi-project.d.ts",
31
+ "import": "./dist/helpers/generate-openapi-project.js"
32
+ },
33
+ "./helpers/generate-identity": {
34
+ "types": "./dist/helpers/generate-identity.d.ts",
35
+ "import": "./dist/helpers/generate-identity.js"
36
+ },
37
+ "./types/openapi-generator": {
38
+ "types": "./dist/types/openapi-generator.d.ts",
39
+ "import": "./dist/types/openapi-generator.js"
20
40
  }
21
41
  },
22
42
  "bin": {
@@ -34,38 +54,40 @@
34
54
  "prepublishOnly": "npm run build && node scripts/validate-dependencies.js && node scripts/validate-template-versions.js"
35
55
  },
36
56
  "dependencies": {
37
- "@kya-os/cli": "^1.5.9",
57
+ "@apidevtools/swagger-parser": "^10.1.1",
58
+ "@kya-os/cli": "^1.5.8",
38
59
  "@kya-os/cli-effects": "^1.0.19",
39
- "@kya-os/contracts": "^1.7.21",
60
+ "@kya-os/contracts": "^1.7.26",
40
61
  "@kya-os/mcp-i": "^1.7.13",
41
- "@kya-os/mcp-i-cloudflare": "^1.7.76",
62
+ "@kya-os/mcp-i-cloudflare": "^1.8.1",
42
63
  "base-x": "^5.0.0",
43
64
  "chalk": "^4.1.2",
44
65
  "commander": "^12.1.0",
45
66
  "cross-spawn": "^7.0.3",
46
67
  "dotenv": "^16.0.0",
47
- "fs-extra": "^11.2.0",
68
+ "fs-extra": "^11.3.3",
48
69
  "inquirer": "^8.2.5",
49
70
  "node-fetch": "^2.7.0",
50
71
  "ora": "^5.4.1",
51
72
  "prompts": "^2.4.2",
52
- "semver": "^7.6.2",
73
+ "semver": "^7.7.4",
53
74
  "validate-npm-package-name": "^5.0.0"
54
75
  },
55
76
  "devDependencies": {
56
77
  "@types/cross-spawn": "^6.0.6",
78
+ "openapi-types": "^12.1.3",
57
79
  "@types/fs-extra": "^11.0.4",
58
80
  "@types/inquirer": "^8.2.5",
59
81
  "@types/node": "^20.14.9",
60
82
  "@types/prompts": "^2.4.9",
61
83
  "@types/semver": "^7.5.8",
62
84
  "@types/validate-npm-package-name": "^3.0.0",
63
- "@vitest/coverage-v8": "^4.0.5",
64
- "esbuild": "^0.24.0",
85
+ "@vitest/coverage-v8": "^4.0.18",
86
+ "esbuild": "^0.27.3",
65
87
  "eslint": "^9.26.0",
66
88
  "tsx": "^4.19.0",
67
89
  "typescript": "^5.5.3",
68
- "vitest": "^4.0.5"
90
+ "vitest": "^4.0.18"
69
91
  },
70
92
  "publishConfig": {
71
93
  "access": "public"