mcp-new 0.1.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.
- package/LICENSE +21 -0
- package/README.md +184 -0
- package/bin/mcp-new.js +3 -0
- package/dist/chunk-QRUHMGU5.js +1540 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +25 -0
- package/dist/index.d.ts +516 -0
- package/dist/index.js +351 -0
- package/package.json +73 -0
- package/templates/python/.env.example +8 -0
- package/templates/python/.gitignore.ejs +37 -0
- package/templates/python/README.md.ejs +78 -0
- package/templates/python/pyproject.toml.ejs +20 -0
- package/templates/python/requirements.txt.ejs +1 -0
- package/templates/python/src/__init__.py.ejs +3 -0
- package/templates/python/src/server.py.ejs +98 -0
- package/templates/python/src/tools/__init__.py.ejs +1 -0
- package/templates/python/src/tools/example_tool.py.ejs +47 -0
- package/templates/typescript/.env.example +8 -0
- package/templates/typescript/.gitignore.ejs +22 -0
- package/templates/typescript/README.md.ejs +78 -0
- package/templates/typescript/package.json.ejs +29 -0
- package/templates/typescript/src/index.ts.ejs +121 -0
- package/templates/typescript/src/tools/example-tool.ts.ejs +36 -0
- package/templates/typescript/tsconfig.json.ejs +19 -0
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
addToolCommand,
|
|
4
|
+
createCommand,
|
|
5
|
+
initCommand
|
|
6
|
+
} from "./chunk-QRUHMGU5.js";
|
|
7
|
+
|
|
8
|
+
// src/cli.ts
|
|
9
|
+
import { Command } from "commander";
|
|
10
|
+
import chalk from "chalk";
|
|
11
|
+
var program = new Command();
|
|
12
|
+
var logo = `
|
|
13
|
+
${chalk.cyan("\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557")}
|
|
14
|
+
${chalk.cyan("\u2551")} ${chalk.bold.white("mcp-new")} ${chalk.cyan("\u2551")}
|
|
15
|
+
${chalk.cyan("\u2551")} ${chalk.gray("Generate MCP servers in seconds")} ${chalk.cyan("\u2551")}
|
|
16
|
+
${chalk.cyan("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D")}
|
|
17
|
+
`;
|
|
18
|
+
program.name("mcp-new").description("CLI tool for generating MCP (Model Context Protocol) servers").version("0.1.0").addHelpText("beforeAll", logo);
|
|
19
|
+
program.argument("[project-name]", "Name of the project to create").option("-t, --typescript", "Use TypeScript template").option("-p, --python", "Use Python template").option("--skip-install", "Skip dependency installation").option("--from-openapi <path>", "Generate from OpenAPI/Swagger specification").option("--from-prompt", "Generate tools using AI from text description").option("-y, --yes", "Skip prompts and use defaults").action(createCommand);
|
|
20
|
+
program.command("init").description("Initialize MCP server in the current directory").option("-t, --typescript", "Use TypeScript template").option("-p, --python", "Use Python template").option("--skip-install", "Skip dependency installation").option("-f, --force", "Initialize even if directory contains files").action(initCommand);
|
|
21
|
+
program.command("add-tool").description("Add a new tool to an existing MCP server").option("-n, --name <name>", "Tool name (snake_case)").action(addToolCommand);
|
|
22
|
+
program.parse();
|
|
23
|
+
if (process.argv.length === 2) {
|
|
24
|
+
program.help();
|
|
25
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,516 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
declare const LanguageSchema: z.ZodEnum<["typescript", "python"]>;
|
|
4
|
+
type Language = z.infer<typeof LanguageSchema>;
|
|
5
|
+
declare const TransportSchema: z.ZodEnum<["stdio", "sse"]>;
|
|
6
|
+
type Transport = z.infer<typeof TransportSchema>;
|
|
7
|
+
declare const ToolParameterSchema: z.ZodObject<{
|
|
8
|
+
name: z.ZodString;
|
|
9
|
+
type: z.ZodEnum<["string", "number", "boolean", "object", "array"]>;
|
|
10
|
+
description: z.ZodString;
|
|
11
|
+
required: z.ZodDefault<z.ZodBoolean>;
|
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
type: "string" | "number" | "boolean" | "object" | "array";
|
|
14
|
+
name: string;
|
|
15
|
+
description: string;
|
|
16
|
+
required: boolean;
|
|
17
|
+
}, {
|
|
18
|
+
type: "string" | "number" | "boolean" | "object" | "array";
|
|
19
|
+
name: string;
|
|
20
|
+
description: string;
|
|
21
|
+
required?: boolean | undefined;
|
|
22
|
+
}>;
|
|
23
|
+
type ToolParameter = z.infer<typeof ToolParameterSchema>;
|
|
24
|
+
declare const ToolConfigSchema: z.ZodObject<{
|
|
25
|
+
name: z.ZodString;
|
|
26
|
+
description: z.ZodString;
|
|
27
|
+
parameters: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
28
|
+
name: z.ZodString;
|
|
29
|
+
type: z.ZodEnum<["string", "number", "boolean", "object", "array"]>;
|
|
30
|
+
description: z.ZodString;
|
|
31
|
+
required: z.ZodDefault<z.ZodBoolean>;
|
|
32
|
+
}, "strip", z.ZodTypeAny, {
|
|
33
|
+
type: "string" | "number" | "boolean" | "object" | "array";
|
|
34
|
+
name: string;
|
|
35
|
+
description: string;
|
|
36
|
+
required: boolean;
|
|
37
|
+
}, {
|
|
38
|
+
type: "string" | "number" | "boolean" | "object" | "array";
|
|
39
|
+
name: string;
|
|
40
|
+
description: string;
|
|
41
|
+
required?: boolean | undefined;
|
|
42
|
+
}>, "many">>;
|
|
43
|
+
}, "strip", z.ZodTypeAny, {
|
|
44
|
+
name: string;
|
|
45
|
+
description: string;
|
|
46
|
+
parameters: {
|
|
47
|
+
type: "string" | "number" | "boolean" | "object" | "array";
|
|
48
|
+
name: string;
|
|
49
|
+
description: string;
|
|
50
|
+
required: boolean;
|
|
51
|
+
}[];
|
|
52
|
+
}, {
|
|
53
|
+
name: string;
|
|
54
|
+
description: string;
|
|
55
|
+
parameters?: {
|
|
56
|
+
type: "string" | "number" | "boolean" | "object" | "array";
|
|
57
|
+
name: string;
|
|
58
|
+
description: string;
|
|
59
|
+
required?: boolean | undefined;
|
|
60
|
+
}[] | undefined;
|
|
61
|
+
}>;
|
|
62
|
+
type ToolConfig = z.infer<typeof ToolConfigSchema>;
|
|
63
|
+
declare const ResourceConfigSchema: z.ZodObject<{
|
|
64
|
+
name: z.ZodString;
|
|
65
|
+
uri: z.ZodString;
|
|
66
|
+
description: z.ZodString;
|
|
67
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
68
|
+
}, "strip", z.ZodTypeAny, {
|
|
69
|
+
name: string;
|
|
70
|
+
description: string;
|
|
71
|
+
uri: string;
|
|
72
|
+
mimeType?: string | undefined;
|
|
73
|
+
}, {
|
|
74
|
+
name: string;
|
|
75
|
+
description: string;
|
|
76
|
+
uri: string;
|
|
77
|
+
mimeType?: string | undefined;
|
|
78
|
+
}>;
|
|
79
|
+
type ResourceConfig = z.infer<typeof ResourceConfigSchema>;
|
|
80
|
+
declare const ProjectConfigSchema: z.ZodObject<{
|
|
81
|
+
name: z.ZodString;
|
|
82
|
+
description: z.ZodDefault<z.ZodString>;
|
|
83
|
+
language: z.ZodEnum<["typescript", "python"]>;
|
|
84
|
+
transport: z.ZodEnum<["stdio", "sse"]>;
|
|
85
|
+
tools: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
86
|
+
name: z.ZodString;
|
|
87
|
+
description: z.ZodString;
|
|
88
|
+
parameters: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
89
|
+
name: z.ZodString;
|
|
90
|
+
type: z.ZodEnum<["string", "number", "boolean", "object", "array"]>;
|
|
91
|
+
description: z.ZodString;
|
|
92
|
+
required: z.ZodDefault<z.ZodBoolean>;
|
|
93
|
+
}, "strip", z.ZodTypeAny, {
|
|
94
|
+
type: "string" | "number" | "boolean" | "object" | "array";
|
|
95
|
+
name: string;
|
|
96
|
+
description: string;
|
|
97
|
+
required: boolean;
|
|
98
|
+
}, {
|
|
99
|
+
type: "string" | "number" | "boolean" | "object" | "array";
|
|
100
|
+
name: string;
|
|
101
|
+
description: string;
|
|
102
|
+
required?: boolean | undefined;
|
|
103
|
+
}>, "many">>;
|
|
104
|
+
}, "strip", z.ZodTypeAny, {
|
|
105
|
+
name: string;
|
|
106
|
+
description: string;
|
|
107
|
+
parameters: {
|
|
108
|
+
type: "string" | "number" | "boolean" | "object" | "array";
|
|
109
|
+
name: string;
|
|
110
|
+
description: string;
|
|
111
|
+
required: boolean;
|
|
112
|
+
}[];
|
|
113
|
+
}, {
|
|
114
|
+
name: string;
|
|
115
|
+
description: string;
|
|
116
|
+
parameters?: {
|
|
117
|
+
type: "string" | "number" | "boolean" | "object" | "array";
|
|
118
|
+
name: string;
|
|
119
|
+
description: string;
|
|
120
|
+
required?: boolean | undefined;
|
|
121
|
+
}[] | undefined;
|
|
122
|
+
}>, "many">>;
|
|
123
|
+
resources: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
124
|
+
name: z.ZodString;
|
|
125
|
+
uri: z.ZodString;
|
|
126
|
+
description: z.ZodString;
|
|
127
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
128
|
+
}, "strip", z.ZodTypeAny, {
|
|
129
|
+
name: string;
|
|
130
|
+
description: string;
|
|
131
|
+
uri: string;
|
|
132
|
+
mimeType?: string | undefined;
|
|
133
|
+
}, {
|
|
134
|
+
name: string;
|
|
135
|
+
description: string;
|
|
136
|
+
uri: string;
|
|
137
|
+
mimeType?: string | undefined;
|
|
138
|
+
}>, "many">>;
|
|
139
|
+
includeExampleTool: z.ZodDefault<z.ZodBoolean>;
|
|
140
|
+
skipInstall: z.ZodDefault<z.ZodBoolean>;
|
|
141
|
+
initGit: z.ZodDefault<z.ZodBoolean>;
|
|
142
|
+
}, "strip", z.ZodTypeAny, {
|
|
143
|
+
name: string;
|
|
144
|
+
description: string;
|
|
145
|
+
language: "typescript" | "python";
|
|
146
|
+
transport: "stdio" | "sse";
|
|
147
|
+
tools: {
|
|
148
|
+
name: string;
|
|
149
|
+
description: string;
|
|
150
|
+
parameters: {
|
|
151
|
+
type: "string" | "number" | "boolean" | "object" | "array";
|
|
152
|
+
name: string;
|
|
153
|
+
description: string;
|
|
154
|
+
required: boolean;
|
|
155
|
+
}[];
|
|
156
|
+
}[];
|
|
157
|
+
resources: {
|
|
158
|
+
name: string;
|
|
159
|
+
description: string;
|
|
160
|
+
uri: string;
|
|
161
|
+
mimeType?: string | undefined;
|
|
162
|
+
}[];
|
|
163
|
+
includeExampleTool: boolean;
|
|
164
|
+
skipInstall: boolean;
|
|
165
|
+
initGit: boolean;
|
|
166
|
+
}, {
|
|
167
|
+
name: string;
|
|
168
|
+
language: "typescript" | "python";
|
|
169
|
+
transport: "stdio" | "sse";
|
|
170
|
+
description?: string | undefined;
|
|
171
|
+
tools?: {
|
|
172
|
+
name: string;
|
|
173
|
+
description: string;
|
|
174
|
+
parameters?: {
|
|
175
|
+
type: "string" | "number" | "boolean" | "object" | "array";
|
|
176
|
+
name: string;
|
|
177
|
+
description: string;
|
|
178
|
+
required?: boolean | undefined;
|
|
179
|
+
}[] | undefined;
|
|
180
|
+
}[] | undefined;
|
|
181
|
+
resources?: {
|
|
182
|
+
name: string;
|
|
183
|
+
description: string;
|
|
184
|
+
uri: string;
|
|
185
|
+
mimeType?: string | undefined;
|
|
186
|
+
}[] | undefined;
|
|
187
|
+
includeExampleTool?: boolean | undefined;
|
|
188
|
+
skipInstall?: boolean | undefined;
|
|
189
|
+
initGit?: boolean | undefined;
|
|
190
|
+
}>;
|
|
191
|
+
type ProjectConfig = z.infer<typeof ProjectConfigSchema>;
|
|
192
|
+
interface GeneratorContext {
|
|
193
|
+
config: ProjectConfig;
|
|
194
|
+
outputDir: string;
|
|
195
|
+
templateDir: string;
|
|
196
|
+
}
|
|
197
|
+
interface CLIOptions {
|
|
198
|
+
typescript?: boolean;
|
|
199
|
+
python?: boolean;
|
|
200
|
+
skipInstall?: boolean;
|
|
201
|
+
fromOpenapi?: string;
|
|
202
|
+
fromPrompt?: boolean;
|
|
203
|
+
yes?: boolean;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
interface MCPToolInputSchema {
|
|
207
|
+
type: 'object';
|
|
208
|
+
properties: Record<string, MCPPropertySchema>;
|
|
209
|
+
required?: string[];
|
|
210
|
+
}
|
|
211
|
+
interface MCPPropertySchema {
|
|
212
|
+
type: 'string' | 'number' | 'boolean' | 'object' | 'array';
|
|
213
|
+
description?: string;
|
|
214
|
+
items?: MCPPropertySchema;
|
|
215
|
+
properties?: Record<string, MCPPropertySchema>;
|
|
216
|
+
enum?: string[];
|
|
217
|
+
}
|
|
218
|
+
interface MCPTool {
|
|
219
|
+
name: string;
|
|
220
|
+
description: string;
|
|
221
|
+
inputSchema: MCPToolInputSchema;
|
|
222
|
+
}
|
|
223
|
+
interface MCPResource {
|
|
224
|
+
uri: string;
|
|
225
|
+
name: string;
|
|
226
|
+
description?: string;
|
|
227
|
+
mimeType?: string;
|
|
228
|
+
}
|
|
229
|
+
interface MCPPrompt {
|
|
230
|
+
name: string;
|
|
231
|
+
description?: string;
|
|
232
|
+
arguments?: MCPPromptArgument[];
|
|
233
|
+
}
|
|
234
|
+
interface MCPPromptArgument {
|
|
235
|
+
name: string;
|
|
236
|
+
description?: string;
|
|
237
|
+
required?: boolean;
|
|
238
|
+
}
|
|
239
|
+
interface MCPServerCapabilities {
|
|
240
|
+
tools?: Record<string, never>;
|
|
241
|
+
resources?: Record<string, never>;
|
|
242
|
+
prompts?: Record<string, never>;
|
|
243
|
+
}
|
|
244
|
+
interface MCPServerInfo {
|
|
245
|
+
name: string;
|
|
246
|
+
version: string;
|
|
247
|
+
capabilities: MCPServerCapabilities;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
interface OpenAPISpec {
|
|
251
|
+
openapi: string;
|
|
252
|
+
info: OpenAPIInfo;
|
|
253
|
+
servers?: OpenAPIServer[];
|
|
254
|
+
paths: Record<string, OpenAPIPathItem>;
|
|
255
|
+
components?: OpenAPIComponents;
|
|
256
|
+
}
|
|
257
|
+
interface OpenAPIInfo {
|
|
258
|
+
title: string;
|
|
259
|
+
description?: string;
|
|
260
|
+
version: string;
|
|
261
|
+
}
|
|
262
|
+
interface OpenAPIServer {
|
|
263
|
+
url: string;
|
|
264
|
+
description?: string;
|
|
265
|
+
}
|
|
266
|
+
interface OpenAPIPathItem {
|
|
267
|
+
get?: OpenAPIOperation;
|
|
268
|
+
post?: OpenAPIOperation;
|
|
269
|
+
put?: OpenAPIOperation;
|
|
270
|
+
delete?: OpenAPIOperation;
|
|
271
|
+
patch?: OpenAPIOperation;
|
|
272
|
+
options?: OpenAPIOperation;
|
|
273
|
+
head?: OpenAPIOperation;
|
|
274
|
+
}
|
|
275
|
+
interface OpenAPIOperation {
|
|
276
|
+
operationId?: string;
|
|
277
|
+
summary?: string;
|
|
278
|
+
description?: string;
|
|
279
|
+
tags?: string[];
|
|
280
|
+
parameters?: OpenAPIParameter[];
|
|
281
|
+
requestBody?: OpenAPIRequestBody;
|
|
282
|
+
responses: Record<string, OpenAPIResponse>;
|
|
283
|
+
deprecated?: boolean;
|
|
284
|
+
}
|
|
285
|
+
interface OpenAPIParameter {
|
|
286
|
+
name: string;
|
|
287
|
+
in: 'query' | 'header' | 'path' | 'cookie';
|
|
288
|
+
description?: string;
|
|
289
|
+
required?: boolean;
|
|
290
|
+
schema: OpenAPISchema;
|
|
291
|
+
}
|
|
292
|
+
interface OpenAPIRequestBody {
|
|
293
|
+
description?: string;
|
|
294
|
+
required?: boolean;
|
|
295
|
+
content: Record<string, OpenAPIMediaType>;
|
|
296
|
+
}
|
|
297
|
+
interface OpenAPIMediaType {
|
|
298
|
+
schema: OpenAPISchema;
|
|
299
|
+
}
|
|
300
|
+
interface OpenAPIResponse {
|
|
301
|
+
description: string;
|
|
302
|
+
content?: Record<string, OpenAPIMediaType>;
|
|
303
|
+
}
|
|
304
|
+
interface OpenAPISchema {
|
|
305
|
+
type?: string;
|
|
306
|
+
format?: string;
|
|
307
|
+
description?: string;
|
|
308
|
+
properties?: Record<string, OpenAPISchema>;
|
|
309
|
+
items?: OpenAPISchema;
|
|
310
|
+
required?: string[];
|
|
311
|
+
enum?: string[];
|
|
312
|
+
$ref?: string;
|
|
313
|
+
allOf?: OpenAPISchema[];
|
|
314
|
+
oneOf?: OpenAPISchema[];
|
|
315
|
+
anyOf?: OpenAPISchema[];
|
|
316
|
+
}
|
|
317
|
+
interface OpenAPIComponents {
|
|
318
|
+
schemas?: Record<string, OpenAPISchema>;
|
|
319
|
+
responses?: Record<string, OpenAPIResponse>;
|
|
320
|
+
parameters?: Record<string, OpenAPIParameter>;
|
|
321
|
+
requestBodies?: Record<string, OpenAPIRequestBody>;
|
|
322
|
+
}
|
|
323
|
+
interface ParsedEndpoint {
|
|
324
|
+
path: string;
|
|
325
|
+
method: string;
|
|
326
|
+
operationId: string;
|
|
327
|
+
summary: string;
|
|
328
|
+
description: string;
|
|
329
|
+
parameters: ParsedParameter[];
|
|
330
|
+
requestBody?: ParsedRequestBody;
|
|
331
|
+
tags: string[];
|
|
332
|
+
}
|
|
333
|
+
interface ParsedParameter {
|
|
334
|
+
name: string;
|
|
335
|
+
in: string;
|
|
336
|
+
type: string;
|
|
337
|
+
description: string;
|
|
338
|
+
required: boolean;
|
|
339
|
+
}
|
|
340
|
+
interface ParsedRequestBody {
|
|
341
|
+
required: boolean;
|
|
342
|
+
schema: OpenAPISchema;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
declare abstract class BaseGenerator {
|
|
346
|
+
protected config: ProjectConfig;
|
|
347
|
+
protected outputDir: string;
|
|
348
|
+
protected templateDir: string;
|
|
349
|
+
constructor(context: GeneratorContext);
|
|
350
|
+
abstract generate(): Promise<void>;
|
|
351
|
+
protected createProjectStructure(): Promise<void>;
|
|
352
|
+
protected renderTemplates(): Promise<void>;
|
|
353
|
+
protected getTemplateData(): Record<string, unknown>;
|
|
354
|
+
protected installDependencies(): Promise<void>;
|
|
355
|
+
private installNodeDependencies;
|
|
356
|
+
private installPythonDependencies;
|
|
357
|
+
private checkCommand;
|
|
358
|
+
protected initializeGit(): Promise<void>;
|
|
359
|
+
protected checkOutputDir(): Promise<boolean>;
|
|
360
|
+
}
|
|
361
|
+
declare function createGeneratorContext(config: ProjectConfig, outputPath?: string): GeneratorContext;
|
|
362
|
+
|
|
363
|
+
declare class WizardGenerator extends BaseGenerator {
|
|
364
|
+
constructor(context: GeneratorContext);
|
|
365
|
+
generate(): Promise<void>;
|
|
366
|
+
}
|
|
367
|
+
declare function generateFromWizard(config: ProjectConfig, outputPath?: string): Promise<void>;
|
|
368
|
+
|
|
369
|
+
declare class OpenAPIGenerator extends BaseGenerator {
|
|
370
|
+
private _endpoints;
|
|
371
|
+
constructor(context: GeneratorContext);
|
|
372
|
+
get endpoints(): ParsedEndpoint[];
|
|
373
|
+
generate(): Promise<void>;
|
|
374
|
+
setEndpoints(endpoints: ParsedEndpoint[]): void;
|
|
375
|
+
}
|
|
376
|
+
declare function generateFromOpenAPI(specPath: string, baseConfig: Partial<ProjectConfig>): Promise<void>;
|
|
377
|
+
|
|
378
|
+
declare class PromptGenerator extends BaseGenerator {
|
|
379
|
+
constructor(context: GeneratorContext);
|
|
380
|
+
generate(): Promise<void>;
|
|
381
|
+
}
|
|
382
|
+
declare function generateFromPrompt(baseConfig: Partial<ProjectConfig>): Promise<void>;
|
|
383
|
+
|
|
384
|
+
declare function parseOpenAPISpec(content: string): Promise<ParsedEndpoint[]>;
|
|
385
|
+
declare function selectEndpoints(endpoints: ParsedEndpoint[]): Promise<ParsedEndpoint[]>;
|
|
386
|
+
declare function endpointToMCPTool(endpoint: ParsedEndpoint): {
|
|
387
|
+
name: string;
|
|
388
|
+
description: string;
|
|
389
|
+
inputSchema: {
|
|
390
|
+
type: string;
|
|
391
|
+
properties: Record<string, unknown>;
|
|
392
|
+
required: string[] | undefined;
|
|
393
|
+
};
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
declare function parseSwaggerSpec(content: string): Promise<ParsedEndpoint[]>;
|
|
397
|
+
|
|
398
|
+
declare function parsePostmanCollection(content: string): Promise<ParsedEndpoint[]>;
|
|
399
|
+
|
|
400
|
+
declare const logger: {
|
|
401
|
+
info: (message: string) => void;
|
|
402
|
+
success: (message: string) => void;
|
|
403
|
+
warning: (message: string) => void;
|
|
404
|
+
error: (message: string) => void;
|
|
405
|
+
step: (step: number, total: number, message: string) => void;
|
|
406
|
+
title: (message: string) => void;
|
|
407
|
+
blank: () => void;
|
|
408
|
+
list: (items: string[]) => void;
|
|
409
|
+
code: (code: string) => void;
|
|
410
|
+
box: (title: string, content: string[]) => void;
|
|
411
|
+
nextSteps: (projectName: string, language: string) => void;
|
|
412
|
+
};
|
|
413
|
+
|
|
414
|
+
interface SpinnerInstance {
|
|
415
|
+
start: (text?: string) => SpinnerInstance;
|
|
416
|
+
stop: () => SpinnerInstance;
|
|
417
|
+
succeed: (text?: string) => SpinnerInstance;
|
|
418
|
+
fail: (text?: string) => SpinnerInstance;
|
|
419
|
+
warn: (text?: string) => SpinnerInstance;
|
|
420
|
+
info: (text?: string) => SpinnerInstance;
|
|
421
|
+
text: string;
|
|
422
|
+
}
|
|
423
|
+
declare function createSpinner(text?: string): SpinnerInstance;
|
|
424
|
+
declare function withSpinner<T>(text: string, fn: () => Promise<T>, successText?: string, failText?: string): Promise<T>;
|
|
425
|
+
|
|
426
|
+
declare const projectNameRegex: RegExp;
|
|
427
|
+
declare function validateProjectName(name: string): {
|
|
428
|
+
valid: boolean;
|
|
429
|
+
error?: string;
|
|
430
|
+
};
|
|
431
|
+
declare function validateToolName(name: string): {
|
|
432
|
+
valid: boolean;
|
|
433
|
+
error?: string;
|
|
434
|
+
};
|
|
435
|
+
declare function validateUrl(url: string): {
|
|
436
|
+
valid: boolean;
|
|
437
|
+
error?: string;
|
|
438
|
+
};
|
|
439
|
+
declare function validateFilePath(path: string): {
|
|
440
|
+
valid: boolean;
|
|
441
|
+
error?: string;
|
|
442
|
+
};
|
|
443
|
+
declare function parseAndValidate<T>(schema: z.ZodSchema<T>, data: unknown): T;
|
|
444
|
+
declare function safeParseAndValidate<T>(schema: z.ZodSchema<T>, data: unknown): {
|
|
445
|
+
success: true;
|
|
446
|
+
data: T;
|
|
447
|
+
} | {
|
|
448
|
+
success: false;
|
|
449
|
+
error: z.ZodError;
|
|
450
|
+
};
|
|
451
|
+
|
|
452
|
+
declare function ensureDir(dirPath: string): Promise<void>;
|
|
453
|
+
declare function writeFile(filePath: string, content: string): Promise<void>;
|
|
454
|
+
declare function readFile(filePath: string): Promise<string>;
|
|
455
|
+
declare function copyFile(src: string, dest: string): Promise<void>;
|
|
456
|
+
declare function copyDir(src: string, dest: string): Promise<void>;
|
|
457
|
+
declare function exists(filePath: string): Promise<boolean>;
|
|
458
|
+
declare function remove(filePath: string): Promise<void>;
|
|
459
|
+
declare function readDir(dirPath: string): Promise<string[]>;
|
|
460
|
+
declare function isDirectory(filePath: string): Promise<boolean>;
|
|
461
|
+
declare function renderTemplate(templatePath: string, data: Record<string, unknown>): Promise<string>;
|
|
462
|
+
declare function renderTemplateToFile(templatePath: string, outputPath: string, data: Record<string, unknown>): Promise<void>;
|
|
463
|
+
declare function walkDir(dirPath: string, callback: (filePath: string, isDir: boolean) => Promise<void>): Promise<void>;
|
|
464
|
+
declare function getTemplateDir(): string;
|
|
465
|
+
declare function resolveOutputPath(basePath: string, ...segments: string[]): string;
|
|
466
|
+
|
|
467
|
+
declare function isGitInstalled(): Promise<boolean>;
|
|
468
|
+
declare function initGitRepository(projectPath: string): Promise<void>;
|
|
469
|
+
declare function createInitialCommit(projectPath: string): Promise<void>;
|
|
470
|
+
declare function getGitUser(): Promise<{
|
|
471
|
+
name?: string;
|
|
472
|
+
email?: string;
|
|
473
|
+
}>;
|
|
474
|
+
declare function isInsideGitRepository(dirPath: string): Promise<boolean>;
|
|
475
|
+
|
|
476
|
+
declare function promptProjectName(defaultName?: string): Promise<string>;
|
|
477
|
+
declare function promptProjectDescription(): Promise<string>;
|
|
478
|
+
|
|
479
|
+
declare function promptLanguage(): Promise<Language>;
|
|
480
|
+
|
|
481
|
+
declare function promptTransport(): Promise<Transport>;
|
|
482
|
+
|
|
483
|
+
declare function promptIncludeExampleTool(): Promise<boolean>;
|
|
484
|
+
declare function promptAddTools(): Promise<boolean>;
|
|
485
|
+
declare function promptToolConfig(): Promise<ToolConfig>;
|
|
486
|
+
declare function promptMultipleTools(): Promise<ToolConfig[]>;
|
|
487
|
+
|
|
488
|
+
declare function promptAddResources(): Promise<boolean>;
|
|
489
|
+
declare function promptResourceConfig(): Promise<ResourceConfig>;
|
|
490
|
+
declare function promptMultipleResources(): Promise<ResourceConfig[]>;
|
|
491
|
+
|
|
492
|
+
interface WizardOptions {
|
|
493
|
+
defaultName?: string;
|
|
494
|
+
skipDescription?: boolean;
|
|
495
|
+
skipAdvanced?: boolean;
|
|
496
|
+
presetLanguage?: 'typescript' | 'python';
|
|
497
|
+
}
|
|
498
|
+
declare function runWizard(options?: WizardOptions): Promise<ProjectConfig>;
|
|
499
|
+
declare function runQuickWizard(defaultName?: string, presetLanguage?: 'typescript' | 'python'): Promise<ProjectConfig>;
|
|
500
|
+
|
|
501
|
+
declare function createCommand(projectName: string | undefined, options: CLIOptions): Promise<void>;
|
|
502
|
+
|
|
503
|
+
interface InitOptions {
|
|
504
|
+
typescript?: boolean;
|
|
505
|
+
python?: boolean;
|
|
506
|
+
skipInstall?: boolean;
|
|
507
|
+
force?: boolean;
|
|
508
|
+
}
|
|
509
|
+
declare function initCommand(options: InitOptions): Promise<void>;
|
|
510
|
+
|
|
511
|
+
interface AddToolOptions {
|
|
512
|
+
name?: string;
|
|
513
|
+
}
|
|
514
|
+
declare function addToolCommand(options: AddToolOptions): Promise<void>;
|
|
515
|
+
|
|
516
|
+
export { BaseGenerator, type CLIOptions, type GeneratorContext, type Language, LanguageSchema, type MCPPrompt, type MCPPromptArgument, type MCPPropertySchema, type MCPResource, type MCPServerCapabilities, type MCPServerInfo, type MCPTool, type MCPToolInputSchema, type OpenAPIComponents, OpenAPIGenerator, type OpenAPIInfo, type OpenAPIMediaType, type OpenAPIOperation, type OpenAPIParameter, type OpenAPIPathItem, type OpenAPIRequestBody, type OpenAPIResponse, type OpenAPISchema, type OpenAPIServer, type OpenAPISpec, type ParsedEndpoint, type ParsedParameter, type ParsedRequestBody, type ProjectConfig, ProjectConfigSchema, PromptGenerator, type ResourceConfig, ResourceConfigSchema, type SpinnerInstance, type ToolConfig, ToolConfigSchema, type ToolParameter, ToolParameterSchema, type Transport, TransportSchema, WizardGenerator, type WizardOptions, addToolCommand, copyDir, copyFile, createCommand, createGeneratorContext, createInitialCommit, createSpinner, endpointToMCPTool, ensureDir, exists, generateFromOpenAPI, generateFromPrompt, generateFromWizard, getGitUser, getTemplateDir, initCommand, initGitRepository, isDirectory, isGitInstalled, isInsideGitRepository, logger, parseAndValidate, parseOpenAPISpec, parsePostmanCollection, parseSwaggerSpec, projectNameRegex, promptAddResources, promptAddTools, promptIncludeExampleTool, promptLanguage, promptMultipleResources, promptMultipleTools, promptProjectDescription, promptProjectName, promptResourceConfig, promptToolConfig, promptTransport, readDir, readFile, remove, renderTemplate, renderTemplateToFile, resolveOutputPath, runQuickWizard, runWizard, safeParseAndValidate, selectEndpoints, validateFilePath, validateProjectName, validateToolName, validateUrl, walkDir, withSpinner, writeFile };
|