Skip to content

Commit 7f47b39

Browse files
committed
chore(client): MCP 启动命令移入 scripts/mcp.mjs,package.json 收敛为单一 mcp 入口
1 parent 996334b commit 7f47b39

2 files changed

Lines changed: 39 additions & 4 deletions

File tree

‎client/package.json‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,7 @@
2424
"test:watch": "vitest",
2525
"test:coverage": "vitest run --coverage",
2626
"postinstall": "electron-rebuild -f -w better-sqlite3",
27-
"modelcontextprotocol": "mcp-server-sdk",
28-
"fs": "mcp-server-filesystem",
29-
"seq": "mcp-server-sequential-thinking",
30-
"memory": "mcp-server-memory"
27+
"mcp": "node scripts/mcp.mjs"
3128
},
3229
"dependencies": {
3330
"@automerge/automerge": "^3.3.2",

‎client/scripts/mcp.mjs‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/usr/bin/env node
2+
/**
3+
* MCP 服务器启动入口(供 AI 编程工具 MCP 配置引用)
4+
*
5+
* @ai-context: 熵减为 AI 工具提供 MCP 能力:文件系统、顺序思考、记忆、SDK。
6+
* 用法示例(Claude Code / Cursor 的 mcp 配置):
7+
* "entropy-fs": { "command": "node", "args": ["client/scripts/mcp.mjs", "fs"] }
8+
* "entropy-seq": { "command": "node", "args": ["client/scripts/mcp.mjs", "seq"] }
9+
* "entropy-memory": { "command": "node", "args": ["client/scripts/mcp.mjs", "memory"] }
10+
* 2026-08 R8:从 package.json scripts 移出(避免与构建/测试命令混淆),
11+
* 原 npm run modelcontextprotocol/fs/seq/memory 命令已由本入口替代。
12+
*/
13+
import { spawn } from 'node:child_process';
14+
import { fileURLToPath } from 'node:url';
15+
import { dirname, join } from 'node:path';
16+
17+
const SERVERS = {
18+
fs: 'mcp-server-filesystem',
19+
seq: 'mcp-server-sequential-thinking',
20+
memory: 'mcp-server-memory',
21+
sdk: 'mcp-server-sdk',
22+
};
23+
24+
const name = process.argv[2] ?? 'sdk';
25+
const bin = SERVERS[name];
26+
if (!bin) {
27+
console.error(`未知 MCP 服务器: ${name}(可用: ${Object.keys(SERVERS).join(', ')})`);
28+
process.exit(1);
29+
}
30+
31+
const root = join(dirname(fileURLToPath(import.meta.url)), '..');
32+
// 继承 stdio:MCP 协议走 stdin/stdout,stderr 用于日志
33+
const child = spawn('npx', [bin], {
34+
cwd: root,
35+
stdio: 'inherit',
36+
shell: process.platform === 'win32',
37+
});
38+
child.on('exit', (code) => process.exit(code ?? 0));

0 commit comments

Comments
 (0)