@dmytro-prototypes/cadbridge-mcp 0.1.8 → 0.1.10

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 -3
  2. package/bin/cli.js +31 -7
  3. package/package.json +3 -3
package/README.md CHANGED
@@ -21,11 +21,17 @@ npx -y @dmytro-prototypes/cadbridge-mcp
21
21
  ```
22
22
 
23
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.
24
+ `optionalDependencies`. The launcher installs and runs a per-user copy:
25
+
26
+ - macOS: `~/Library/Application Support/CADBridge/bin/cadbridge-mcp`
27
+ - Windows: `%LOCALAPPDATA%\Programs\CADBridge\cadbridge-mcp.exe`
28
+
29
+ If `LOCALAPPDATA` is unset, Windows uses `%USERPROFILE%\AppData\Local`.
26
30
  Later launches reuse it when its contents match the packaged binary; a different
27
31
  package version replaces it atomically. The copy preserves the packaged code
28
- signature. On Windows, the launcher runs the packaged binary directly.
32
+ signature. If Windows blocks an update because the executable is running, close
33
+ the CADBridge MCP connections in your clients and retry; the existing executable
34
+ is preserved when replacement fails.
29
35
 
30
36
  Continue using the same `npx` command for startup and updates; no separate
31
37
  installation command is needed.
package/bin/cli.js CHANGED
@@ -53,15 +53,22 @@ export function resolveBinary(key = platformKey()) {
53
53
  }
54
54
  }
55
55
 
56
- // Keep the macOS executable at one path across npm cache changes. Compare the
56
+ // Keep the executable at one path across npm cache changes. Compare the
57
57
  // actual bytes so unchanged launches preserve the installed file and updates
58
58
  // retain the packaged signature. Rename a complete copy, never overwrite a
59
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
60
+ export function installBinary(source, {
61
+ platform = process.platform,
62
+ home = homedir(),
63
+ localAppData = process.env.LOCALAPPDATA || join(home, "AppData", "Local"),
64
+ } = {}) {
65
+ if (platform !== "darwin" && platform !== "win32") return source
62
66
 
63
- const dir = join(home, "Library", "Application Support", "CADBridge", "bin")
64
- const destination = join(dir, "cadbridge-mcp")
67
+ const windows = platform === "win32"
68
+ const dir = windows
69
+ ? join(localAppData, "Programs", "CADBridge")
70
+ : join(home, "Library", "Application Support", "CADBridge", "bin")
71
+ const destination = join(dir, windows ? "cadbridge-mcp.exe" : "cadbridge-mcp")
65
72
  const packaged = readFileSync(source)
66
73
  try {
67
74
  if (readFileSync(destination).equals(packaged)) return destination
@@ -74,8 +81,25 @@ export function installBinary(source, { platform = process.platform, home = home
74
81
  try {
75
82
  const temporary = join(staging, "cadbridge-mcp")
76
83
  copyFileSync(source, temporary)
77
- chmodSync(temporary, 0o755)
78
- renameSync(temporary, destination)
84
+ if (!windows) chmodSync(temporary, 0o755)
85
+ try {
86
+ renameSync(temporary, destination)
87
+ } catch (error) {
88
+ // Another launcher may have installed the same binary while we copied it.
89
+ try {
90
+ if (readFileSync(destination).equals(packaged)) return destination
91
+ } catch {
92
+ // Preserve the replacement error if the destination cannot be read.
93
+ }
94
+ if (windows && ["EACCES", "EPERM", "EBUSY"].includes(error.code)) {
95
+ throw new Error(
96
+ `Cannot update ${destination}. Close running CADBridge MCP connections in your ` +
97
+ `MCP clients and retry. If it still fails, check the folder permissions.`,
98
+ { cause: error },
99
+ )
100
+ }
101
+ throw error
102
+ }
79
103
  } finally {
80
104
  rmSync(staging, { recursive: true, force: true })
81
105
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dmytro-prototypes/cadbridge-mcp",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
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.8",
34
- "@dmytro-prototypes/cadbridge-mcp-win32-x64": "0.1.8"
33
+ "@dmytro-prototypes/cadbridge-mcp-darwin-arm64": "0.1.10",
34
+ "@dmytro-prototypes/cadbridge-mcp-win32-x64": "0.1.10"
35
35
  },
36
36
  "publishConfig": {
37
37
  "access": "public"