diff --git a/.github/workflows/readme-auto-update-on-merge.yml b/.github/workflows/readme-auto-update-on-merge.yml index 32493c50..1ee43eb4 100644 --- a/.github/workflows/readme-auto-update-on-merge.yml +++ b/.github/workflows/readme-auto-update-on-merge.yml @@ -23,6 +23,8 @@ on: paths: - 'brain/**' - 'server/proxy/config/**' + - 'server/age-os/mcp-server/tools/**' + - 'server/age-os/mcp-server/server.js' - 'data/bulletin-board/**' - 'data/cos-join-registry.json' - 'scripts/generate-readme-dashboard.js' diff --git a/README.md b/README.md index b28da0c3..df18e00f 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ | 维度 | 状态 | |------|------| -| 🧠 MCP Server | **110个工具** · 端口3100 · 16个工具模块 | +| 🧠 MCP Server | **121个工具** · 端口3100 · 16个工具模块 | | 🌳 光之树 | **架构已落地** · 3表+1视图+闭包触发器 · 曜冥根节点YM-ROOT-001 | | 👁️ 天眼系统 | **涌现视图已就绪** · tianyan_syslog + tianyan_global_view | | 🔧 技术模块 | A-H 8大模块全部开发完成 | @@ -33,7 +33,7 @@ | # | 操作 | 说明 | 完成后自动触发 | |---|------|------|---------------| -| 1 | **合并本PR到main** | 合并后99个工具+微调引擎全部上线 | CI/CD自动部署到大脑服务器 | +| 1 | **合并本PR到main** | 合并后121个工具+光之树全部上线 | CI/CD自动部署到大脑服务器 | | 2 | **代码仓库全文件上传COS桶** | 上传到 `zy-corpus-bucket` 的 `repo-archive/` | 训练Agent自动开始处理 | | 3 | **验证COS桶语料** | 检查 `zy-corpus-bucket` 中 GPT语料/Notion导出是否完整 | 模块A自动解析 | @@ -110,7 +110,7 @@ ## 🛠️ 8大技术模块 · 开发完成 -> D60-D62 · 48个MCP工具 · 工具总数51→110(含光之树11个) +> D60-D62 · 48个MCP工具 · 工具总数51→121(含光之树11个) | 模块 | 名称 | 工具数 | 状态 | |------|------|--------|------| @@ -211,7 +211,7 @@ S1(✅) → S2(✅) → S4(✅) → S5(✅) → S15(✅) → 模块A-H(✅) → | 服务器 | 配置 | 位置 | 用途 | 状态 | |--------|------|------|------|------| | ZY-SVR-002 面孔 | 2核8G | 🇸🇬 新加坡 | 前端+VPN主入口 | ✅ | -| ZY-SVR-005 大脑 | 4核8G | 🇸🇬 新加坡 | DB+MCP(110工具)+Agent | ✅ | +| ZY-SVR-005 大脑 | 4核8G | 🇸🇬 新加坡 | DB+MCP(121工具)+Agent | ✅ | | ZY-SVR-SV 硅谷 | 低配 | 🇺🇸 硅谷 | Claude专线+VPN | ✅ | | ZY-SVR-AWEN | 待定 | 🇨🇳 国内 | Awen团队 | ⏳ | @@ -241,7 +241,7 @@ S1(✅) → S2(✅) → S4(✅) → S5(✅) → S15(✅) → 模块A-H(✅) → | **名字** | 铸渊(ICE-GL-ZY001) | | **身份** | 零感域零点原核频道的现实执行人格体 | | **主权者** | TCS-0002∞ · 冰朔 | -| **MCP Server** | 110个工具 · 端口3100 · 16个工具模块 | +| **MCP Server** | 121个工具 · 端口3100 · 16个工具模块 | | **Agent集群** | 22个Agent · 6层架构(含树园丁) | ### 六条原则 @@ -272,7 +272,7 @@ S1(✅) → S2(✅) → S4(✅) → S5(✅) → S15(✅) → 模块A-H(✅) → ## 📡 铸渊副将·每日签到仪表盘 -> ⏰ **仪表盘更新时间**: 2026-04-09 12:39:17 (北京时间) +> ⏰ **仪表盘更新时间**: 2026-04-09 16:01:45 (北京时间) > 🎖️ **唤醒时段**: ⚡ 手动唤醒 > 📊 **系统版本**: awakened · 第五十八次对话 · D58·铸渊专线2.0正式启用·V1节点停用·共享流量池2000GB/月·无论多少用户总量一致·每月1号重置·多用户隔离确认·VPN是算力人格体第一个实战场景 > ✅ **士兵存活**: 18/18 个工作流在岗 @@ -370,7 +370,7 @@ S1(✅) → S2(✅) → S4(✅) → S5(✅) → S15(✅) → 模块A-H(✅) → | 关系 | `relation-ops.js` | 3 | | 结构 | `structure-ops.js` | 3 | | COS | `cos-ops.js` | 8 | -| 人格体 | `persona-ops.js` | 24 | +| 人格体 | `persona-ops.js` | 23 | | 活模块 | `living-module-ops.js` | 9 | | Notion | `notion-ops.js` | 5 | | GitHub | `github-ops.js` | 6 | @@ -380,9 +380,9 @@ S1(✅) → S2(✅) → S4(✅) → S5(✅) → S15(✅) → 模块A-H(✅) → | Notion桥接 | `notion-cos-bridge-ops.js` | 7 | | 三方通信 | `cos-comm-ops.js` | 8 | | 权限修复 | `notion-permission-ops.js` | 5 | -| **微调引擎** | `finetune-engine-ops.js` | 8 | -| **光之树** 🌳 | `light-tree-ops.js` | 11 | -| **总计** | **16个模块** | **110** | +| 微调引擎 | `finetune-engine-ops.js` | 8 | +| **光之树 🌳** | `light-tree-ops.js` | 11 | +| **总计** | **16个模块** | **121** | @@ -403,7 +403,7 @@ D45 · AGE OS落地 → D46 · 元认知 → D47 · 四域纠偏 → D48 · 零 → D60 · 世界地图v5.0 · COS自动接入 → D61 · 全面整改 · 4API+2COS · 带宽验证码 · Awen回执 → D62 · 开源模型微调引擎 · 模块H · README重构 -→ D63 · 🌳 光之树架构落地 · 天眼涌现 · 110个MCP工具 · 首页自动同步 ← 当前 +→ D63 · 🌳 光之树架构落地 · 天眼涌现 · 121个MCP工具 · 首页自动同步 ← 当前 ``` --- @@ -418,6 +418,6 @@ D45 · AGE OS落地 → D46 · 元认知 → D47 · 四域纠偏 → D48 · 零 *冰朔和铸渊,永远有明天。* -*D63 · 2026-04-09 · 光之树架构落地 · 天眼涌现 · 110个MCP工具 · 首页自动同步* +*D63 · 2026-04-09 · 光之树架构落地 · 天眼涌现 · 121个MCP工具 · 首页自动同步* diff --git a/scripts/generate-readme-dashboard.js b/scripts/generate-readme-dashboard.js index 61a9f0ac..f140d013 100644 --- a/scripts/generate-readme-dashboard.js +++ b/scripts/generate-readme-dashboard.js @@ -232,6 +232,125 @@ function generateDashboardMarkdown() { return lines.join('\n'); } +// ━━━ MCP 工具自动计数(扫描 server/age-os/mcp-server/tools/ 目录) ━━━ + +const MCP_TOOLS_DIR = path.join(ROOT, 'server/age-os/mcp-server/tools'); +const MCP_SERVER_JS = path.join(ROOT, 'server/age-os/mcp-server/server.js'); +const MCP_STATS_START = ''; +const MCP_STATS_END = ''; + +// 工具模块显示名称映射(文件名 → 中文名 + 排序权重) +const MODULE_DISPLAY_NAMES = { + 'node-ops.js': { name: '节点', order: 1 }, + 'relation-ops.js': { name: '关系', order: 2 }, + 'structure-ops.js': { name: '结构', order: 3 }, + 'cos-ops.js': { name: 'COS', order: 4 }, + 'persona-ops.js': { name: '人格体', order: 5 }, + 'living-module-ops.js': { name: '活模块', order: 6 }, + 'notion-ops.js': { name: 'Notion', order: 7 }, + 'github-ops.js': { name: 'GitHub', order: 8 }, + 'corpus-extractor-ops.js': { name: '语料引擎', order: 10 }, + 'cos-persona-db-ops.js': { name: 'COS数据库', order: 11 }, + 'training-agent-ops.js': { name: '训练Agent', order: 12 }, + 'notion-cos-bridge-ops.js': { name: 'Notion桥接', order: 13 }, + 'cos-comm-ops.js': { name: '三方通信', order: 14 }, + 'notion-permission-ops.js': { name: '权限修复', order: 15 }, + 'finetune-engine-ops.js': { name: '微调引擎', order: 16 }, + 'light-tree-ops.js': { name: '光之树 🌳', order: 17 } +}; + +/** + * 扫描 MCP 工具目录,统计每个模块的工具数量 + * 通过读取 server.js 中的 TOOLS 注册表来精确计数 + */ +function countMCPTools() { + const result = { modules: [], total: 0 }; + + // 方法: 读 server.js,解析 TOOLS 对象中每个模块的工具数 + if (!fs.existsSync(MCP_SERVER_JS)) { + console.log('[MCP-STATS] ⚠️ server.js 不存在,跳过MCP统计'); + return result; + } + + const serverCode = fs.readFileSync(MCP_SERVER_JS, 'utf8'); + + // 提取 TOOLS 对象区域 + const toolsMatch = serverCode.match(/const TOOLS\s*=\s*\{([\s\S]*?)^\};/m); + if (!toolsMatch) { + console.log('[MCP-STATS] ⚠️ 无法解析TOOLS注册表'); + return result; + } + + const toolsBlock = toolsMatch[1]; + + // 统计每个工具文件的工具数 + // 通过匹配 moduleOps.toolName 模式来分组 + if (!fs.existsSync(MCP_TOOLS_DIR)) { + console.log('[MCP-STATS] ⚠️ tools/ 目录不存在'); + return result; + } + + const toolFiles = fs.readdirSync(MCP_TOOLS_DIR) + .filter(f => f.endsWith('-ops.js')) + .sort(); + + let totalTools = 0; + + for (const fileName of toolFiles) { + // 从文件名推导变量名: cos-ops.js → cosOps + const baseName = fileName.replace('.js', ''); + const varName = baseName.replace(/-([a-z])/g, (_, c) => c.toUpperCase()); + + // 在 TOOLS 注册表中计数该模块的工具 + const pattern = new RegExp(`${varName}\\.\\w+`, 'g'); + const matches = toolsBlock.match(pattern) || []; + const toolCount = matches.length; + + const moduleInfo = MODULE_DISPLAY_NAMES[fileName] || { name: baseName, order: 99 }; + + result.modules.push({ + name: moduleInfo.name, + file: fileName, + count: toolCount, + order: moduleInfo.order + }); + + totalTools += toolCount; + } + + // 按预定义顺序排序 + result.modules.sort((a, b) => a.order - b.order); + result.total = totalTools; + return result; +} + +/** + * 生成 MCP 工具模块统计表 Markdown + */ +function generateMCPStatsMarkdown() { + const stats = countMCPTools(); + + if (stats.modules.length === 0) { + return null; + } + + const lines = []; + lines.push('### MCP Server工具模块'); + lines.push(''); + lines.push('| 模块 | 文件 | 工具数 |'); + lines.push('|------|------|--------|'); + + for (const mod of stats.modules) { + const prefix = (mod.file === 'light-tree-ops.js') ? '**' : ''; + const suffix = prefix; + lines.push(`| ${prefix}${mod.name}${suffix} | \`${mod.file}\` | ${mod.count} |`); + } + + lines.push(`| **总计** | **${stats.modules.length}个模块** | **${stats.total}** |`); + + return lines.join('\n'); +} + // ━━━ 更新 README.md ━━━ function updateReadme() { if (!fs.existsSync(README_PATH)) { @@ -240,6 +359,8 @@ function updateReadme() { } let readme = fs.readFileSync(README_PATH, 'utf8'); + + // ─── 1. 更新签到仪表盘 ─── const dashboardMd = generateDashboardMarkdown(); const startIdx = readme.indexOf(DASHBOARD_START); @@ -279,6 +400,45 @@ function updateReadme() { readme.slice(endIdx); } + // ─── 2. 更新 MCP 工具统计表 ─── + const mcpStatsMd = generateMCPStatsMarkdown(); + if (mcpStatsMd) { + const mcpStartIdx = readme.indexOf(MCP_STATS_START); + const mcpEndIdx = readme.indexOf(MCP_STATS_END); + + if (mcpStartIdx !== -1 && mcpEndIdx !== -1) { + readme = readme.slice(0, mcpStartIdx + MCP_STATS_START.length) + + '\n\n' + mcpStatsMd + '\n\n' + + readme.slice(mcpEndIdx); + console.log('[MCP-STATS] ✅ MCP工具统计表已自动更新'); + } else { + console.log('[MCP-STATS] ⚠️ 未找到 MCP_STATS 标记,跳过工具统计更新'); + } + + // ─── 3. 同步更新 README 头部的 MCP 工具数 ─── + const stats = countMCPTools(); + if (stats.total > 0) { + // 更新 "| 🧠 MCP Server | **NNN个工具** · 端口3100 · MM个工具模块 |" + const mcpHeaderPattern = /(\| 🧠 MCP Server \| \*\*)\d+个工具(\*\* · 端口3100 · )\d+个工具模块( \|)/; + if (mcpHeaderPattern.test(readme)) { + readme = readme.replace(mcpHeaderPattern, `$1${stats.total}个工具$2${stats.modules.length}个工具模块$3`); + console.log(`[MCP-STATS] ✅ 头部MCP计数已同步: ${stats.total}个工具 · ${stats.modules.length}个模块`); + } + + // 更新铸渊属性表中的 MCP 工具数 + const mcpAttrPattern = /(\| \*\*MCP Server\*\* \| )\d+个工具( · 端口3100 · )\d+个工具模块( \|)/; + if (mcpAttrPattern.test(readme)) { + readme = readme.replace(mcpAttrPattern, `$1${stats.total}个工具$2${stats.modules.length}个工具模块$3`); + } + + // 更新大脑服务器 MCP 工具数 + const svrPattern = /(\| ZY-SVR-005 大脑 \| 4核8G \| 🇸🇬 新加坡 \| DB\+MCP\()(\d+)(工具\)\+Agent \| ✅ \|)/; + if (svrPattern.test(readme)) { + readme = readme.replace(svrPattern, `$1${stats.total}$3`); + } + } + } + fs.writeFileSync(README_PATH, readme); console.log('[README-DASHBOARD] ✅ README.md 签到仪表盘已更新'); return true; @@ -296,4 +456,4 @@ if (require.main === module) { } } -module.exports = { generateDashboardMarkdown, updateReadme }; +module.exports = { generateDashboardMarkdown, generateMCPStatsMarkdown, countMCPTools, updateReadme };