@ppdocs/mcp 3.10.0 → 3.13.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.
@@ -1,97 +0,0 @@
1
- /**
2
- * 多AI协作会议工具
3
- * kg_meeting: join | leave | post | claim | release | status
4
- */
5
- import { z } from 'zod';
6
- import { getClient } from '../storage/httpClient.js';
7
- import { wrap, safeTool } from './shared.js';
8
- function formatStatus(status) {
9
- const lines = [
10
- `🏛️ 会议室: ${status.projectId}`,
11
- ``,
12
- ];
13
- // 参与者
14
- if (status.agents.length > 0) {
15
- lines.push(`### 👥 参与者 (${status.agents.length})`);
16
- for (const agent of status.agents) {
17
- const ago = Math.floor((Date.now() / 1000 - agent.lastHeartbeat) / 60);
18
- lines.push(` 🤖 ${agent.agentId} (${agent.agentType}) — 心跳 ${ago}分钟前`);
19
- }
20
- lines.push('');
21
- }
22
- else {
23
- lines.push('📭 会议室为空');
24
- lines.push('');
25
- }
26
- // 文件锁
27
- const locks = Object.entries(status.fileLocks);
28
- if (locks.length > 0) {
29
- lines.push(`### 🔒 文件锁定 (${locks.length})`);
30
- for (const [file, owner] of locks) {
31
- lines.push(` 📄 ${file} ← ${owner}`);
32
- }
33
- lines.push('');
34
- }
35
- // 最近消息
36
- if (status.recentMessages.length > 0) {
37
- lines.push(`### 💬 最近消息 (${status.recentMessages.length})`);
38
- for (const msg of status.recentMessages.slice(-10)) {
39
- const time = new Date(msg.timestamp * 1000).toLocaleTimeString();
40
- const icon = msg.msgType === 'decision' ? '⚡' : msg.msgType === 'question' ? '❓' : '💬';
41
- lines.push(` ${icon} [${time}] ${msg.agentId}: ${msg.content}`);
42
- }
43
- }
44
- return lines.join('\n');
45
- }
46
- export function registerMeetingTools(server, ctx) {
47
- const client = () => getClient();
48
- server.tool('kg_meeting', '🏛️ 多AI协作会议 — 多个AI编辑器同时操作同一项目时,通过"会议室"共享状态、认领文件、发布决策。action: join(加入)|leave(离开)|post(发消息)|claim(认领文件)|release(释放文件)|status(查看状态)', {
49
- action: z.enum(['join', 'leave', 'post', 'claim', 'release', 'status']).describe('操作类型'),
50
- agentId: z.string().optional().describe('Agent标识(如"cursor-1", "claude-code-2")。join/leave/post/claim/release 必填'),
51
- agentType: z.string().optional().describe('Agent类型(如"cursor", "claude", "kiro")。join 时使用'),
52
- content: z.string().optional().describe('消息内容 (post 时必填)'),
53
- msgType: z.enum(['status', 'decision', 'question']).optional().describe('消息类型 (post, 默认status)'),
54
- filePath: z.string().optional().describe('文件路径 (claim/release 时必填)'),
55
- }, async (args) => safeTool(async () => {
56
- switch (args.action) {
57
- case 'join': {
58
- if (!args.agentId)
59
- return wrap('❌ join 需要 agentId');
60
- const status = await client().meetingJoin(args.agentId, args.agentType || 'unknown');
61
- return wrap(`✅ ${args.agentId} 已加入会议\n\n${formatStatus(status)}`);
62
- }
63
- case 'leave': {
64
- if (!args.agentId)
65
- return wrap('❌ leave 需要 agentId');
66
- const status = await client().meetingLeave(args.agentId);
67
- return wrap(`✅ ${args.agentId} 已离开会议\n\n${formatStatus(status)}`);
68
- }
69
- case 'post': {
70
- if (!args.agentId || !args.content)
71
- return wrap('❌ post 需要 agentId 和 content');
72
- const status = await client().meetingPost(args.agentId, args.content, args.msgType || 'status');
73
- return wrap(`✅ 消息已发送\n\n${formatStatus(status)}`);
74
- }
75
- case 'claim': {
76
- if (!args.agentId || !args.filePath)
77
- return wrap('❌ claim 需要 agentId 和 filePath');
78
- const status = await client().meetingClaim(args.agentId, args.filePath);
79
- return wrap(`✅ ${args.agentId} 已认领 ${args.filePath}\n\n${formatStatus(status)}`);
80
- }
81
- case 'release': {
82
- if (!args.agentId || !args.filePath)
83
- return wrap('❌ release 需要 agentId 和 filePath');
84
- const status = await client().meetingRelease(args.agentId, args.filePath);
85
- return wrap(`✅ ${args.agentId} 已释放 ${args.filePath}\n\n${formatStatus(status)}`);
86
- }
87
- case 'status': {
88
- const status = await client().meetingStatus();
89
- if (!status)
90
- return wrap('📭 该项目暂无活跃会议');
91
- return wrap(formatStatus(status));
92
- }
93
- default:
94
- return wrap(`❌ 未知 action: ${args.action}`);
95
- }
96
- }));
97
- }
@@ -1,7 +0,0 @@
1
- /**
2
- * 📋 kg_projects
3
- * 列出所有可访问的项目(返回名称和ID)
4
- */
5
- import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
6
- import { type McpContext } from './shared.js';
7
- export declare function registerProjectTools(server: McpServer, ctx: McpContext): void;
@@ -1,19 +0,0 @@
1
- /**
2
- * 📋 kg_projects
3
- * 列出所有可访问的项目(返回名称和ID)
4
- */
5
- import { getClient } from '../storage/httpClient.js';
6
- import { wrap, safeTool } from './shared.js';
7
- export function registerProjectTools(server, ctx) {
8
- const client = () => getClient();
9
- server.tool('kg_projects', '📋 列出所有可访问的项目(返回名称和ID)。跨项目操作的第一步: 获取项目ID后用于其他工具的 targetProject 参数', {}, async () => safeTool(async () => {
10
- const projects = await client().crossListProjects();
11
- if (projects.length === 0)
12
- return wrap('暂无可访问的项目');
13
- const lines = projects.map(p => {
14
- const isCurrent = p.id === ctx.projectId ? ' ★当前' : '';
15
- return `- ${p.name} (${p.id})${isCurrent}`;
16
- });
17
- return wrap(`可访问的项目 (${projects.length} 个):\n\n${lines.join('\n')}`);
18
- }));
19
- }