@wfm-cn/dsh-mcp-connectors 0.2.1 → 0.2.2

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/README.md CHANGED
@@ -21,6 +21,8 @@ dsh-mcp-connectors
21
21
 
22
22
  依赖:Node.js ≥ 18,微信功能需要最新版微信并开通「微信 ClawBot」插件。
23
23
 
24
+ 支持的平台:macOS / Linux / Windows(stdio 子进程在 Windows 上经 shell 启动 `npx.cmd`)。
25
+
24
26
  ## 使用
25
27
 
26
28
  - 侧边栏「连接器」面板 → 「+ 添加连接器」→ 选择类型
package/client.js CHANGED
@@ -226,7 +226,7 @@ window.__ModuleLoader__.load({
226
226
  const wsName = (s) => {
227
227
  const cwd = String(s.cwd ?? '');
228
228
  if (!cwd) return s.live ? '(活跃)' : '';
229
- const parts = cwd.split('/').filter(Boolean);
229
+ const parts = cwd.split(/[\\/]/).filter(Boolean);
230
230
  return parts[parts.length - 1] ?? cwd;
231
231
  };
232
232
  const label = (s) => s.title || s.id;
package/index.js CHANGED
@@ -231,9 +231,20 @@ export async function apply(ctx, config = {}) {
231
231
  function stdioClient(c) {
232
232
  let cl = STDIO_CLIENTS.get(c.serverName);
233
233
  if (cl) return cl;
234
- const child = spawn(c.command, c.args ?? [], {
234
+ // Windows 上 npx/pnpm 等命令是 .cmd shim,必须经 shell 才能启动;
235
+ // macOS/Linux 不加 shell,避免参数被 shell 二次解析
236
+ const isWin = process.platform === 'win32';
237
+ let command = c.command;
238
+ if (isWin) {
239
+ const s = String(command).trim();
240
+ if (/^(npx|npm|pnpm|yarn|bunx?|uvx?|python3?|node)$/i.test(s)) command = `${s}.cmd`;
241
+ else if (/[\\/ ]/.test(s) && !/\.(cmd|exe|bat|ps1)$/i.test(s)) command = s; // 完整路径交给 shell 解析
242
+ }
243
+ const child = spawn(command, c.args ?? [], {
235
244
  env: { ...process.env, ...(c.env ?? {}) },
236
245
  stdio: ['pipe', 'pipe', 'pipe'],
246
+ shell: isWin,
247
+ windowsHide: true,
237
248
  });
238
249
  child.on('exit', () => STDIO_CLIENTS.delete(c.serverName));
239
250
  const pending = new Map();
@@ -915,7 +926,7 @@ export async function apply(ctx, config = {}) {
915
926
  'POST /wx-auth/start': async (body) => {
916
927
  const serverName = String(body?.serverName ?? 'weixin-mcp');
917
928
  const WX_BASE = 'https://ilinkai.weixin.qq.com';
918
- const ACCOUNTS_DIR = `${process.env.HOME}/.weixin-mcp/accounts`;
929
+ const ACCOUNTS_DIR = `${homedir()}/.weixin-mcp/accounts`;
919
930
  const genQr = async (url) => {
920
931
  const { default: QR } = await import('qrcode');
921
932
  return QR.toDataURL(url, { width: 360, margin: 2 });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wfm-cn/dsh-mcp-connectors",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./index.js",