@ppdocs/mcp 2.6.14 → 2.6.15

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.
@@ -175,13 +175,13 @@ export function registerTools(server, projectId, _user) {
175
175
  for (const r of relations) {
176
176
  if (r.direction === 'outgoing' && (direction === 'outgoing' || direction === 'both')) {
177
177
  if (!outgoing.some(o => o.id === r.nodeId)) {
178
- outgoing.push({ id: r.nodeId, title: r.title, desc: r.description, edge: r.edgeType, depth: currentDepth });
178
+ outgoing.push({ id: r.nodeId, title: r.title, edge: r.edgeType });
179
179
  await fetchRelations(r.nodeId, currentDepth + 1, 'outgoing');
180
180
  }
181
181
  }
182
182
  if (r.direction === 'incoming' && (direction === 'incoming' || direction === 'both')) {
183
183
  if (!incoming.some(i => i.id === r.nodeId)) {
184
- incoming.push({ id: r.nodeId, title: r.title, desc: r.description, edge: r.edgeType, depth: currentDepth });
184
+ incoming.push({ id: r.nodeId, title: r.title, edge: r.edgeType });
185
185
  await fetchRelations(r.nodeId, currentDepth + 1, 'incoming');
186
186
  }
187
187
  }
@@ -193,6 +193,65 @@ export function registerTools(server, projectId, _user) {
193
193
  }
194
194
  return wrap(projectId, JSON.stringify({ outgoing, incoming }, null, 2));
195
195
  });
196
+ // 9. 读取单个节点详情
197
+ server.tool('kg_read_node', '读取单个节点的完整内容(描述、关联文件、依赖、历史记录)', {
198
+ nodeId: z.string().describe('节点ID')
199
+ }, async (args) => {
200
+ const node = await storage.getNode(projectId, args.nodeId);
201
+ if (!node) {
202
+ return wrap(projectId, '节点不存在');
203
+ }
204
+ // 构建结构化输出
205
+ const lines = [];
206
+ // 基础信息
207
+ lines.push(`## ${node.title}\n`);
208
+ lines.push('**基础信息**');
209
+ lines.push(`| 字段 | 值 |`);
210
+ lines.push(`|:---|:---|`);
211
+ lines.push(`| ID | ${node.id} |`);
212
+ lines.push(`| 类型 | ${node.type} |`);
213
+ lines.push(`| 状态 | ${node.status} |`);
214
+ lines.push(`| 签名 | ${node.signature} |`);
215
+ if (node.categories && node.categories.length > 0) {
216
+ lines.push(`| 标签 | ${node.categories.join(', ')} |`);
217
+ }
218
+ lines.push('');
219
+ // 关联文件
220
+ if (node.relatedFiles && node.relatedFiles.length > 0) {
221
+ lines.push('**关联文件**');
222
+ node.relatedFiles.forEach(f => lines.push(`- ${f}`));
223
+ lines.push('');
224
+ }
225
+ // 依赖关系
226
+ if (node.dependencies && node.dependencies.length > 0) {
227
+ lines.push('**依赖关系**');
228
+ node.dependencies.forEach(d => lines.push(`- ${d.name}: ${d.description}`));
229
+ lines.push('');
230
+ }
231
+ // 描述内容
232
+ if (node.description) {
233
+ lines.push('**描述内容**');
234
+ lines.push(node.description);
235
+ lines.push('');
236
+ }
237
+ // 更新历史
238
+ if (node.versions && node.versions.length > 0) {
239
+ lines.push('**更新历史**');
240
+ lines.push('| 版本 | 日期 | 变更 |');
241
+ lines.push('|:---|:---|:---|');
242
+ node.versions.forEach(v => lines.push(`| ${v.version} | ${v.date} | ${v.changes} |`));
243
+ lines.push('');
244
+ }
245
+ // 修复历史
246
+ if (node.bugfixes && node.bugfixes.length > 0) {
247
+ lines.push('**修复历史**');
248
+ lines.push('| ID | 日期 | 问题 | 方案 |');
249
+ lines.push('|:---|:---|:---|:---|');
250
+ node.bugfixes.forEach(b => lines.push(`| ${b.id} | ${b.date} | ${b.issue} | ${b.solution} |`));
251
+ lines.push('');
252
+ }
253
+ return wrap(projectId, lines.join('\n'));
254
+ });
196
255
  // ===================== 任务管理工具 =====================
197
256
  // 10. 创建任务
198
257
  server.tool('task_create', '创建开发任务,记录目标和关联节点', {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ppdocs/mcp",
3
- "version": "2.6.14",
3
+ "version": "2.6.15",
4
4
  "description": "ppdocs MCP Server - Knowledge Graph for Claude",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",