@semacode/mcp 1.2.21 → 1.2.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/index.js +21 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,11 +6,28 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
|
|
|
6
6
|
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
7
7
|
import { SSEServerTransport } from "@modelcontextprotocol/sdk/server/sse.js";
|
|
8
8
|
import { z } from "zod";
|
|
9
|
+
function resolverSema() {
|
|
10
|
+
if (process.platform === "win32") {
|
|
11
|
+
return { cmd: "cmd.exe", prefixArgs: ["/c", "sema"] };
|
|
12
|
+
}
|
|
13
|
+
// Tenta caminhos comuns em Linux/Mac onde npm global instala
|
|
14
|
+
const candidatos = [
|
|
15
|
+
"/usr/bin/sema",
|
|
16
|
+
"/usr/local/bin/sema",
|
|
17
|
+
"/usr/lib/node_modules/.bin/sema",
|
|
18
|
+
];
|
|
19
|
+
for (const c of candidatos) {
|
|
20
|
+
try {
|
|
21
|
+
require("node:fs").accessSync(c, require("node:fs").constants.X_OK);
|
|
22
|
+
return { cmd: c, prefixArgs: [] };
|
|
23
|
+
}
|
|
24
|
+
catch { }
|
|
25
|
+
}
|
|
26
|
+
return { cmd: "sema", prefixArgs: [] };
|
|
27
|
+
}
|
|
28
|
+
const { cmd: SEMA_CMD, prefixArgs: SEMA_PREFIX } = resolverSema();
|
|
9
29
|
function chamarSema(args, cwd) {
|
|
10
|
-
const
|
|
11
|
-
const cmd = isWindows ? "cmd.exe" : "sema";
|
|
12
|
-
const cmdArgs = isWindows ? ["/c", "sema", ...args] : args;
|
|
13
|
-
const resultado = spawnSync(cmd, cmdArgs, {
|
|
30
|
+
const resultado = spawnSync(SEMA_CMD, [...SEMA_PREFIX, ...args], {
|
|
14
31
|
encoding: "utf-8",
|
|
15
32
|
cwd: cwd ?? process.cwd(),
|
|
16
33
|
env: process.env,
|