@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 +2 -0
- package/client.js +1 -1
- package/index.js +13 -2
- package/package.json +1 -1
package/README.md
CHANGED
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(
|
|
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
|
-
|
|
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 = `${
|
|
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 });
|