mcp-probe-kit 3.0.5 → 3.0.6

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 (53) hide show
  1. package/README.md +453 -435
  2. package/build/index.js +434 -140
  3. package/build/lib/template-loader.js +317 -317
  4. package/build/lib/tool-execution-context.d.ts +8 -0
  5. package/build/lib/tool-execution-context.js +20 -0
  6. package/build/schemas/git-tools.js +16 -16
  7. package/build/tools/__tests__/start_bugfix.unit.test.js +14 -14
  8. package/build/tools/__tests__/start_ui.unit.test.js +11 -11
  9. package/build/tools/add_feature.js +79 -79
  10. package/build/tools/ask_user.js +5 -5
  11. package/build/tools/interview.js +9 -9
  12. package/build/tools/start_bugfix.d.ts +2 -1
  13. package/build/tools/start_bugfix.js +131 -122
  14. package/build/tools/start_feature.d.ts +2 -1
  15. package/build/tools/start_feature.js +113 -104
  16. package/build/tools/start_onboard.d.ts +2 -1
  17. package/build/tools/start_onboard.js +57 -51
  18. package/build/tools/start_product.d.ts +2 -1
  19. package/build/tools/start_product.js +9 -1
  20. package/build/tools/start_ralph.d.ts +2 -1
  21. package/build/tools/start_ralph.js +9 -3
  22. package/build/tools/start_ui.d.ts +2 -1
  23. package/build/tools/start_ui.js +102 -88
  24. package/build/tools/ui-ux-tools.d.ts +2 -1
  25. package/build/tools/ui-ux-tools.js +19 -3
  26. package/build/utils/ui-sync.d.ts +6 -2
  27. package/build/utils/ui-sync.js +125 -29
  28. package/docs/assets/font/MaterialSymbolsOutlined.codepoints +4102 -0
  29. package/docs/assets/font/MaterialSymbolsOutlined.ttf +0 -0
  30. package/docs/assets/font/noto-sans-sc-400.ttf +0 -0
  31. package/docs/assets/font/noto-sans-sc-700.ttf +0 -0
  32. package/docs/assets/font/noto-sans-sc-900.ttf +0 -0
  33. package/docs/assets/js/i18n.js +122 -21
  34. package/docs/assets/js/tailwind.js +83 -83
  35. package/docs/data/tools.js +416 -416
  36. package/docs/debug-i18n.html +163 -0
  37. package/docs/i18n/all-tools/en.json +157 -0
  38. package/docs/i18n/all-tools/ja.json +157 -0
  39. package/docs/i18n/all-tools/ko.json +157 -0
  40. package/docs/i18n/all-tools/zh-CN.json +157 -0
  41. package/docs/pages/all-tools.html +514 -352
  42. package/docs/pages/examples.html +689 -689
  43. package/docs/pages/getting-started.html +589 -589
  44. package/docs/pages/migration.html +298 -298
  45. package/package.json +3 -3
  46. package/docs/project-context/architecture.md +0 -0
  47. package/docs/project-context/how-to-develop.md +0 -313
  48. package/docs/project-context/how-to-test.md +0 -457
  49. package/docs/project-context/tech-stack.md +0 -96
  50. package/docs/project-context.md +0 -53
  51. package/docs/specs/git-work-report/design.md +0 -568
  52. package/docs/specs/git-work-report/requirements.md +0 -131
  53. package/docs/specs/git-work-report/tasks.md +0 -197
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-probe-kit",
3
- "version": "3.0.5",
3
+ "version": "3.0.6",
4
4
  "description": "AI-Powered Development Toolkit - MCP Server with 21 tools covering code quality, development efficiency, project management, and UI/UX design. Features: Structured Output, Workflow Orchestration, UI/UX Pro Max, and Requirements Interview.",
5
5
  "mcpName": "io.github.mybolide/mcp-probe-kit",
6
6
  "type": "module",
@@ -54,7 +54,7 @@
54
54
  },
55
55
  "homepage": "https://mcp-probe-kit.bytezonex.com",
56
56
  "engines": {
57
- "node": ">=16.0.0"
57
+ "node": ">=18.0.0"
58
58
  },
59
59
  "files": [
60
60
  "build",
@@ -63,7 +63,7 @@
63
63
  "LICENSE"
64
64
  ],
65
65
  "dependencies": {
66
- "@modelcontextprotocol/sdk": "^1.25.3",
66
+ "@modelcontextprotocol/sdk": "^1.27.1",
67
67
  "csv-parse": "^6.1.0",
68
68
  "tar": "^7.5.6"
69
69
  },
File without changes
@@ -1,313 +0,0 @@
1
- # 如何开发
2
-
3
- > 本文档描述 MCP Probe Kit 的开发新工具的基本步骤。
4
-
5
- ## 概述
6
-
7
- 本文档介绍如何在 MCP Probe Kit 中添加新工具。开发流程包括:定义 Schema → 实现工具逻辑 → 注册到服务器 → 测试验证。
8
-
9
- ## 开发新工具的步骤
10
-
11
- ### 第一步:定义工具 Schema
12
-
13
- 在 `src/schemas/` 目录下创建或编辑 Schema 文件,定义工具的输入参数和描述。
14
-
15
- **示例** - 添加 Git 工作报告工具 Schema (`src/schemas/git-tools.ts`):
16
-
17
- ```typescript
18
- export const gitWorkReportSchema: Tool = {
19
- name: "git_work_report",
20
- description: `基于 Git diff 分析生成工作报告(日报/周期报)
21
-
22
- 核心功能:
23
- - 支持日报模式(单个日期)和周期报模式(日期范围)
24
- - 自动读取指定日期的所有 Git 提交
25
- - 对每个提交执行 git show 获取完整 diff
26
- - 使用 AI 分析 diff 内容提取实际工作内容
27
-
28
- 输出格式:
29
- - 只输出「工作内容」部分
30
- - 每条以 - 开头,中文,简洁专业
31
- - 格式:做了什么 + 改了哪里/达到什么效果
32
- - 不输出:提交哈希、文件列表、统计数据、风险总结
33
-
34
- 使用示例:
35
- - 日报:git_work_report --date 2026-1-27
36
- - 周期报:git_work_report --start_date 2026-2-1 --end_date 2026-2-6`,
37
- inputSchema: {
38
- type: "object",
39
- properties: {
40
- date: {
41
- type: "string",
42
- description: "单个日期,格式 YYYY-MM-DD(日报模式)",
43
- },
44
- start_date: {
45
- type: "string",
46
- description: "起始日期,格式 YYYY-MM-DD(周期报模式)",
47
- },
48
- end_date: {
49
- type: "string",
50
- description: "结束日期,格式 YYYY-MM-DD(周期报模式)",
51
- },
52
- output_file: {
53
- type: "string",
54
- description: "可选,输出文件路径",
55
- },
56
- },
57
- },
58
- };
59
- ```
60
-
61
- **关键点:**
62
- - `name` - 工具名称(使用 snake_case)
63
- - `description` - 详细描述工具功能、使用场景、输出格式
64
- - `inputSchema` - JSON Schema 格式的参数定义
65
-
66
- ### 第二步:实现工具逻辑
67
-
68
- 在 `src/tools/` 目录下创建工具实现文件。
69
-
70
- **示例** - 实现 Git 工作报告工具 (`src/tools/git_work_report.ts`):
71
-
72
- ```typescript
73
- import { exec } from "child_process";
74
- import { promisify } from "util";
75
- import { formatResponse } from "../lib/response.js";
76
-
77
- const execAsync = promisify(exec);
78
-
79
- interface GitWorkReportArgs {
80
- date?: string;
81
- start_date?: string;
82
- end_date?: string;
83
- output_file?: string;
84
- }
85
-
86
- export async function gitWorkReport(args: GitWorkReportArgs) {
87
- try {
88
- // 1. 参数验证
89
- const isDaily = !!args.date;
90
- const isPeriod = !!(args.start_date && args.end_date);
91
-
92
- if (!isDaily && !isPeriod) {
93
- throw new Error("请提供 date(日报)或 start_date + end_date(周期报)");
94
- }
95
-
96
- // 2. 构建 git log 命令
97
- let gitCommand: string;
98
- if (isDaily) {
99
- gitCommand = `git log --since="${args.date} 00:00:00" --until="${args.date} 23:59:59" --format=%H`;
100
- } else {
101
- gitCommand = `git log --since="${args.start_date} 00:00:00" --until="${args.end_date} 23:59:59" --format=%H`;
102
- }
103
-
104
- // 3. 获取提交列表
105
- const { stdout: commits } = await execAsync(gitCommand);
106
- const commitList = commits.trim().split('\n').filter(Boolean);
107
-
108
- if (commitList.length === 0) {
109
- const message = "- 当日无代码提交(Git 无 commit 记录)";
110
- return formatResponse(message);
111
- }
112
-
113
- // 4. 获取每个提交的 diff
114
- const diffPromises = commitList.map(async (hash) => {
115
- const { stdout } = await execAsync(`git show ${hash}`);
116
- return stdout;
117
- });
118
- const diffs = await Promise.all(diffPromises);
119
-
120
- // 5. 构建 AI 分析提示
121
- const analysisPrompt = `
122
- 请分析以下 Git diff 内容,提取实际工作内容:
123
-
124
- ${diffs.join('\n\n---\n\n')}
125
-
126
- 要求:
127
- - 只输出「工作内容」部分
128
- - 每条以 - 开头
129
- - 中文,简洁专业,避免空话
130
- - 格式:做了什么 + 改了哪里/达到什么效果
131
- - 不输出:提交哈希、文件列表原文、统计数据、风险评估、总结段落
132
- `;
133
-
134
- // 6. 返回结果(AI 会基于此提示生成报告)
135
- return formatResponse(analysisPrompt);
136
-
137
- } catch (error) {
138
- const errorMessage = error instanceof Error ? error.message : String(error);
139
- return formatResponse(`错误: ${errorMessage}`, true);
140
- }
141
- }
142
- ```
143
-
144
- **关键点:**
145
- - 使用 TypeScript 类型定义参数
146
- - 使用 `formatResponse` 统一格式化输出
147
- - 错误处理要完善
148
- - 返回的内容应该是 AI 可以理解和处理的
149
-
150
- ### 第三步:导出工具
151
-
152
- 在 `src/tools/index.ts` 中导出新工具:
153
-
154
- ```typescript
155
- export { gitWorkReport } from "./git_work_report.js";
156
- ```
157
-
158
- 在 `src/schemas/index.ts` 中导出 Schema:
159
-
160
- ```typescript
161
- import { gitWorkReportSchema } from "./git-tools.js";
162
-
163
- export const allToolSchemas: Tool[] = [
164
- // ... 其他工具
165
- gitWorkReportSchema,
166
- ];
167
- ```
168
-
169
- ### 第四步:注册到 MCP 服务器
170
-
171
- 在 `src/index.ts` 中添加工具路由:
172
-
173
- ```typescript
174
- import { gitWorkReport } from "./tools/index.js";
175
-
176
- // 在 CallToolRequestSchema 处理器中添加
177
- server.setRequestHandler(CallToolRequestSchema, async (request) => {
178
- const { name, arguments: args } = request.params;
179
-
180
- try {
181
- switch (name) {
182
- // ... 其他工具
183
- case "git_work_report":
184
- return await gitWorkReport(args as any);
185
- default:
186
- throw new Error(`未知工具: ${name}`);
187
- }
188
- } catch (error) {
189
- // 错误处理
190
- }
191
- });
192
- ```
193
-
194
- ### 第五步:测试工具
195
-
196
- #### 本地测试
197
-
198
- ```bash
199
- # 编译代码
200
- npm run build
201
-
202
- # 使用 MCP Inspector 测试
203
- npm run inspector
204
- ```
205
-
206
- 在 Inspector 中:
207
- 1. 连接到服务器
208
- 2. 查看工具列表,确认新工具已注册
209
- 3. 调用工具,测试各种参数组合
210
- 4. 验证输出格式是否正确
211
-
212
- #### 单元测试
213
-
214
- 在 `src/tools/__tests__/` 创建测试文件:
215
-
216
- ```typescript
217
- import { describe, it, expect } from 'vitest';
218
- import { gitWorkReport } from '../git_work_report.js';
219
-
220
- describe('gitWorkReport', () => {
221
- it('应该在无提交时返回提示', async () => {
222
- const result = await gitWorkReport({ date: '2020-01-01' });
223
- expect(result.content[0].text).toContain('当日无代码提交');
224
- });
225
-
226
- it('应该验证参数', async () => {
227
- const result = await gitWorkReport({});
228
- expect(result.content[0].text).toContain('请提供');
229
- });
230
- });
231
- ```
232
-
233
- 运行测试:
234
-
235
- ```bash
236
- npm test
237
- ```
238
-
239
- ### 第六步:更新文档
240
-
241
- 1. 在 `docs/data/tools.js` 中添加工具信息
242
- 2. 更新 `README.md` 中的工具列表
243
- 3. 在 `docs/pages/all-tools.html` 中添加工具说明
244
-
245
- ## 开发编排工具
246
-
247
- 编排工具(`start_*`)需要返回委托式执行计划。
248
-
249
- **示例** - 简化的编排工具结构:
250
-
251
- ```typescript
252
- export async function startGitReport(args: any) {
253
- // 1. 生成执行计划
254
- const plan = {
255
- mode: "delegated",
256
- steps: [
257
- {
258
- id: "check_context",
259
- tool: "init_project_context",
260
- args: {},
261
- outputs: ["docs/project-context.md"],
262
- },
263
- {
264
- id: "generate_report",
265
- tool: "git_work_report",
266
- args: {
267
- date: args.date,
268
- start_date: args.start_date,
269
- end_date: args.end_date,
270
- },
271
- outputs: ["work-report.md"],
272
- },
273
- ],
274
- };
275
-
276
- // 2. 返回结构化输出
277
- return {
278
- content: [
279
- {
280
- type: "text",
281
- text: "执行计划已生成,请按步骤调用工具",
282
- },
283
- ],
284
- structuredContent: {
285
- summary: "Git 工作报告生成编排",
286
- status: "pending",
287
- metadata: {
288
- plan,
289
- },
290
- },
291
- };
292
- }
293
- ```
294
-
295
- ## 最佳实践
296
-
297
- 1. **参数验证** - 在工具开始时验证所有必需参数
298
- 2. **错误处理** - 使用 try-catch 捕获所有错误
299
- 3. **类型安全** - 使用 TypeScript 类型定义
300
- 4. **统一格式** - 使用 `formatResponse` 格式化输出
301
- 5. **结构化输出** - 编排工具返回 `structuredContent`
302
- 6. **文档完善** - Schema 的 description 要详细清晰
303
- 7. **测试覆盖** - 编写单元测试验证功能
304
-
305
- ## 调试技巧
306
-
307
- 1. **使用 console.error** - 在服务器端输出调试信息
308
- 2. **MCP Inspector** - 可视化测试工具调用
309
- 3. **查看日志** - 客户端通常有开发者工具可查看 MCP 通信
310
- 4. **单步调试** - 使用 VS Code 调试 TypeScript 代码
311
-
312
- ---
313
- *返回索引: [../project-context.md](../project-context.md)*