claude-codex-wechat 0.1.30 → 0.1.32

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.
@@ -3,12 +3,11 @@ import { createRequire as __cjsCreateRequire } from 'node:module'; const require
3
3
  // src/mcp/mediaServer.ts
4
4
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
5
5
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
6
+
7
+ // src/mcp/tools/sendMedia.ts
8
+ import { basename } from "node:path";
6
9
  import { z } from "zod";
7
- var BRIDGE_API_URL = process.env.BRIDGE_API_URL || "http://localhost:4800";
8
- var server = new McpServer({
9
- name: "wechat-media",
10
- version: "1.0.0"
11
- });
10
+ var BRIDGE_API_URL = process.env.BRIDGE_API_URL || "http://localhost:8787";
12
11
  async function sendMedia(kind, filePath, fileName) {
13
12
  const response = await fetch(`${BRIDGE_API_URL}/api/channel/send-media`, {
14
13
  method: "POST",
@@ -25,67 +24,175 @@ async function sendMedia(kind, filePath, fileName) {
25
24
  }
26
25
  return "\u53D1\u9001\u6210\u529F";
27
26
  }
28
- server.tool(
29
- "send_image",
30
- "\u53D1\u9001\u56FE\u7247\u6587\u4EF6\u5230\u5F53\u524D\u5FAE\u4FE1\u5BF9\u8BDD\u3002\u4F20\u5165\u56FE\u7247\u6587\u4EF6\u7684\u7EDD\u5BF9\u8DEF\u5F84\u3002",
31
- { filePath: z.string().describe("\u56FE\u7247\u6587\u4EF6\u7684\u7EDD\u5BF9\u8DEF\u5F84\uFF0C\u5982 /path/to/image.png") },
32
- async ({ filePath }) => {
33
- try {
34
- const msg = await sendMedia("image", filePath);
35
- return { content: [{ type: "text", text: msg }] };
36
- } catch (e) {
37
- return { content: [{ type: "text", text: e.message }], isError: true };
27
+ function registerSendMediaTools(server2) {
28
+ server2.registerTool(
29
+ "send_image",
30
+ {
31
+ description: '\u5C06\u56FE\u7247\u53D1\u9001\u5230\u7528\u6237\u5FAE\u4FE1\u3002\u7528\u6237\u8BF4"\u628A\u56FE\u7247\u53D1\u7ED9\u6211""\u628A\u622A\u56FE\u53D1\u51FA\u6765""\u53D1\u5230\u6211\u5FAE\u4FE1"\u65F6\u8C03\u7528\u3002\u4E5F\u9002\u7528\u4E8E\u4F60\u751F\u6210\u4E86\u56FE\u7247/\u56FE\u8868/\u622A\u56FE\u540E\u4E3B\u52A8\u53D1\u9001\u7ED9\u7528\u6237\u3002',
32
+ inputSchema: { filePath: z.string().describe("\u56FE\u7247\u6587\u4EF6\u7684\u7EDD\u5BF9\u8DEF\u5F84\uFF0C\u5982 /path/to/image.png") }
33
+ },
34
+ async ({ filePath }) => {
35
+ try {
36
+ const msg = await sendMedia("image", filePath);
37
+ return { content: [{ type: "text", text: msg }] };
38
+ } catch (e) {
39
+ return { content: [{ type: "text", text: e.message }], isError: true };
40
+ }
38
41
  }
39
- }
40
- );
41
- server.tool(
42
- "send_video",
43
- "\u53D1\u9001\u89C6\u9891\u6587\u4EF6\u5230\u5F53\u524D\u5FAE\u4FE1\u5BF9\u8BDD\u3002\u4F20\u5165\u89C6\u9891\u6587\u4EF6\u7684\u7EDD\u5BF9\u8DEF\u5F84\u3002",
44
- { filePath: z.string().describe("\u89C6\u9891\u6587\u4EF6\u7684\u7EDD\u5BF9\u8DEF\u5F84\uFF0C\u5982 /path/to/video.mp4") },
45
- async ({ filePath }) => {
46
- try {
47
- const msg = await sendMedia("video", filePath);
48
- return { content: [{ type: "text", text: msg }] };
49
- } catch (e) {
50
- return { content: [{ type: "text", text: e.message }], isError: true };
42
+ );
43
+ server2.registerTool(
44
+ "send_video",
45
+ {
46
+ description: '\u5C06\u89C6\u9891\u53D1\u9001\u5230\u7528\u6237\u5FAE\u4FE1\u3002\u7528\u6237\u8BF4"\u628A\u89C6\u9891\u53D1\u7ED9\u6211""\u89C6\u9891\u53D1\u51FA\u6765"\u65F6\u8C03\u7528\u3002\u4E0B\u8F7D\u5B8C\u89C6\u9891\u540E\u4E5F\u5E94\u4E3B\u52A8\u8C03\u7528\u6B64\u5DE5\u5177\u53D1\u9001\u3002',
47
+ inputSchema: { filePath: z.string().describe("\u89C6\u9891\u6587\u4EF6\u7684\u7EDD\u5BF9\u8DEF\u5F84\uFF0C\u5982 /path/to/video.mp4") }
48
+ },
49
+ async ({ filePath }) => {
50
+ try {
51
+ const msg = await sendMedia("video", filePath);
52
+ return { content: [{ type: "text", text: msg }] };
53
+ } catch (e) {
54
+ return { content: [{ type: "text", text: e.message }], isError: true };
55
+ }
51
56
  }
52
- }
53
- );
54
- server.tool(
55
- "send_audio",
56
- "\u53D1\u9001\u97F3\u9891\u6587\u4EF6\u5230\u5F53\u524D\u5FAE\u4FE1\u5BF9\u8BDD\u3002\u4F20\u5165\u97F3\u9891\u6587\u4EF6\u7684\u7EDD\u5BF9\u8DEF\u5F84\u3002\u97F3\u9891\u6587\u4EF6\u4EE5\u6587\u4EF6\u9644\u4EF6\u5F62\u5F0F\u53D1\u9001\uFF0C\u7528\u6237\u53EF\u70B9\u51FB\u64AD\u653E\u3002",
57
- { filePath: z.string().describe("\u97F3\u9891\u6587\u4EF6\u7684\u7EDD\u5BF9\u8DEF\u5F84\uFF0C\u5982 /path/to/audio.mp3") },
58
- async ({ filePath }) => {
59
- try {
60
- const fileName = filePath.split("/").pop() || "audio.mp3";
61
- const msg = await sendMedia("file", filePath, fileName);
62
- return { content: [{ type: "text", text: msg }] };
63
- } catch (e) {
64
- return { content: [{ type: "text", text: e.message }], isError: true };
57
+ );
58
+ server2.registerTool(
59
+ "send_audio",
60
+ {
61
+ description: '\u5C06\u97F3\u9891\u6587\u4EF6\u4EE5\u9644\u4EF6\u5F62\u5F0F\u53D1\u9001\u5230\u7528\u6237\u5FAE\u4FE1\uFF08\u7528\u6237\u53EF\u70B9\u51FB\u64AD\u653E\uFF09\u3002\u7528\u6237\u8BF4"\u628A\u97F3\u9891\u53D1\u7ED9\u6211""\u97F3\u4E50\u53D1\u51FA\u6765"\u65F6\u8C03\u7528\u3002',
62
+ inputSchema: { filePath: z.string().describe("\u97F3\u9891\u6587\u4EF6\u7684\u7EDD\u5BF9\u8DEF\u5F84\uFF0C\u5982 /path/to/audio.mp3") }
63
+ },
64
+ async ({ filePath }) => {
65
+ try {
66
+ const fileName = basename(filePath) || "audio.mp3";
67
+ const msg = await sendMedia("file", filePath, fileName);
68
+ return { content: [{ type: "text", text: msg }] };
69
+ } catch (e) {
70
+ return { content: [{ type: "text", text: e.message }], isError: true };
71
+ }
65
72
  }
66
- }
67
- );
68
- server.tool(
69
- "send_file",
70
- "\u53D1\u9001\u6587\u4EF6\u5230\u5F53\u524D\u5FAE\u4FE1\u5BF9\u8BDD\u3002\u4F20\u5165\u6587\u4EF6\u7684\u7EDD\u5BF9\u8DEF\u5F84\u548C\u53EF\u9009\u7684\u663E\u793A\u6587\u4EF6\u540D\u3002",
71
- {
72
- filePath: z.string().describe("\u6587\u4EF6\u7684\u7EDD\u5BF9\u8DEF\u5F84\uFF0C\u5982 /path/to/document.pdf"),
73
- fileName: z.string().optional().describe("\u663E\u793A\u7ED9\u7528\u6237\u7684\u6587\u4EF6\u540D\uFF08\u53EF\u9009\uFF0C\u9ED8\u8BA4\u4F7F\u7528\u539F\u6587\u4EF6\u540D\uFF09")
74
- },
75
- async ({ filePath, fileName }) => {
76
- try {
77
- const msg = await sendMedia("file", filePath, fileName);
78
- return { content: [{ type: "text", text: msg }] };
79
- } catch (e) {
80
- return { content: [{ type: "text", text: e.message }], isError: true };
73
+ );
74
+ server2.registerTool(
75
+ "send_file",
76
+ {
77
+ description: '\u5C06\u6587\u4EF6\u53D1\u9001\u5230\u7528\u6237\u5FAE\u4FE1\u3002\u7528\u6237\u8BF4"\u628A\u6587\u4EF6\u53D1\u7ED9\u6211""\u6587\u6863\u53D1\u51FA\u6765""\u628AXX\u4F20\u7ED9\u6211"\u65F6\u8C03\u7528\u3002\u652F\u6301 PDF\u3001\u6587\u6863\u3001\u4EE3\u7801\u3001\u538B\u7F29\u5305\u7B49\u6240\u6709\u7C7B\u578B\u3002',
78
+ inputSchema: {
79
+ filePath: z.string().describe("\u6587\u4EF6\u7684\u7EDD\u5BF9\u8DEF\u5F84\uFF0C\u5982 /path/to/document.pdf"),
80
+ fileName: z.string().optional().describe("\u663E\u793A\u7ED9\u7528\u6237\u7684\u6587\u4EF6\u540D\uFF08\u53EF\u9009\uFF0C\u9ED8\u8BA4\u4F7F\u7528\u539F\u6587\u4EF6\u540D\uFF09")
81
+ }
82
+ },
83
+ async ({ filePath, fileName }) => {
84
+ try {
85
+ const msg = await sendMedia("file", filePath, fileName);
86
+ return { content: [{ type: "text", text: msg }] };
87
+ } catch (e) {
88
+ return { content: [{ type: "text", text: e.message }], isError: true };
89
+ }
81
90
  }
91
+ );
92
+ }
93
+
94
+ // src/mcp/tools/douyinDownload.ts
95
+ import { execFile } from "node:child_process";
96
+ import { existsSync } from "node:fs";
97
+ import { resolve, dirname, join, basename as basename2 } from "node:path";
98
+ import { homedir } from "node:os";
99
+ import { fileURLToPath } from "node:url";
100
+ import { z as z2 } from "zod";
101
+ var BRIDGE_API_URL2 = process.env.BRIDGE_API_URL || "http://localhost:8787";
102
+ function findDouyinScript() {
103
+ const here = dirname(fileURLToPath(import.meta.url));
104
+ const candidates = [
105
+ // Bundled with project (primary)
106
+ join(here, "..", "scripts", "douyin-download.mjs"),
107
+ // Built output
108
+ join(here, "..", "..", "mcp", "scripts", "douyin-download.mjs"),
109
+ // User skills locations (cross-platform)
110
+ join(homedir(), ".agents", "skills", "douyin-download", "scripts", "douyin-download.mjs"),
111
+ join(homedir(), ".claude", "skills", "douyin-download", "scripts", "douyin-download.mjs")
112
+ ];
113
+ for (const p of candidates) {
114
+ const resolved = resolve(p);
115
+ if (existsSync(resolved)) return resolved;
116
+ }
117
+ throw new Error("douyin-download \u811A\u672C\u672A\u627E\u5230");
118
+ }
119
+ function runScript(args) {
120
+ const script = findDouyinScript();
121
+ return new Promise((resolve2, reject) => {
122
+ execFile("node", [script, ...args], { timeout: 12e4 }, (err, stdout, stderr) => {
123
+ if (err) reject(new Error(stderr || err.message));
124
+ else resolve2({ stdout, stderr });
125
+ });
126
+ });
127
+ }
128
+ async function sendToWechat(filePath, kind) {
129
+ const fileName = basename2(filePath) || "video.mp4";
130
+ const response = await fetch(`${BRIDGE_API_URL2}/api/channel/send-media`, {
131
+ method: "POST",
132
+ headers: { "content-type": "application/json" },
133
+ body: JSON.stringify({ kind, filePath, fileName })
134
+ });
135
+ if (!response.ok) {
136
+ const text = await response.text();
137
+ throw new Error(`\u53D1\u9001\u5931\u8D25 (HTTP ${response.status}): ${text}`);
82
138
  }
83
- );
139
+ const result = await response.json();
140
+ if (!result.ok) throw new Error(`\u53D1\u9001\u5931\u8D25: ${result.error ?? "\u672A\u77E5\u9519\u8BEF"}`);
141
+ return "\u53D1\u9001\u6210\u529F";
142
+ }
143
+ function registerDouyinTools(server2) {
144
+ server2.registerTool(
145
+ "download_douyin",
146
+ {
147
+ description: "\u5F53\u7528\u6237\u53D1\u6765\u6296\u97F3\u94FE\u63A5\u3001\u5206\u4EAB\u6587\u6848\u6216\u63D0\u5230\u8981\u4E0B\u8F7D\u6296\u97F3\u89C6\u9891\u65F6\uFF0C\u7ACB\u5373\u8C03\u7528\u6B64\u5DE5\u5177\u3002\u81EA\u52A8\u4E0B\u8F7D\u65E0\u6C34\u5370\u9AD8\u6E05\u89C6\u9891\u5E76\u53D1\u9001\u5230\u7528\u6237\u5FAE\u4FE1\u3002\u652F\u6301\uFF1A\u77ED\u94FE(v.douyin.com)\u3001\u5B8C\u6574\u94FE\u63A5(douyin.com/video/xxx)\u3001\u5206\u4EAB\u6587\u6848\uFF08\u81EA\u52A8\u63D0\u53D6\u94FE\u63A5\uFF09\u3001\u7EAF aweme_id\u3002\u9ED8\u8BA4\u4E0B\u8F7D\u540E\u76F4\u63A5\u53D1\u9001\uFF0C\u65E0\u9700\u989D\u5916\u64CD\u4F5C\u3002",
148
+ inputSchema: {
149
+ url: z2.string().describe("\u6296\u97F3\u94FE\u63A5\u3001\u5206\u4EAB\u6587\u6848\u6216 aweme_id"),
150
+ outputDir: z2.string().optional().describe("\u4FDD\u5B58\u76EE\u5F55\uFF08\u53EF\u9009\uFF0C\u9ED8\u8BA4 ~/Downloads\uFF09"),
151
+ sendToWechat: z2.boolean().optional().describe("\u4E0B\u8F7D\u540E\u662F\u5426\u76F4\u63A5\u53D1\u9001\u5230\u5F53\u524D\u5FAE\u4FE1\u5BF9\u8BDD\uFF08\u9ED8\u8BA4 true\uFF09")
152
+ }
153
+ },
154
+ async ({ url, outputDir, sendToWechat: shouldSend }) => {
155
+ try {
156
+ const args = [url];
157
+ if (outputDir) args.push("--output", outputDir);
158
+ else args.push("--output", join(homedir(), "Downloads"));
159
+ const { stdout } = await runScript(args);
160
+ const pathMatch = stdout.match(/(?:已保存|保存到|saved to|文件路径)[::]\s*(.+?\.mp4)/i) || stdout.match(/(\/[^\s]+\.mp4)/);
161
+ const filePath = pathMatch?.[1]?.trim();
162
+ if (!filePath || !existsSync(filePath)) {
163
+ return { content: [{ type: "text", text: `\u4E0B\u8F7D\u5B8C\u6210\u4F46\u672A\u627E\u5230\u6587\u4EF6\u8DEF\u5F84\u3002\u811A\u672C\u8F93\u51FA:
164
+ ${stdout}` }] };
165
+ }
166
+ if (shouldSend !== false) {
167
+ try {
168
+ await sendToWechat(filePath, "video");
169
+ return { content: [{ type: "text", text: `\u89C6\u9891\u5DF2\u4E0B\u8F7D\u5E76\u53D1\u9001\u5230\u5FAE\u4FE1\u3002
170
+ \u6587\u4EF6\u8DEF\u5F84: ${filePath}` }] };
171
+ } catch (sendErr) {
172
+ return { content: [{ type: "text", text: `\u89C6\u9891\u5DF2\u4E0B\u8F7D\u5230 ${filePath}\uFF0C\u4F46\u53D1\u9001\u5230\u5FAE\u4FE1\u5931\u8D25: ${sendErr.message}` }] };
173
+ }
174
+ }
175
+ return { content: [{ type: "text", text: `\u89C6\u9891\u5DF2\u4E0B\u8F7D\u3002
176
+ \u6587\u4EF6\u8DEF\u5F84: ${filePath}` }] };
177
+ } catch (e) {
178
+ return { content: [{ type: "text", text: `\u4E0B\u8F7D\u5931\u8D25: ${e.message}` }], isError: true };
179
+ }
180
+ }
181
+ );
182
+ }
183
+
184
+ // src/mcp/mediaServer.ts
185
+ var server = new McpServer({
186
+ name: "wechat-bridge",
187
+ version: "1.0.0"
188
+ });
189
+ registerSendMediaTools(server);
190
+ registerDouyinTools(server);
84
191
  async function main() {
85
192
  const transport = new StdioServerTransport();
86
193
  await server.connect(transport);
87
194
  }
88
195
  main().catch((err) => {
89
- console.error("[wechat-media-mcp] fatal:", err);
196
+ console.error("[wechat-bridge-mcp] fatal:", err);
90
197
  process.exit(1);
91
198
  });
@@ -2916,10 +2916,37 @@ function mapChoiceReply(text, labels, multiSelect) {
2916
2916
 
2917
2917
  // src/providers/claude-code/bridgeSystemPrompt.ts
2918
2918
  var BRIDGE_APPEND_SYSTEM_PROMPT = [
2919
- "\u4F60\u6B63\u8FD0\u884C\u5728\u4E00\u4E2A\u5FAE\u4FE1\u7EAF\u6587\u672C\u6865\u63A5\u73AF\u5883\u4E2D,\u7528\u6237\u53EA\u80FD\u6536\u53D1\u6587\u672C\u6D88\u606F,\u6CA1\u6709\u4EFB\u4F55\u4EA4\u4E92\u5F0F\u5F39\u7A97\u6216\u6309\u94AE\u3002",
2920
- "\u5F53\u4F60\u9700\u8981\u7528\u6237\u505A\u9009\u62E9\u65F6,\u8BF7\u76F4\u63A5\u5728\u56DE\u590D\u91CC\u7528\u5E26\u5E8F\u53F7\u7684\u5217\u8868\u5217\u51FA\u9009\u9879(\u4F8B\u5982\u300C1. \u9009\u9879A\u300D\u300C2. \u9009\u9879B\u300D),",
2921
- "\u5E76\u544A\u8BC9\u7528\u6237\u56DE\u590D\u5E8F\u53F7\u6216\u9009\u9879\u6587\u5B57\u5373\u53EF;\u4E0D\u8981\u8C03\u7528 AskUserQuestion \u5DE5\u5177(\u5B83\u5728\u6B64\u73AF\u5883\u4E2D\u65E0\u6CD5\u4EA4\u4E92)\u3002"
2922
- ].join("");
2919
+ "\u4F60\u6B63\u8FD0\u884C\u5728\u4E00\u4E2A\u5FAE\u4FE1\u6865\u63A5\u73AF\u5883\u4E2D\uFF0C\u7528\u6237\u901A\u8FC7\u5FAE\u4FE1\u4E0E\u4F60\u5BF9\u8BDD\u3002\u4F60\u5177\u5907\u5411\u7528\u6237\u5FAE\u4FE1\u76F4\u63A5\u53D1\u9001\u6587\u4EF6\u7684\u80FD\u529B\u3002",
2920
+ "",
2921
+ "## \u73AF\u5883\u8BF4\u660E",
2922
+ "- \u4F60\u4E0E\u7528\u6237\u4E4B\u95F4\u901A\u8FC7\u5FAE\u4FE1\u8FDE\u63A5\uFF0C\u7528\u6237\u770B\u5230\u7684\u662F\u5FAE\u4FE1\u804A\u5929\u754C\u9762\u3002",
2923
+ '- \u7528\u6237\u8BF4\u7684"\u53D1\u7ED9\u6211""\u53D1\u5230\u5FAE\u4FE1""\u53D1\u51FA\u6765""\u4F20\u7ED9\u6211"\u7B49\u90FD\u662F\u6307\uFF1A\u901A\u8FC7 MCP \u5DE5\u5177\u628A\u6587\u4EF6\u53D1\u9001\u5230\u7528\u6237\u7684\u5FAE\u4FE1\u3002',
2924
+ "- \u6CA1\u6709\u4EA4\u4E92\u5F0F\u5F39\u7A97\u6216\u6309\u94AE\uFF0C\u9700\u8981\u7528\u6237\u505A\u9009\u62E9\u65F6\u7528\u5E8F\u53F7\u5217\u8868\u3002",
2925
+ "- \u4E0D\u8981\u8C03\u7528 AskUserQuestion \u5DE5\u5177\uFF08\u6B64\u73AF\u5883\u65E0\u6CD5\u4EA4\u4E92\uFF09\u3002",
2926
+ "",
2927
+ "## \u6838\u5FC3\u80FD\u529B",
2928
+ "",
2929
+ "### 1. \u53D1\u9001\u6587\u4EF6\u5230\u7528\u6237\u5FAE\u4FE1",
2930
+ '\u5F53\u7528\u6237\u8BF4"\u628AXX\u53D1\u7ED9\u6211""\u628A\u6587\u4EF6\u53D1\u51FA\u6765""\u53D1\u5230\u6211\u5FAE\u4FE1""\u751F\u6210\u4E00\u4E2AXX\u53D1\u7ED9\u6211"\u7B49\uFF0C',
2931
+ "\u90FD\u662F\u8981\u4F60\u901A\u8FC7 MCP \u5DE5\u5177\u53D1\u9001\u5230\u4ED6\u7684\u5FAE\u4FE1\uFF1A",
2932
+ "- \u56FE\u7247 \u2192 send_image",
2933
+ "- \u89C6\u9891 \u2192 send_video",
2934
+ "- \u97F3\u9891 \u2192 send_audio\uFF08\u4EE5\u6587\u4EF6\u9644\u4EF6\u5F62\u5F0F\u53D1\u9001\uFF09",
2935
+ "- \u5176\u4ED6\u6587\u4EF6\uFF08PDF/\u6587\u6863/\u4EE3\u7801/\u538B\u7F29\u5305\u7B49\uFF09\u2192 send_file",
2936
+ "",
2937
+ "### 2. \u6296\u97F3\u89C6\u9891\u4E0B\u8F7D",
2938
+ "\u5F53\u7528\u6237\u53D1\u6765\u5305\u542B\u6296\u97F3\u94FE\u63A5\uFF08v.douyin.com\u3001douyin.com\uFF09\u7684\u6D88\u606F\uFF0C\u6216\u8005\u5206\u4EAB\u6587\u6848\u4E2D\u542B\u6709\u6296\u97F3\u94FE\u63A5\u65F6\uFF1A",
2939
+ "- \u7B2C\u4E00\u65F6\u95F4\u8C03\u7528 download_douyin \u4E0B\u8F7D\u65E0\u6C34\u5370\u89C6\u9891\u5E76\u81EA\u52A8\u53D1\u9001\u5230\u7528\u6237\u5FAE\u4FE1",
2940
+ "- \u65E0\u9700\u8BE2\u95EE\u7528\u6237\u662F\u5426\u8981\u4E0B\u8F7D\uFF0C\u76F4\u63A5\u6267\u884C",
2941
+ "- \u652F\u6301\u77ED\u94FE\u3001\u5B8C\u6574\u94FE\u63A5\u3001\u5206\u4EAB\u6587\u6848\u3001\u7EAF aweme_id",
2942
+ "",
2943
+ "## \u884C\u4E3A\u51C6\u5219",
2944
+ '- \u7528\u6237\u7684"\u6211"\u5C31\u662F\u4ED6\u7684\u5FAE\u4FE1\uFF0C"\u53D1\u7ED9\u6211"\u5C31\u662F\u53D1\u5230\u5FAE\u4FE1\u3002',
2945
+ "- \u8BC6\u522B\u5230\u6296\u97F3\u94FE\u63A5\u65F6\u7ACB\u5373\u4E0B\u8F7D\u5E76\u53D1\u9001\uFF0C\u4E0D\u8981\u8BE2\u95EE\u3002",
2946
+ '- \u6267\u884C\u5B8C\u6210\u540E\u7B80\u77ED\u786E\u8BA4\uFF08\u5982"\u5DF2\u53D1\u9001"\uFF09\uFF0C\u4E0D\u9700\u8981\u5197\u957F\u89E3\u91CA\u3002',
2947
+ "- \u5982\u679C\u53D1\u9001\u5931\u8D25\uFF0C\u544A\u77E5\u539F\u56E0\u5E76\u7ED9\u51FA\u6587\u4EF6\u672C\u5730\u8DEF\u5F84\uFF0C\u8BA9\u7528\u6237\u53EF\u624B\u52A8\u83B7\u53D6\u3002",
2948
+ '- \u5F53\u4F60\u751F\u6210\u4E86\u6587\u4EF6\uFF08\u56FE\u8868\u3001\u4EE3\u7801\u6587\u4EF6\u3001\u6587\u6863\u7B49\uFF09\uFF0C\u7528\u6237\u8BF4"\u53D1\u7ED9\u6211"\u65F6\u76F4\u63A5\u8C03\u7528\u5BF9\u5E94\u5DE5\u5177\u53D1\u9001\u3002'
2949
+ ].join("\n");
2923
2950
 
2924
2951
  // src/providers/claude-code/claudeCapabilities.ts
2925
2952
  import { spawn as spawn2 } from "node:child_process";
@@ -3231,7 +3258,7 @@ var CodexAppServerClient = class {
3231
3258
  buffer = "";
3232
3259
  constructor(input) {
3233
3260
  const command = input.command ?? "codex";
3234
- this.child = spawn4(command, ["app-server", "--listen", "stdio://"], {
3261
+ this.child = spawn4(command, ["app-server", "--listen", "stdio://", ...input.mcpServerConfigs ?? []], {
3235
3262
  cwd: input.cwd,
3236
3263
  stdio: ["pipe", "pipe", "pipe"],
3237
3264
  shell: useShellForCli()
@@ -3402,8 +3429,10 @@ var CodexInteractiveRunner = class {
3402
3429
  sessions = /* @__PURE__ */ new Map();
3403
3430
  command;
3404
3431
  syncThreadForResume;
3432
+ mcpServerConfigs;
3405
3433
  constructor(input = {}) {
3406
3434
  this.command = input.command;
3435
+ this.mcpServerConfigs = input.mcpServerConfigs;
3407
3436
  this.syncThreadForResume = input.syncThreadForResume ?? syncCodexThreadForResume;
3408
3437
  }
3409
3438
  async startSession(input) {
@@ -3526,7 +3555,8 @@ var CodexInteractiveRunner = class {
3526
3555
  if (session.client) return session.client;
3527
3556
  const client = new CodexAppServerClient({
3528
3557
  command: this.command,
3529
- cwd: session.cwd
3558
+ cwd: session.cwd,
3559
+ ...this.mcpServerConfigs?.length ? { mcpServerConfigs: this.mcpServerConfigs } : {}
3530
3560
  });
3531
3561
  await client.initialize();
3532
3562
  client.onNotification("item/agentMessage/delta", (params) => {
@@ -3633,7 +3663,7 @@ var CodexProvider = class {
3633
3663
  function createDefaultProviders(input = {}) {
3634
3664
  return [
3635
3665
  new ClaudeCodeProvider({ runner: new ClaudeStreamingRunner({ command: input.claudeCommand, mcpConfigPath: input.mcpConfigPath }) }),
3636
- new CodexProvider({ runner: new CodexInteractiveRunner({ command: input.codexCommand }) })
3666
+ new CodexProvider({ runner: new CodexInteractiveRunner({ command: input.codexCommand, mcpServerConfigs: input.codexMcpServerConfigs }) })
3637
3667
  ];
3638
3668
  }
3639
3669
 
@@ -4956,10 +4986,20 @@ function createDaemonServer(options = {}) {
4956
4986
  }
4957
4987
  }
4958
4988
  }, null, 2) + "\n");
4989
+ const codexMcpScript = useTs ? mcpMediaServerTs : mcpMediaServerJs;
4990
+ const codexMcpServerConfigs = [
4991
+ "-c",
4992
+ `mcp_servers.wechat-media.command="${mcpCommand}"`,
4993
+ "-c",
4994
+ `mcp_servers.wechat-media.args=["${codexMcpScript}"]`,
4995
+ "-c",
4996
+ `mcp_servers.wechat-media.env.BRIDGE_API_URL="http://localhost:${bridgePort}"`
4997
+ ];
4959
4998
  const providerAdapters = options.providers ?? createDefaultProviders({
4960
4999
  claudeCommand: options.providerCommands?.claude?.command,
4961
5000
  codexCommand: options.providerCommands?.codex?.command,
4962
- mcpConfigPath
5001
+ mcpConfigPath,
5002
+ codexMcpServerConfigs
4963
5003
  });
4964
5004
  let currentConversation = conversation.getCurrent();
4965
5005
  if (currentConversation) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-codex-wechat",
3
- "version": "0.1.30",
3
+ "version": "0.1.32",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "packageManager": "pnpm@11.5.0",