mcp-probe-kit 1.0.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.
Files changed (51) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +607 -0
  3. package/build/index.d.ts +2 -0
  4. package/build/index.js +553 -0
  5. package/build/tools/check_deps.d.ts +13 -0
  6. package/build/tools/check_deps.js +204 -0
  7. package/build/tools/code_review.d.ts +13 -0
  8. package/build/tools/code_review.js +138 -0
  9. package/build/tools/convert.d.ts +13 -0
  10. package/build/tools/convert.js +575 -0
  11. package/build/tools/debug.d.ts +13 -0
  12. package/build/tools/debug.js +78 -0
  13. package/build/tools/detect_shell.d.ts +6 -0
  14. package/build/tools/detect_shell.js +138 -0
  15. package/build/tools/explain.d.ts +13 -0
  16. package/build/tools/explain.js +369 -0
  17. package/build/tools/fix.d.ts +13 -0
  18. package/build/tools/fix.js +290 -0
  19. package/build/tools/genapi.d.ts +13 -0
  20. package/build/tools/genapi.js +152 -0
  21. package/build/tools/genchangelog.d.ts +13 -0
  22. package/build/tools/genchangelog.js +227 -0
  23. package/build/tools/gencommit.d.ts +13 -0
  24. package/build/tools/gencommit.js +95 -0
  25. package/build/tools/gendoc.d.ts +13 -0
  26. package/build/tools/gendoc.js +208 -0
  27. package/build/tools/genpr.d.ts +13 -0
  28. package/build/tools/genpr.js +173 -0
  29. package/build/tools/genreadme.d.ts +13 -0
  30. package/build/tools/genreadme.js +613 -0
  31. package/build/tools/gensql.d.ts +13 -0
  32. package/build/tools/gensql.js +307 -0
  33. package/build/tools/gentest.d.ts +13 -0
  34. package/build/tools/gentest.js +155 -0
  35. package/build/tools/genui.d.ts +13 -0
  36. package/build/tools/genui.js +781 -0
  37. package/build/tools/index.d.ts +22 -0
  38. package/build/tools/index.js +22 -0
  39. package/build/tools/init_project.d.ts +13 -0
  40. package/build/tools/init_project.js +142 -0
  41. package/build/tools/init_setting.d.ts +13 -0
  42. package/build/tools/init_setting.js +47 -0
  43. package/build/tools/perf.d.ts +13 -0
  44. package/build/tools/perf.js +359 -0
  45. package/build/tools/refactor.d.ts +13 -0
  46. package/build/tools/refactor.js +318 -0
  47. package/build/tools/resolve_conflict.d.ts +13 -0
  48. package/build/tools/resolve_conflict.js +338 -0
  49. package/build/tools/split.d.ts +13 -0
  50. package/build/tools/split.js +577 -0
  51. package/package.json +66 -0
package/build/index.js ADDED
@@ -0,0 +1,553 @@
1
+ #!/usr/bin/env node
2
+ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
3
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
+ import { CallToolRequestSchema, ListToolsRequestSchema, ListResourcesRequestSchema, ReadResourceRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
5
+ import { detectShell, initSetting, initProject, gencommit, debug, genapi, codeReview, gentest, genpr, checkDeps, gendoc, genchangelog, refactor, perf, fix, gensql, resolveConflict, genui, explain, convert, genreadme, split } from "./tools/index.js";
6
+ // 创建MCP服务器实例
7
+ const server = new Server({
8
+ name: "mcp-probe-kit",
9
+ version: "1.0.0",
10
+ }, {
11
+ capabilities: {
12
+ tools: {},
13
+ resources: {},
14
+ },
15
+ });
16
+ // 定义工具列表
17
+ server.setRequestHandler(ListToolsRequestSchema, async () => {
18
+ return {
19
+ tools: [
20
+ {
21
+ name: "detect_shell",
22
+ description: "【套壳鉴定】执行套壳探针检测,返回 JSON 指纹",
23
+ inputSchema: {
24
+ type: "object",
25
+ properties: {
26
+ nonce: {
27
+ type: "string",
28
+ description: "可选的随机字符串用于哈希校验,默认为 iclaude-4.5|2025-10-25|guyu|boot",
29
+ },
30
+ skip_network: {
31
+ type: "boolean",
32
+ description: "是否跳过网络探测(默认 false)",
33
+ },
34
+ },
35
+ required: [],
36
+ },
37
+ },
38
+ {
39
+ name: "init_setting",
40
+ description: "【初始化配置】在 .cursor/settings.json 中写入推荐的 AI 配置",
41
+ inputSchema: {
42
+ type: "object",
43
+ properties: {
44
+ project_path: {
45
+ type: "string",
46
+ description: "项目根目录的完整路径(默认使用当前工作区路径)",
47
+ },
48
+ },
49
+ required: [],
50
+ },
51
+ },
52
+ {
53
+ name: "init_project",
54
+ description: "【初始化工程】按照 Spec-Driven Development 方式创建项目结构和任务分解,参考 https://github.com/github/spec-kit",
55
+ inputSchema: {
56
+ type: "object",
57
+ properties: {
58
+ input: {
59
+ type: "string",
60
+ description: "项目需求描述(可以是文字描述或文件内容)",
61
+ },
62
+ project_name: {
63
+ type: "string",
64
+ description: "项目名称",
65
+ },
66
+ },
67
+ required: [],
68
+ },
69
+ },
70
+ {
71
+ name: "gencommit",
72
+ description: "【生成提交】分析代码变更并生成规范的 Git commit 消息",
73
+ inputSchema: {
74
+ type: "object",
75
+ properties: {
76
+ changes: {
77
+ type: "string",
78
+ description: "代码变更内容(可选,默认使用 git diff)",
79
+ },
80
+ type: {
81
+ type: "string",
82
+ description: "提交类型:feat, fix, docs, style, refactor, test, chore",
83
+ },
84
+ },
85
+ required: [],
86
+ },
87
+ },
88
+ {
89
+ name: "debug",
90
+ description: "【调试助手】分析错误并生成调试策略和解决方案",
91
+ inputSchema: {
92
+ type: "object",
93
+ properties: {
94
+ error: {
95
+ type: "string",
96
+ description: "错误信息(错误消息、堆栈跟踪)",
97
+ },
98
+ context: {
99
+ type: "string",
100
+ description: "相关代码或场景描述",
101
+ },
102
+ },
103
+ required: [],
104
+ },
105
+ },
106
+ {
107
+ name: "genapi",
108
+ description: "【生成文档】为代码生成 API 文档(支持 Markdown、OpenAPI、JSDoc 格式)",
109
+ inputSchema: {
110
+ type: "object",
111
+ properties: {
112
+ code: {
113
+ type: "string",
114
+ description: "需要生成文档的代码",
115
+ },
116
+ format: {
117
+ type: "string",
118
+ description: "文档格式:markdown, openapi, jsdoc(默认 markdown)",
119
+ },
120
+ },
121
+ required: [],
122
+ },
123
+ },
124
+ {
125
+ name: "code_review",
126
+ description: "【代码审查】全面审查代码质量、安全性、性能和最佳实践",
127
+ inputSchema: {
128
+ type: "object",
129
+ properties: {
130
+ code: {
131
+ type: "string",
132
+ description: "需要审查的代码",
133
+ },
134
+ focus: {
135
+ type: "string",
136
+ description: "审查重点:quality, security, performance, all(默认 all)",
137
+ },
138
+ },
139
+ required: [],
140
+ },
141
+ },
142
+ {
143
+ name: "gentest",
144
+ description: "【生成测试】为代码生成完整的测试用例(支持 Jest/Vitest/Mocha)",
145
+ inputSchema: {
146
+ type: "object",
147
+ properties: {
148
+ code: {
149
+ type: "string",
150
+ description: "需要测试的代码",
151
+ },
152
+ framework: {
153
+ type: "string",
154
+ description: "测试框架:jest, vitest, mocha(默认 jest)",
155
+ },
156
+ },
157
+ required: [],
158
+ },
159
+ },
160
+ {
161
+ name: "genpr",
162
+ description: "【生成 PR】分析变更并生成规范的 Pull Request 描述",
163
+ inputSchema: {
164
+ type: "object",
165
+ properties: {
166
+ branch: {
167
+ type: "string",
168
+ description: "分支名称",
169
+ },
170
+ commits: {
171
+ type: "string",
172
+ description: "Commit 历史",
173
+ },
174
+ },
175
+ required: [],
176
+ },
177
+ },
178
+ {
179
+ name: "check_deps",
180
+ description: "【依赖检查】分析项目依赖的健康度(版本、安全漏洞、体积)",
181
+ inputSchema: {
182
+ type: "object",
183
+ properties: {},
184
+ required: [],
185
+ },
186
+ },
187
+ {
188
+ name: "gendoc",
189
+ description: "【生成注释】为代码生成详细的 JSDoc/TSDoc 注释",
190
+ inputSchema: {
191
+ type: "object",
192
+ properties: {
193
+ code: {
194
+ type: "string",
195
+ description: "需要生成注释的代码",
196
+ },
197
+ style: {
198
+ type: "string",
199
+ description: "注释风格:jsdoc, tsdoc, javadoc(默认 jsdoc)",
200
+ },
201
+ lang: {
202
+ type: "string",
203
+ description: "语言:zh, en(默认 zh)",
204
+ },
205
+ },
206
+ required: [],
207
+ },
208
+ },
209
+ {
210
+ name: "genchangelog",
211
+ description: "【生成 Changelog】根据 commit 历史生成 CHANGELOG.md",
212
+ inputSchema: {
213
+ type: "object",
214
+ properties: {
215
+ version: {
216
+ type: "string",
217
+ description: "版本号(如:v1.2.0)",
218
+ },
219
+ from: {
220
+ type: "string",
221
+ description: "起始 commit/tag",
222
+ },
223
+ to: {
224
+ type: "string",
225
+ description: "结束 commit/tag(默认 HEAD)",
226
+ },
227
+ },
228
+ required: [],
229
+ },
230
+ },
231
+ {
232
+ name: "refactor",
233
+ description: "【重构建议】分析代码并提供重构建议和实施计划",
234
+ inputSchema: {
235
+ type: "object",
236
+ properties: {
237
+ code: {
238
+ type: "string",
239
+ description: "需要重构的代码",
240
+ },
241
+ goal: {
242
+ type: "string",
243
+ description: "重构目标:improve_readability, reduce_complexity, extract_function 等",
244
+ },
245
+ },
246
+ required: [],
247
+ },
248
+ },
249
+ {
250
+ name: "perf",
251
+ description: "【性能分析】分析代码性能瓶颈并提供优化建议",
252
+ inputSchema: {
253
+ type: "object",
254
+ properties: {
255
+ code: {
256
+ type: "string",
257
+ description: "需要性能分析的代码",
258
+ },
259
+ type: {
260
+ type: "string",
261
+ description: "分析类型:algorithm, memory, react, database, all(默认 all)",
262
+ },
263
+ },
264
+ required: [],
265
+ },
266
+ },
267
+ {
268
+ name: "fix",
269
+ description: "【自动修复】自动修复代码问题(Lint、TypeScript、格式化等)",
270
+ inputSchema: {
271
+ type: "object",
272
+ properties: {
273
+ code: {
274
+ type: "string",
275
+ description: "需要修复的代码",
276
+ },
277
+ type: {
278
+ type: "string",
279
+ description: "修复类型:lint, type, format, import, unused, all(默认 all)",
280
+ },
281
+ },
282
+ required: [],
283
+ },
284
+ },
285
+ {
286
+ name: "gensql",
287
+ description: "【SQL 生成器】根据描述生成 SQL 查询语句",
288
+ inputSchema: {
289
+ type: "object",
290
+ properties: {
291
+ description: {
292
+ type: "string",
293
+ description: "需求描述",
294
+ },
295
+ dialect: {
296
+ type: "string",
297
+ description: "数据库类型:postgres, mysql, sqlite(默认 postgres)",
298
+ },
299
+ },
300
+ required: [],
301
+ },
302
+ },
303
+ {
304
+ name: "resolve_conflict",
305
+ description: "【Git 冲突解决】分析并解决 Git 冲突",
306
+ inputSchema: {
307
+ type: "object",
308
+ properties: {
309
+ conflicts: {
310
+ type: "string",
311
+ description: "冲突内容(git diff 或冲突文件内容)",
312
+ },
313
+ },
314
+ required: [],
315
+ },
316
+ },
317
+ {
318
+ name: "genui",
319
+ description: "【UI 组件生成器】生成 React/Vue UI 组件代码",
320
+ inputSchema: {
321
+ type: "object",
322
+ properties: {
323
+ description: {
324
+ type: "string",
325
+ description: "组件描述",
326
+ },
327
+ framework: {
328
+ type: "string",
329
+ description: "框架:react, vue, html(默认 react)",
330
+ },
331
+ },
332
+ required: [],
333
+ },
334
+ },
335
+ {
336
+ name: "explain",
337
+ description: "【代码解释器】详细解释代码逻辑和原理",
338
+ inputSchema: {
339
+ type: "object",
340
+ properties: {
341
+ code: {
342
+ type: "string",
343
+ description: "需要解释的代码",
344
+ },
345
+ context: {
346
+ type: "string",
347
+ description: "上下文信息",
348
+ },
349
+ },
350
+ required: [],
351
+ },
352
+ },
353
+ {
354
+ name: "convert",
355
+ description: "【代码转换器】转换代码格式/框架(JS→TS、Class→Hooks 等)",
356
+ inputSchema: {
357
+ type: "object",
358
+ properties: {
359
+ code: {
360
+ type: "string",
361
+ description: "源代码",
362
+ },
363
+ from: {
364
+ type: "string",
365
+ description: "源格式/框架",
366
+ },
367
+ to: {
368
+ type: "string",
369
+ description: "目标格式/框架",
370
+ },
371
+ },
372
+ required: [],
373
+ },
374
+ },
375
+ {
376
+ name: "genreadme",
377
+ description: "【README 生成器】根据项目代码生成 README.md 文档",
378
+ inputSchema: {
379
+ type: "object",
380
+ properties: {
381
+ project_info: {
382
+ type: "string",
383
+ description: "项目信息或代码",
384
+ },
385
+ style: {
386
+ type: "string",
387
+ description: "风格:standard, minimal, detailed(默认 standard)",
388
+ },
389
+ },
390
+ required: [],
391
+ },
392
+ },
393
+ {
394
+ name: "split",
395
+ description: "【文件拆分】将大文件拆分成多个小文件或小组件",
396
+ inputSchema: {
397
+ type: "object",
398
+ properties: {
399
+ file: {
400
+ type: "string",
401
+ description: "文件内容或路径",
402
+ },
403
+ strategy: {
404
+ type: "string",
405
+ description: "拆分策略:auto, type, function, component, feature(默认 auto)",
406
+ },
407
+ },
408
+ required: [],
409
+ },
410
+ },
411
+ ],
412
+ };
413
+ });
414
+ // 处理工具调用
415
+ server.setRequestHandler(CallToolRequestSchema, async (request) => {
416
+ const { name, arguments: args } = request.params;
417
+ try {
418
+ switch (name) {
419
+ case "detect_shell":
420
+ return await detectShell(args);
421
+ case "init_setting":
422
+ return await initSetting(args);
423
+ case "init_project":
424
+ return await initProject(args);
425
+ case "gencommit":
426
+ return await gencommit(args);
427
+ case "debug":
428
+ return await debug(args);
429
+ case "genapi":
430
+ return await genapi(args);
431
+ case "code_review":
432
+ return await codeReview(args);
433
+ case "gentest":
434
+ return await gentest(args);
435
+ case "genpr":
436
+ return await genpr(args);
437
+ case "check_deps":
438
+ return await checkDeps(args);
439
+ case "gendoc":
440
+ return await gendoc(args);
441
+ case "genchangelog":
442
+ return await genchangelog(args);
443
+ case "refactor":
444
+ return await refactor(args);
445
+ case "perf":
446
+ return await perf(args);
447
+ case "fix":
448
+ return await fix(args);
449
+ case "gensql":
450
+ return await gensql(args);
451
+ case "resolve_conflict":
452
+ return await resolveConflict(args);
453
+ case "genui":
454
+ return await genui(args);
455
+ case "explain":
456
+ return await explain(args);
457
+ case "convert":
458
+ return await convert(args);
459
+ case "genreadme":
460
+ return await genreadme(args);
461
+ case "split":
462
+ return await split(args);
463
+ default:
464
+ throw new Error(`未知工具: ${name}`);
465
+ }
466
+ }
467
+ catch (error) {
468
+ const errorMessage = error instanceof Error ? error.message : String(error);
469
+ return {
470
+ content: [
471
+ {
472
+ type: "text",
473
+ text: `错误: ${errorMessage}`,
474
+ },
475
+ ],
476
+ isError: true,
477
+ };
478
+ }
479
+ });
480
+ // 定义资源列表
481
+ server.setRequestHandler(ListResourcesRequestSchema, async () => {
482
+ return {
483
+ resources: [
484
+ {
485
+ uri: "probe://status",
486
+ name: "服务器状态",
487
+ description: "MCP Probe Kit 服务器当前状态",
488
+ mimeType: "application/json",
489
+ },
490
+ ],
491
+ };
492
+ });
493
+ // 读取资源
494
+ server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
495
+ const { uri } = request.params;
496
+ if (uri === "probe://status") {
497
+ return {
498
+ contents: [
499
+ {
500
+ uri,
501
+ mimeType: "application/json",
502
+ text: JSON.stringify({
503
+ status: "running",
504
+ timestamp: new Date().toISOString(),
505
+ serverInfo: {
506
+ name: "mcp-probe-kit",
507
+ version: "1.0.0",
508
+ description: "Cursor 开发增强工具集",
509
+ },
510
+ tools: {
511
+ detect_shell: "enabled",
512
+ init_setting: "enabled",
513
+ init_project: "enabled",
514
+ gencommit: "enabled",
515
+ debug: "enabled",
516
+ genapi: "enabled",
517
+ code_review: "enabled",
518
+ gentest: "enabled",
519
+ genpr: "enabled",
520
+ check_deps: "enabled",
521
+ gendoc: "enabled",
522
+ genchangelog: "enabled",
523
+ refactor: "enabled",
524
+ perf: "enabled",
525
+ fix: "enabled",
526
+ gensql: "enabled",
527
+ resolve_conflict: "enabled",
528
+ genui: "enabled",
529
+ explain: "enabled",
530
+ convert: "enabled",
531
+ genreadme: "enabled",
532
+ split: "enabled",
533
+ },
534
+ }, null, 2),
535
+ },
536
+ ],
537
+ };
538
+ }
539
+ throw new Error(`未知资源: ${uri}`);
540
+ });
541
+ // 启动服务器
542
+ async function main() {
543
+ const transport = new StdioServerTransport();
544
+ await server.connect(transport);
545
+ console.error("MCP Probe Kit 服务器已启动");
546
+ }
547
+ // 只在直接运行时启动服务器
548
+ if (import.meta.url === `file://${process.argv[1]}`) {
549
+ main().catch((error) => {
550
+ console.error("服务器启动失败:", error);
551
+ process.exit(1);
552
+ });
553
+ }
@@ -0,0 +1,13 @@
1
+ export declare function checkDeps(args: any): Promise<{
2
+ content: {
3
+ type: string;
4
+ text: string;
5
+ }[];
6
+ isError?: undefined;
7
+ } | {
8
+ content: {
9
+ type: string;
10
+ text: string;
11
+ }[];
12
+ isError: boolean;
13
+ }>;