@semacode/mcp 1.2.21 → 1.2.23

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.
Files changed (2) hide show
  1. package/dist/index.js +22 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,16 +1,34 @@
1
1
  #!/usr/bin/env node
2
2
  import { createServer } from "node:http";
3
3
  import { spawnSync } from "node:child_process";
4
+ import { accessSync, constants as fsConstants } from "node:fs";
4
5
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
5
6
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
6
7
  import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
7
8
  import { SSEServerTransport } from "@modelcontextprotocol/sdk/server/sse.js";
8
9
  import { z } from "zod";
10
+ function resolverSema() {
11
+ if (process.platform === "win32") {
12
+ return { cmd: "cmd.exe", prefixArgs: ["/c", "sema"] };
13
+ }
14
+ // Tenta caminhos comuns em Linux/Mac onde npm global instala
15
+ const candidatos = [
16
+ "/usr/bin/sema",
17
+ "/usr/local/bin/sema",
18
+ "/usr/lib/node_modules/.bin/sema",
19
+ ];
20
+ for (const c of candidatos) {
21
+ try {
22
+ accessSync(c, fsConstants.X_OK);
23
+ return { cmd: c, prefixArgs: [] };
24
+ }
25
+ catch { }
26
+ }
27
+ return { cmd: "sema", prefixArgs: [] };
28
+ }
29
+ const { cmd: SEMA_CMD, prefixArgs: SEMA_PREFIX } = resolverSema();
9
30
  function chamarSema(args, cwd) {
10
- const isWindows = process.platform === "win32";
11
- const cmd = isWindows ? "cmd.exe" : "sema";
12
- const cmdArgs = isWindows ? ["/c", "sema", ...args] : args;
13
- const resultado = spawnSync(cmd, cmdArgs, {
31
+ const resultado = spawnSync(SEMA_CMD, [...SEMA_PREFIX, ...args], {
14
32
  encoding: "utf-8",
15
33
  cwd: cwd ?? process.cwd(),
16
34
  env: process.env,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@semacode/mcp",
3
- "version": "1.2.21",
3
+ "version": "1.2.23",
4
4
  "type": "module",
5
5
  "description": "Servidor MCP da Sema — expoe validacao, drift e contexto IA como ferramentas para agentes.",
6
6
  "license": "MIT",