granttap-mcp 0.8.31 → 0.8.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.
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { chmod, mkdtemp, rm } from "node:fs/promises";
|
|
2
|
+
import { randomUUID } from "node:crypto";
|
|
2
3
|
import { tmpdir } from "node:os";
|
|
3
4
|
import { join } from "node:path";
|
|
4
5
|
import { createServer, type Socket } from "node:net";
|
|
@@ -30,6 +31,10 @@ export const DESKTOP_OPERATIONS = new Set([
|
|
|
30
31
|
"desktop.network_status", "desktop.network_configure", "desktop.own_relay",
|
|
31
32
|
]);
|
|
32
33
|
|
|
34
|
+
export function windowsDesktopPipePath(id: string): string {
|
|
35
|
+
return String.raw`\\.\pipe\granttap-desktop-${id}`;
|
|
36
|
+
}
|
|
37
|
+
|
|
33
38
|
export function desktopOperationTimeout(operation: unknown, input: unknown): number {
|
|
34
39
|
if (operation === "desktop.mesh_snapshot"
|
|
35
40
|
&& (input as { refresh_graph?: unknown } | undefined)?.refresh_graph === "true") return 120_000;
|
|
@@ -57,8 +62,10 @@ export async function startDesktopEngineBridge(options: {
|
|
|
57
62
|
client?: Pick<EngineClient, "request" | "close">;
|
|
58
63
|
onPairingChanged?: () => void;
|
|
59
64
|
} = {}): Promise<{ socketPath: string; close: () => Promise<void> }> {
|
|
60
|
-
const directory =
|
|
61
|
-
|
|
65
|
+
const directory = process.platform === "win32" ? null
|
|
66
|
+
: await mkdtemp(join(tmpdir(), "granttap-desktop-"));
|
|
67
|
+
const socketPath = directory ? join(directory, "engine.sock")
|
|
68
|
+
: windowsDesktopPipePath(randomUUID());
|
|
62
69
|
const engine = options.client ?? new EngineClient({
|
|
63
70
|
socketPath: options.engineSocketPath ?? join(configDir(), "engine.sock"),
|
|
64
71
|
});
|
|
@@ -121,14 +128,15 @@ export async function startDesktopEngineBridge(options: {
|
|
|
121
128
|
try {
|
|
122
129
|
await new Promise<void>((resolve, reject) => {
|
|
123
130
|
server.once("error", reject);
|
|
124
|
-
server.listen(socketPath,
|
|
131
|
+
server.listen({ path: socketPath, readableAll: false, writableAll: false },
|
|
132
|
+
() => { server.removeListener("error", reject); resolve(); });
|
|
125
133
|
});
|
|
126
|
-
await chmod(socketPath, 0o600);
|
|
134
|
+
if (directory) await chmod(socketPath, 0o600);
|
|
127
135
|
} catch (error) {
|
|
128
136
|
activity.close();
|
|
129
137
|
enrichment.close();
|
|
130
138
|
engine.close();
|
|
131
|
-
await rm(directory, { recursive: true, force: true });
|
|
139
|
+
if (directory) await rm(directory, { recursive: true, force: true });
|
|
132
140
|
throw error;
|
|
133
141
|
}
|
|
134
142
|
return {
|
|
@@ -140,7 +148,7 @@ export async function startDesktopEngineBridge(options: {
|
|
|
140
148
|
controllerEnrollment.close();
|
|
141
149
|
await new Promise<void>((resolve) => server.close(() => resolve()));
|
|
142
150
|
engine.close();
|
|
143
|
-
await rm(directory, { recursive: true, force: true });
|
|
151
|
+
if (directory) await rm(directory, { recursive: true, force: true });
|
|
144
152
|
},
|
|
145
153
|
};
|
|
146
154
|
}
|
package/cursor-plugin/README.md
CHANGED
|
@@ -10,7 +10,7 @@ keeps each phone response tied to the exact originating chat and prompt.
|
|
|
10
10
|
Install the supported CLI on this computer, then run:
|
|
11
11
|
|
|
12
12
|
```bash
|
|
13
|
-
npm install -g granttap-mcp@0.8.
|
|
13
|
+
npm install -g granttap-mcp@0.8.32
|
|
14
14
|
granttap setup
|
|
15
15
|
granttap status
|
|
16
16
|
```
|
package/cursor-plugin/mcp.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"command": "node",
|
|
5
5
|
"args": [
|
|
6
6
|
"-e",
|
|
7
|
-
"\"use strict\";\n\n// Cursor may start this MCP from any cwd. Execute JavaScript entry points with\n// Node itself: Windows batch shims require shell quoting that differs by host.\nconst { spawn } = require(\"node:child_process\");\nconst { existsSync } = require(\"node:fs\");\nconst { delimiter, dirname, join } = require(\"node:path\");\n\nconst PACKAGE = \"granttap-mcp@0.8.
|
|
7
|
+
"\"use strict\";\n\n// Cursor may start this MCP from any cwd. Execute JavaScript entry points with\n// Node itself: Windows batch shims require shell quoting that differs by host.\nconst { spawn } = require(\"node:child_process\");\nconst { existsSync } = require(\"node:fs\");\nconst { delimiter, dirname, join } = require(\"node:path\");\n\nconst PACKAGE = \"granttap-mcp@0.8.32\";\nconst dryRun = process.env.GRANTTAP_BOOTSTRAP_DRY_RUN === \"1\";\nconst platform = dryRun && process.env.GRANTTAP_BOOTSTRAP_PLATFORM\n ? process.env.GRANTTAP_BOOTSTRAP_PLATFORM : process.platform;\nconst nodeRoot = dryRun && process.env.GRANTTAP_BOOTSTRAP_NODE_ROOT\n ? process.env.GRANTTAP_BOOTSTRAP_NODE_ROOT : dirname(process.execPath);\nconst pathRoots = (process.env.PATH || \"\").split(delimiter).filter(Boolean);\nconst appData = process.env.APPDATA;\nconst roots = [nodeRoot, ...pathRoots, ...(appData ? [join(appData, \"npm\")] : [])];\nconst first = (paths) => paths.find((path) => existsSync(path));\n\nfunction launch() {\n if (platform !== \"win32\") {\n const installed = first(roots.map((root) => join(root, \"granttap-mcp\")));\n if (installed) return { command: installed, args: [] };\n const npx = first(roots.map((root) => join(root, \"npx\"))) || \"npx\";\n return { command: npx, args: [\"-y\", PACKAGE] };\n }\n const installed = first(roots.map((root) =>\n join(root, \"node_modules\", \"granttap-mcp\", \"bin\", \"granttap-mcp.mjs\")));\n if (installed) return { command: process.execPath, args: [installed] };\n const npx = first(roots.map((root) =>\n join(root, \"node_modules\", \"npm\", \"bin\", \"npx-cli.js\")));\n if (npx) return { command: process.execPath, args: [npx, \"-y\", PACKAGE] };\n throw new Error(\"Node.js/npm 20+ is required on this Windows device. Install npm and retry GrantTap.\");\n}\n\nlet target;\ntry { target = launch(); }\ncatch (error) {\n process.stderr.write(`[granttap] ${error.message}\\n`);\n process.exit(1);\n}\n\nif (dryRun) {\n process.stdout.write(JSON.stringify(target));\n process.exit(0);\n}\n\nconst child = spawn(target.command, target.args, { stdio: \"inherit\", windowsHide: true });\nchild.on(\"error\", (error) => {\n process.stderr.write(`[granttap] ${error.message}\\n`);\n process.exit(1);\n});\nchild.on(\"exit\", (code, signal) => {\n if (signal && platform !== \"win32\") {\n try { process.kill(process.pid, signal); } catch { process.exit(code ?? 1); }\n return;\n }\n process.exit(code ?? 1);\n});\n"
|
|
8
8
|
]
|
|
9
9
|
}
|
|
10
10
|
}
|
|
@@ -7,7 +7,7 @@ const { spawn } = require("node:child_process");
|
|
|
7
7
|
const { existsSync } = require("node:fs");
|
|
8
8
|
const { delimiter, dirname, join } = require("node:path");
|
|
9
9
|
|
|
10
|
-
const PACKAGE = "granttap-mcp@0.8.
|
|
10
|
+
const PACKAGE = "granttap-mcp@0.8.32";
|
|
11
11
|
const dryRun = process.env.GRANTTAP_BOOTSTRAP_DRY_RUN === "1";
|
|
12
12
|
const platform = dryRun && process.env.GRANTTAP_BOOTSTRAP_PLATFORM
|
|
13
13
|
? process.env.GRANTTAP_BOOTSTRAP_PLATFORM : process.platform;
|