@ppdocs/mcp 2.6.1 → 2.6.3
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/dist/cli.js +5 -5
- package/dist/tools/index.js +12 -5
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -142,7 +142,7 @@ function autoRegisterMcp(apiUrl, user) {
|
|
|
142
142
|
if (commandExists('claude')) {
|
|
143
143
|
detected.push('Claude');
|
|
144
144
|
try {
|
|
145
|
-
const cmd = `claude mcp add ppdocs-kg -e PPDOCS_API_URL=${apiUrl} -e PPDOCS_USER=${user} -- npx -y @ppdocs/mcp`;
|
|
145
|
+
const cmd = `claude mcp add ppdocs-kg -e PPDOCS_API_URL=${apiUrl} -e PPDOCS_USER=${user} -- npx -y @ppdocs/mcp@latest`;
|
|
146
146
|
console.log(`✅ Detected Claude CLI, registering MCP...`);
|
|
147
147
|
execSync(cmd, { stdio: 'inherit' });
|
|
148
148
|
}
|
|
@@ -154,7 +154,7 @@ function autoRegisterMcp(apiUrl, user) {
|
|
|
154
154
|
if (commandExists('codex')) {
|
|
155
155
|
detected.push('Codex');
|
|
156
156
|
try {
|
|
157
|
-
const cmd = `codex mcp add ppdocs-kg -e PPDOCS_API_URL=${apiUrl} -e PPDOCS_USER=${user} -- npx -y @ppdocs/mcp`;
|
|
157
|
+
const cmd = `codex mcp add ppdocs-kg -e PPDOCS_API_URL=${apiUrl} -e PPDOCS_USER=${user} -- npx -y @ppdocs/mcp@latest`;
|
|
158
158
|
console.log(`✅ Detected Codex CLI, registering MCP...`);
|
|
159
159
|
execSync(cmd, { stdio: 'inherit' });
|
|
160
160
|
}
|
|
@@ -166,7 +166,7 @@ function autoRegisterMcp(apiUrl, user) {
|
|
|
166
166
|
if (commandExists('gemini')) {
|
|
167
167
|
detected.push('Gemini');
|
|
168
168
|
try {
|
|
169
|
-
const cmd = `gemini mcp add ppdocs-kg -e PPDOCS_API_URL=${apiUrl} -e PPDOCS_USER=${user} -- npx -y @ppdocs/mcp`;
|
|
169
|
+
const cmd = `gemini mcp add ppdocs-kg -e PPDOCS_API_URL=${apiUrl} -e PPDOCS_USER=${user} -- npx -y @ppdocs/mcp@latest`;
|
|
170
170
|
console.log(`✅ Detected Gemini CLI, registering MCP...`);
|
|
171
171
|
execSync(cmd, { stdio: 'inherit' });
|
|
172
172
|
}
|
|
@@ -196,8 +196,8 @@ function createMcpJson(cwd) {
|
|
|
196
196
|
// Windows 需要 cmd /c 包装才能执行 npx
|
|
197
197
|
const isWindows = process.platform === 'win32';
|
|
198
198
|
const ppdocsServer = isWindows
|
|
199
|
-
? { command: 'cmd', args: ['/c', 'npx', '@ppdocs/mcp'] }
|
|
200
|
-
: { command: 'npx', args: ['@ppdocs/mcp'] };
|
|
199
|
+
? { command: 'cmd', args: ['/c', 'npx', '@ppdocs/mcp@latest'] }
|
|
200
|
+
: { command: 'npx', args: ['@ppdocs/mcp@latest'] };
|
|
201
201
|
mcpConfig.mcpServers = {
|
|
202
202
|
...(mcpConfig.mcpServers || {}),
|
|
203
203
|
ppdocs: ppdocsServer,
|
package/dist/tools/index.js
CHANGED
|
@@ -11,7 +11,8 @@ export function registerTools(server, projectId, _user) {
|
|
|
11
11
|
dependencies: z.array(z.object({
|
|
12
12
|
name: z.string().describe('目标节点的signature'),
|
|
13
13
|
description: z.string().describe('依赖说明')
|
|
14
|
-
})).optional().describe('依赖列表(自动生成连线)')
|
|
14
|
+
})).optional().describe('依赖列表(自动生成连线)'),
|
|
15
|
+
relatedFiles: z.array(z.string()).optional().describe('关联的源文件路径数组,如 ["src/auth.ts"]')
|
|
15
16
|
}, async (args) => {
|
|
16
17
|
const node = await storage.createNode(projectId, {
|
|
17
18
|
title: args.title,
|
|
@@ -23,7 +24,8 @@ export function registerTools(server, projectId, _user) {
|
|
|
23
24
|
locked: false,
|
|
24
25
|
signature: args.signature || args.title,
|
|
25
26
|
categories: args.tags || [],
|
|
26
|
-
dependencies: args.dependencies || []
|
|
27
|
+
dependencies: args.dependencies || [],
|
|
28
|
+
relatedFiles: args.relatedFiles || []
|
|
27
29
|
});
|
|
28
30
|
return { content: [{ type: 'text', text: JSON.stringify(node, null, 2) }] };
|
|
29
31
|
});
|
|
@@ -43,11 +45,16 @@ export function registerTools(server, projectId, _user) {
|
|
|
43
45
|
dependencies: z.array(z.object({
|
|
44
46
|
name: z.string(),
|
|
45
47
|
description: z.string()
|
|
46
|
-
})).optional().describe('依赖列表')
|
|
48
|
+
})).optional().describe('依赖列表'),
|
|
49
|
+
relatedFiles: z.array(z.string()).optional().describe('关联的源文件路径数组')
|
|
47
50
|
}, async (args) => {
|
|
48
|
-
const { nodeId, tags, ...rest } = args;
|
|
51
|
+
const { nodeId, tags, relatedFiles, ...rest } = args;
|
|
49
52
|
// API 参数 tags 转换为内部字段 categories
|
|
50
|
-
|
|
53
|
+
let updates = { ...rest };
|
|
54
|
+
if (tags !== undefined)
|
|
55
|
+
updates.categories = tags;
|
|
56
|
+
if (relatedFiles !== undefined)
|
|
57
|
+
updates.relatedFiles = relatedFiles;
|
|
51
58
|
const node = await storage.updateNode(projectId, nodeId, updates);
|
|
52
59
|
return { content: [{ type: 'text', text: node ? JSON.stringify(node, null, 2) : '更新失败(节点不存在或已锁定)' }] };
|
|
53
60
|
});
|