@dmytro-prototypes/cadbridge-mcp 0.1.7 → 0.1.8

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 (3) hide show
  1. package/README.md +9 -5
  2. package/bin/cli.js +33 -2
  3. package/package.json +3 -3
package/README.md CHANGED
@@ -20,11 +20,15 @@ commands and AutoLISP, and capture the current view.
20
20
  npx -y @dmytro-prototypes/cadbridge-mcp
21
21
  ```
22
22
 
23
- This launches the platform binary that npm installed alongside this package
24
- (picked automatically via `optionalDependencies` — nothing is downloaded at
25
- run time). `npx` is the only supported way to run it: it fetches over an
26
- HTTP client rather than a browser, so the binary is never quarantined by
27
- Gatekeeper or blocked by SmartScreen, and needs no code-signing certificate.
23
+ The platform binary ships alongside this package, selected automatically via
24
+ `optionalDependencies`. On macOS, the launcher installs it at
25
+ `~/Library/Application Support/CADBridge/bin/cadbridge-mcp` and runs that copy.
26
+ Later launches reuse it when its contents match the packaged binary; a different
27
+ package version replaces it atomically. The copy preserves the packaged code
28
+ signature. On Windows, the launcher runs the packaged binary directly.
29
+
30
+ Continue using the same `npx` command for startup and updates; no separate
31
+ installation command is needed.
28
32
 
29
33
  Supported platforms are macOS Apple Silicon and Windows x64 — the platforms
30
34
  AutoCAD itself runs on.
package/bin/cli.js CHANGED
@@ -11,8 +11,10 @@
11
11
  // private, so the URL would 404 for every user. Shipping the binaries inside
12
12
  // npm also keeps installs working behind proxies that only allow the registry.
13
13
  import { spawn } from "node:child_process"
14
- import { existsSync, realpathSync } from "node:fs"
14
+ import { chmodSync, copyFileSync, existsSync, mkdirSync, mkdtempSync, readFileSync, realpathSync, renameSync, rmSync } from "node:fs"
15
15
  import { createRequire } from "node:module"
16
+ import { homedir } from "node:os"
17
+ import { join } from "node:path"
16
18
  import { fileURLToPath } from "node:url"
17
19
 
18
20
  const require = createRequire(import.meta.url)
@@ -51,8 +53,37 @@ export function resolveBinary(key = platformKey()) {
51
53
  }
52
54
  }
53
55
 
56
+ // Keep the macOS executable at one path across npm cache changes. Compare the
57
+ // actual bytes so unchanged launches preserve the installed file and updates
58
+ // retain the packaged signature. Rename a complete copy, never overwrite a
59
+ // binary that another MCP client may still be running.
60
+ export function installBinary(source, { platform = process.platform, home = homedir() } = {}) {
61
+ if (platform !== "darwin") return source
62
+
63
+ const dir = join(home, "Library", "Application Support", "CADBridge", "bin")
64
+ const destination = join(dir, "cadbridge-mcp")
65
+ const packaged = readFileSync(source)
66
+ try {
67
+ if (readFileSync(destination).equals(packaged)) return destination
68
+ } catch (error) {
69
+ if (error.code !== "ENOENT") throw error
70
+ }
71
+
72
+ mkdirSync(dir, { recursive: true, mode: 0o700 })
73
+ const staging = mkdtempSync(join(dir, ".install-"))
74
+ try {
75
+ const temporary = join(staging, "cadbridge-mcp")
76
+ copyFileSync(source, temporary)
77
+ chmodSync(temporary, 0o755)
78
+ renameSync(temporary, destination)
79
+ } finally {
80
+ rmSync(staging, { recursive: true, force: true })
81
+ }
82
+ return destination
83
+ }
84
+
54
85
  export function run(argv = process.argv.slice(2)) {
55
- const binary = resolveBinary()
86
+ const binary = installBinary(resolveBinary())
56
87
  // stdio: "inherit" — this process is a stdio MCP server; the client's pipes
57
88
  // must reach the real binary untouched. Nothing here may write to stdout.
58
89
  const child = spawn(binary, argv, { stdio: "inherit" })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dmytro-prototypes/cadbridge-mcp",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "mcpName": "net.dmytro-prototypes/cadbridge-mcp-autocad",
5
5
  "description": "Drive a live AutoCAD session from an AI client through MCP",
6
6
  "type": "module",
@@ -30,8 +30,8 @@
30
30
  "LICENSE.txt"
31
31
  ],
32
32
  "optionalDependencies": {
33
- "@dmytro-prototypes/cadbridge-mcp-darwin-arm64": "0.1.7",
34
- "@dmytro-prototypes/cadbridge-mcp-win32-x64": "0.1.7"
33
+ "@dmytro-prototypes/cadbridge-mcp-darwin-arm64": "0.1.8",
34
+ "@dmytro-prototypes/cadbridge-mcp-win32-x64": "0.1.8"
35
35
  },
36
36
  "publishConfig": {
37
37
  "access": "public"