@vrs-soft/wecom-aibot-mcp 2.4.21 → 2.4.22

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/bin.js CHANGED
@@ -70,8 +70,8 @@ function showHelp() {
70
70
  拆分部署(远程 HTTP + 本地 Channel):
71
71
 
72
72
  远程服务器:
73
- npx @vrs-soft/wecom-aibot-mcp --http-only --start
74
- # 只启动 HTTP Server,不写入本地 MCP 配置
73
+ npx @vrs-soft/wecom-aibot-mcp --start
74
+ # 启动 HTTP Server(daemon 不会写本地 client MCP 配置)
75
75
 
76
76
  本地机器:
77
77
  MCP_URL=http://远程IP:18963 npx @vrs-soft/wecom-aibot-mcp --channel-only
@@ -605,7 +605,7 @@ async function main() {
605
605
  console.log(`[setup] 如需启用 HTTPS,配置证书后重新运行 --setup --server`);
606
606
  }
607
607
  console.log('\n[setup] Server 配置完成!');
608
- console.log(' 启动: npx @vrs-soft/wecom-aibot-mcp --http-only --start');
608
+ console.log(' 启动: npx @vrs-soft/wecom-aibot-mcp --start');
609
609
  console.log('\n[setup] ─── 步骤 2/2:配置企业微信机器人 ───\n');
610
610
  await addMcpConfig();
611
611
  }
@@ -691,7 +691,7 @@ async function main() {
691
691
  if (args.includes('--http-only') && !args.includes('--start')) {
692
692
  console.log('[mcp] HTTP-only 模式:仅启动 HTTP Server');
693
693
  console.log('[mcp] 不写入 MCP 配置(远程部署场景)');
694
- console.log('[mcp] 使用 --http-only --start 启动服务');
694
+ console.log('[mcp] 使用 --start 启动服务');
695
695
  process.exit(0);
696
696
  }
697
697
  // --channel-only:仅配置 Channel MCP(本地连接远程 HTTP Server)
@@ -1111,7 +1111,8 @@ export function ensureGlobalConfigs(mode = 'full', remoteOptions) {
1111
1111
  fs.writeFileSync(VERSION_FILE, JSON.stringify({ version: VERSION, installedAt: Date.now() }, null, 2));
1112
1112
  return { upgraded, previousVersion };
1113
1113
  }
1114
- // remote-channel 模式:写入远程 HTTP MCP(带 token)+ Channel MCP
1114
+ // remote-channel 模式:远程部署的 Channel 客户端——只写 Channel MCP,不写 HTTP MCP
1115
+ // (HTTP MCP daemon 在远端,本地不需要 HTTP transport client config)
1115
1116
  if (mode === 'remote-channel') {
1116
1117
  if (!remoteOptions?.url) {
1117
1118
  console.log('[config] ❌ 远程模式需要提供 URL');
@@ -1123,13 +1124,7 @@ export function ensureGlobalConfigs(mode = 'full', remoteOptions) {
1123
1124
  }
1124
1125
  if (!claudeConfig.mcpServers)
1125
1126
  claudeConfig.mcpServers = {};
1126
- // HTTP MCP 配置(带 token,可选)
1127
- const mcpEndpointUrl = remoteOptions.url.replace(/\/+$/, '') + '/mcp';
1128
- const httpMcpConfig = { type: 'http', url: mcpEndpointUrl };
1129
- if (remoteOptions.token)
1130
- httpMcpConfig.headers = { Authorization: `Bearer ${remoteOptions.token}` };
1131
- claudeConfig.mcpServers['wecom-aibot'] = httpMcpConfig;
1132
- // Channel MCP 配置(带 MCP_URL + MCP_AUTH_TOKEN)
1127
+ // 只写 Channel MCP 配置(带 MCP_URL + MCP_AUTH_TOKEN),HTTP MCP 由远端 daemon 提供,本地无需 client 配置
1133
1128
  const channelEnvRemote = { MCP_URL: remoteOptions.url.replace(/\/+$/, '') };
1134
1129
  if (remoteOptions.token)
1135
1130
  channelEnvRemote.MCP_AUTH_TOKEN = remoteOptions.token;
@@ -1138,8 +1133,13 @@ export function ensureGlobalConfigs(mode = 'full', remoteOptions) {
1138
1133
  args: ['-y', '@vrs-soft/wecom-aibot-mcp', '--channel'],
1139
1134
  env: channelEnvRemote,
1140
1135
  };
1136
+ // 移除可能残留的 HTTP MCP client 配置(远程模式 HTTP/Channel 完全分离)
1137
+ if (claudeConfig.mcpServers['wecom-aibot']) {
1138
+ delete claudeConfig.mcpServers['wecom-aibot'];
1139
+ console.log('[config] 已移除残留的 HTTP MCP client 配置(远程模式只用 Channel)');
1140
+ }
1141
1141
  fs.writeFileSync(CLAUDE_CONFIG_FILE, JSON.stringify(claudeConfig, null, 2));
1142
- console.log('[config] remote-channel 模式:已写入 HTTP MCP + Channel MCP 配置(带 Token)');
1142
+ console.log('[config] remote-channel 模式:仅写入 Channel MCP 配置');
1143
1143
  // Channel 模式需要权限配置
1144
1144
  writeMcpPermissions();
1145
1145
  console.log('[config] 已写入权限配置到 ~/.claude/settings.local.json');
@@ -1235,19 +1235,20 @@ export async function runRemoteInstallWizard() {
1235
1235
  // Server 不写入 ~/.claude.json,只提示启动命令
1236
1236
  console.log('\n─────────────────────────────────────');
1237
1237
  console.log('Server 安装完成!');
1238
- console.log(' 启动命令: npx @anthropic/wecom-aibot-mcp --http-only --start');
1238
+ console.log(' 启动命令: npx @vrs-soft/wecom-aibot-mcp --start');
1239
1239
  console.log(' 或者: npm run start:http');
1240
1240
  console.log('─────────────────────────────────────\n');
1241
1241
  console.log('[config] Client 端请在其他机器运行安装程序连接本服务器\n');
1242
1242
  return 'server';
1243
1243
  }
1244
1244
  // Client 安装模式:本机有 ~/.claude.json,作为客户端
1245
+ // 远程模式 = HTTP/Channel 完全分离:本地只装 Client 配置,daemon 在远端
1245
1246
  console.log('\n检测到本机有 ~/.claude.json → Client 安装模式\n');
1246
1247
  console.log(' 请选择连接远程服务器的方式:\n');
1247
- console.log(' 1. HTTP MCP(轮询模式)');
1248
- console.log(' 2. HTTP MCP + Channel MCP(推荐,消息自动唤醒)\n');
1248
+ console.log(' 1. Channel MCP(推荐:SSE 自动推送,消息到达立即唤醒 agent)');
1249
+ console.log(' 2. HTTP MCP(轮询模式,兼容不支持 Channel 的 Claude Code)\n');
1249
1250
  const choice = await question(rl, '请选择 (1/2): ');
1250
- const mode = choice === '2' ? 'remote-channel' : 'remote';
1251
+ const mode = choice === '2' ? 'remote' : 'remote-channel';
1251
1252
  let serverUrl = await question(rl, '远程服务器地址(如 https://your-server:18963): ');
1252
1253
  while (!serverUrl) {
1253
1254
  console.log('服务器地址不能为空');
@@ -1264,12 +1265,13 @@ export async function runRemoteInstallWizard() {
1264
1265
  ensureGlobalConfigs(mode, { url: serverUrl, token });
1265
1266
  console.log('\n─────────────────────────────────────');
1266
1267
  console.log('Client 配置完成!');
1267
- console.log(` 模式: ${mode === 'remote-channel' ? 'HTTP + Channel' : ' HTTP'}`);
1268
+ console.log(` 模式: ${mode === 'remote-channel' ? 'Channel(仅 Channel MCP)' : 'HTTP(仅 HTTP MCP)'}`);
1268
1269
  console.log(` 服务器: ${serverUrl}`);
1269
1270
  console.log(` Auth Token: ${token.slice(0, 8)}...${token.slice(-4)}`);
1270
1271
  console.log('─────────────────────────────────────\n');
1271
1272
  if (mode === 'remote-channel') {
1272
- console.log('Channel 模式优势:微信消息自动唤醒 agent,无需主动轮询');
1273
+ console.log('Channel 模式优势:微信消息通过 SSE 自动唤醒 agent,无需主动轮询');
1274
+ console.log('启动方式:claude --dangerously-load-development-channels server:wecom-aibot-channel');
1273
1275
  }
1274
1276
  console.log('[config] 请重启 Claude Code 以加载最新配置\n');
1275
1277
  return mode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vrs-soft/wecom-aibot-mcp",
3
- "version": "2.4.21",
3
+ "version": "2.4.22",
4
4
  "description": "企业微信智能机器人 MCP 服务 - Claude Code 审批通道",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",