@mlightcad/cad-mcp-server 1.7.8-preview.0 → 1.7.8-preview.2
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/LICENSE +21 -21
- package/README.md +216 -147
- package/dist/catalogTools.d.ts +4 -0
- package/dist/catalogTools.js +13 -5
- package/dist/catalogTools.js.map +1 -1
- package/dist/cli.js +8 -1
- package/dist/cli.js.map +1 -1
- package/dist/headlessGpu.d.ts +8 -2
- package/dist/headlessGpu.js +5 -2
- package/dist/headlessGpu.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/server.d.ts +9 -1
- package/dist/server.js +21 -3
- package/dist/server.js.map +1 -1
- package/dist/session.d.ts +24 -3
- package/dist/session.js +150 -24
- package/dist/session.js.map +1 -1
- package/dist-runner/assets/{index-2iXkmn03.js → index-CazDkH6q.js} +335 -329
- package/dist-runner/index.html +14 -14
- package/dist-runner/workers/libredwg-parser-worker.js +18 -18
- package/package.json +5 -5
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 mlightcad
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 mlightcad
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,147 +1,216 @@
|
|
|
1
|
-
# @mlightcad/cad-mcp-server
|
|
2
|
-
|
|
3
|
-
stdio [Model Context Protocol](https://modelcontextprotocol.io) server that lets
|
|
4
|
-
third-party agents (Claude Code, Cursor, Codex, …) drive CAD drawings through
|
|
5
|
-
the same **script-first** API as the in-app CAD Agent.
|
|
6
|
-
|
|
7
|
-
## Why scripts, not hundreds of tools?
|
|
8
|
-
|
|
9
|
-
MCP is a great way to connect agents to CAD. It is a poor place to re-export
|
|
10
|
-
every drawing primitive as its own tool. A catalog of `draw_line`,
|
|
11
|
-
`draw_circle`, `set_entity_layer`, … never finishes, burns tokens on every
|
|
12
|
-
request, and still cannot cover one-off analysis (“find bolt-hole outliers by
|
|
13
|
-
layer and report them”).
|
|
14
|
-
|
|
15
|
-
This server follows the design in
|
|
16
|
-
[Building a CAD Agent: MCP, Tools, or Let AI Write Code?](https://dev.to/mlightcad/building-a-cad-agent-mcp-tools-or-let-ai-write-code-2nc4):
|
|
17
|
-
|
|
18
|
-
- **Tools** for clear lifecycle steps (open / blank drawing)
|
|
19
|
-
- **Scripts** for combining the CAD API into analysis, edits, and verification
|
|
20
|
-
|
|
21
|
-
The model writes a `cad.*` function body; the
|
|
22
|
-
runtime as the in-app CAD Agent
|
|
23
|
-
|
|
24
|
-
tool list — and with lower token and round-trip cost for bulk work.
|
|
25
|
-
|
|
26
|
-
## Tools (intentionally small)
|
|
27
|
-
|
|
28
|
-
| Tool | Purpose |
|
|
29
|
-
| --- | --- |
|
|
30
|
-
| `open_drawing` | Open a local/remote DXF/DWG, or omit `path` for a blank ISO template |
|
|
31
|
-
| `execute_cad_script` | Run a `cad.*` JavaScript function body ([script API](https://mlightcad.github.io/cad-viewer/guide/script/overview.html)) |
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
###
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
]
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
1
|
+
# @mlightcad/cad-mcp-server
|
|
2
|
+
|
|
3
|
+
stdio [Model Context Protocol](https://modelcontextprotocol.io) server that lets
|
|
4
|
+
third-party agents (Claude Code, Cursor, Codex, …) drive CAD drawings through
|
|
5
|
+
the same **script-first** API as the in-app CAD Agent.
|
|
6
|
+
|
|
7
|
+
## Why scripts, not hundreds of tools?
|
|
8
|
+
|
|
9
|
+
MCP is a great way to connect agents to CAD. It is a poor place to re-export
|
|
10
|
+
every drawing primitive as its own tool. A catalog of `draw_line`,
|
|
11
|
+
`draw_circle`, `set_entity_layer`, … never finishes, burns tokens on every
|
|
12
|
+
request, and still cannot cover one-off analysis (“find bolt-hole outliers by
|
|
13
|
+
layer and report them”).
|
|
14
|
+
|
|
15
|
+
This server follows the design in
|
|
16
|
+
[Building a CAD Agent: MCP, Tools, or Let AI Write Code?](https://dev.to/mlightcad/building-a-cad-agent-mcp-tools-or-let-ai-write-code-2nc4):
|
|
17
|
+
|
|
18
|
+
- **Tools** for clear lifecycle steps (open / blank drawing)
|
|
19
|
+
- **Scripts** for combining the CAD API into analysis, edits, and verification
|
|
20
|
+
|
|
21
|
+
The model writes a `cad.*` function body; the Chromium viewer runs it (headless
|
|
22
|
+
or with a visible window). Same runtime as the in-app CAD Agent
|
|
23
|
+
(`@mlightcad/cad-agent-core`), so external agents get flexibility without a
|
|
24
|
+
ballooning tool list — and with lower token and round-trip cost for bulk work.
|
|
25
|
+
|
|
26
|
+
## Tools (intentionally small)
|
|
27
|
+
|
|
28
|
+
| Tool | Purpose |
|
|
29
|
+
| --- | --- |
|
|
30
|
+
| `open_drawing` | Open a local/remote DXF/DWG, or omit `path` for a blank ISO template |
|
|
31
|
+
| `execute_cad_script` | Run a `cad.*` JavaScript function body ([script API](https://mlightcad.github.io/cad-viewer/guide/script/overview.html)) |
|
|
32
|
+
|
|
33
|
+
Both tools accept optional `visible`:
|
|
34
|
+
|
|
35
|
+
| `visible` | Browser | Session lifecycle |
|
|
36
|
+
| --- | --- | --- |
|
|
37
|
+
| `false` / omit | Headless Chromium | Reused across tool calls; **auto-closes after idle** (default 30s) |
|
|
38
|
+
| `true` | Visible Chromium window | Stays open so the user can watch the drawing |
|
|
39
|
+
|
|
40
|
+
The agent chooses based on the user prompt (e.g. “open the browser so I can
|
|
41
|
+
see the drawing” → `visible: true`; batch QA → headless). Changing `visible`
|
|
42
|
+
after a session started rebuilds the browser and **resets drawing state**.
|
|
43
|
+
|
|
44
|
+
There are **no** per-entity `draw_line` / `draw_circle` tools. All drawing,
|
|
45
|
+
queries, edits, and context live inside one script call.
|
|
46
|
+
|
|
47
|
+
## Works with cad-simple-viewer and cad-viewer
|
|
48
|
+
|
|
49
|
+
Both products share `AcApDocManager` from `@mlightcad/cad-simple-viewer`. This
|
|
50
|
+
server’s runner boots that kernel (not the Vue UI package). Scripts you write
|
|
51
|
+
for the Script panel or CAD Agent in either product are valid here, and the
|
|
52
|
+
reverse is true.
|
|
53
|
+
|
|
54
|
+
This package does **not** depend on `@mlightcad/cad-viewer`.
|
|
55
|
+
|
|
56
|
+
## Requirements
|
|
57
|
+
|
|
58
|
+
- Node.js ≥ 20
|
|
59
|
+
- Chromium for Playwright (`pnpm --filter @mlightcad/cad-mcp-server install-browser`)
|
|
60
|
+
|
|
61
|
+
## Install / run
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
pnpm --filter @mlightcad/cad-mcp-server build
|
|
65
|
+
pnpm --filter @mlightcad/cad-mcp-server install-browser
|
|
66
|
+
cad-mcp-server
|
|
67
|
+
# or: node packages/cad-mcp-server/dist/cli.js
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Environment variables
|
|
71
|
+
|
|
72
|
+
| Variable | Purpose |
|
|
73
|
+
| --- | --- |
|
|
74
|
+
| `CAD_MCP_VISIBLE=1` | Default headed when tools omit `visible` |
|
|
75
|
+
| `CAD_MCP_IDLE_CLOSE_MS` | Headless idle auto-close delay in ms (default `30000`) |
|
|
76
|
+
|
|
77
|
+
## MCP client config
|
|
78
|
+
|
|
79
|
+
### Cursor (this monorepo)
|
|
80
|
+
|
|
81
|
+
`npx` from the workspace root crashes npm (Arborist + workspace link). Use the
|
|
82
|
+
launcher, which runs npx from the OS temp directory:
|
|
83
|
+
|
|
84
|
+
```json
|
|
85
|
+
{
|
|
86
|
+
"mcpServers": {
|
|
87
|
+
"cad": {
|
|
88
|
+
"command": "node",
|
|
89
|
+
"args": [
|
|
90
|
+
"${workspaceFolder}/packages/cad-mcp-server/scripts/run-published.mjs"
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Override the pin with `CAD_MCP_SERVER_VERSION` (default `1.7.8-preview.1`).
|
|
98
|
+
|
|
99
|
+
To force a visible browser by default (agent can still pass `visible: false`):
|
|
100
|
+
|
|
101
|
+
```json
|
|
102
|
+
{
|
|
103
|
+
"mcpServers": {
|
|
104
|
+
"cad": {
|
|
105
|
+
"command": "node",
|
|
106
|
+
"args": [
|
|
107
|
+
"${workspaceFolder}/packages/cad-mcp-server/dist/cli.js"
|
|
108
|
+
],
|
|
109
|
+
"env": {
|
|
110
|
+
"CAD_MCP_VISIBLE": "1"
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Claude Code / Claude Desktop (outside this repo)
|
|
118
|
+
|
|
119
|
+
```json
|
|
120
|
+
{
|
|
121
|
+
"mcpServers": {
|
|
122
|
+
"cad": {
|
|
123
|
+
"command": "npx",
|
|
124
|
+
"args": [
|
|
125
|
+
"-y",
|
|
126
|
+
"--package=@mlightcad/cad-mcp-server@1.7.8-preview.1",
|
|
127
|
+
"cad-mcp-server"
|
|
128
|
+
]
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
For local monorepo development against an unbuilt/unpublished tree, point at
|
|
135
|
+
the built CLI instead:
|
|
136
|
+
|
|
137
|
+
```json
|
|
138
|
+
{
|
|
139
|
+
"mcpServers": {
|
|
140
|
+
"cad": {
|
|
141
|
+
"command": "node",
|
|
142
|
+
"args": [
|
|
143
|
+
"${workspaceFolder}/packages/cad-mcp-server/dist/cli.js"
|
|
144
|
+
]
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Typical flow
|
|
151
|
+
|
|
152
|
+
1. `open_drawing` with `{ "path": "./plan.dxf", "mode": "write" }`
|
|
153
|
+
(local path or http(s) URL; omit `path` to start blank).
|
|
154
|
+
Add `"visible": true` when the user should see the drawing.
|
|
155
|
+
2. `execute_cad_script` with a function body:
|
|
156
|
+
|
|
157
|
+
```js
|
|
158
|
+
let id
|
|
159
|
+
cad.edit.transaction('circle', tx => {
|
|
160
|
+
id = tx.drawCircle({ center: { x: 0, y: 0 }, radius: 100 })
|
|
161
|
+
})
|
|
162
|
+
cad.view.zoomExtents()
|
|
163
|
+
return cad.measure.report([
|
|
164
|
+
cad.measure.check('r', 100, cad.measure.radius(id))
|
|
165
|
+
])
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
`cad.view.capturePreview` is enabled; screenshots are returned as MCP image
|
|
169
|
+
content.
|
|
170
|
+
|
|
171
|
+
Save the drawing after edits:
|
|
172
|
+
|
|
173
|
+
```js
|
|
174
|
+
cad.file.saveDxf('./plan-out.dxf')
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
The MCP server writes that path (relative to the server process working
|
|
178
|
+
directory). The DXF text is not sent back to the model; the tool result
|
|
179
|
+
includes `savedFiles` with the absolute path. In the in-app CAD agent the same
|
|
180
|
+
call downloads the file instead.
|
|
181
|
+
|
|
182
|
+
## Architecture
|
|
183
|
+
|
|
184
|
+
```
|
|
185
|
+
MCP client --stdio--> cad-mcp-server (Node)
|
|
186
|
+
|
|
|
187
|
+
| Playwright (lazy)
|
|
188
|
+
v
|
|
189
|
+
Chromium (headless or headed)
|
|
190
|
+
cad-simple-viewer + cad-agent-core
|
|
191
|
+
createCadToolCatalog / execute_cad_script
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Headless sessions persist across tool calls until idle timeout. Headed sessions
|
|
195
|
+
stay open until the MCP process exits.
|
|
196
|
+
|
|
197
|
+
## Library API
|
|
198
|
+
|
|
199
|
+
```ts
|
|
200
|
+
import {
|
|
201
|
+
createCadMcpServer,
|
|
202
|
+
registerCadMcpTools,
|
|
203
|
+
CadMcpSession,
|
|
204
|
+
resolveVisible
|
|
205
|
+
} from '@mlightcad/cad-mcp-server'
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
`registerCadMcpTools` maps the same tool surface for a custom `McpServer`
|
|
209
|
+
(e.g. a future in-page WebMCP host that already has `AcApDocManager`).
|
|
210
|
+
|
|
211
|
+
## Related packages
|
|
212
|
+
|
|
213
|
+
- `@mlightcad/cad-agent-core` — script host and tool catalog
|
|
214
|
+
- `@mlightcad/cad-agent-plugin` — in-app chat agent
|
|
215
|
+
- `@mlightcad/cad-script-plugin` — manual script console
|
|
216
|
+
- `@mlightcad/cad-simple-viewer-cli` — AutoCAD `.scr` headless CLI (different script model)
|
package/dist/catalogTools.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { z } from 'zod';
|
|
|
9
9
|
export declare const executeCadScriptInputSchema: {
|
|
10
10
|
code: z.ZodString;
|
|
11
11
|
intent: z.ZodOptional<z.ZodString>;
|
|
12
|
+
visible: z.ZodOptional<z.ZodBoolean>;
|
|
12
13
|
};
|
|
13
14
|
/**
|
|
14
15
|
* Input schema for MCP-only document lifecycle tool `open_drawing`.
|
|
@@ -16,6 +17,7 @@ export declare const executeCadScriptInputSchema: {
|
|
|
16
17
|
export declare const openDrawingInputSchema: {
|
|
17
18
|
path: z.ZodOptional<z.ZodString>;
|
|
18
19
|
mode: z.ZodOptional<z.ZodEnum<["read", "write"]>>;
|
|
20
|
+
visible: z.ZodOptional<z.ZodBoolean>;
|
|
19
21
|
};
|
|
20
22
|
export interface RegisterCadMcpToolsOptions {
|
|
21
23
|
/**
|
|
@@ -24,6 +26,7 @@ export interface RegisterCadMcpToolsOptions {
|
|
|
24
26
|
openDrawing: (input: {
|
|
25
27
|
path?: string;
|
|
26
28
|
mode?: 'read' | 'write';
|
|
29
|
+
visible?: boolean;
|
|
27
30
|
}) => Promise<{
|
|
28
31
|
ok: true;
|
|
29
32
|
title: string;
|
|
@@ -35,6 +38,7 @@ export interface RegisterCadMcpToolsOptions {
|
|
|
35
38
|
executeCadScript: (input: {
|
|
36
39
|
code: string;
|
|
37
40
|
intent?: string;
|
|
41
|
+
visible?: boolean;
|
|
38
42
|
}) => Promise<unknown>;
|
|
39
43
|
}
|
|
40
44
|
/**
|
package/dist/catalogTools.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { CAD_SCRIPT_API_SUMMARY } from '@mlightcad/cad-agent-core/script-api';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { toolResultToMcpContent } from './toolResult.js';
|
|
4
|
+
const visibleField = z
|
|
5
|
+
.boolean()
|
|
6
|
+
.optional()
|
|
7
|
+
.describe('Show a Chromium window so the user can watch the drawing. true = visible window (stays open). false/omit = headless (auto-closes after idle). Use true when the user asks to see the result; use headless for batch work. Changing this after a session started rebuilds the browser and resets drawing state.');
|
|
4
8
|
/**
|
|
5
9
|
* Input schema for `execute_cad_script`.
|
|
6
10
|
*
|
|
@@ -16,7 +20,8 @@ export const executeCadScriptInputSchema = {
|
|
|
16
20
|
.string()
|
|
17
21
|
.max(200)
|
|
18
22
|
.optional()
|
|
19
|
-
.describe('Optional short label for the tool result. Never send intent alone — code is required. Prefer emitting code before intent.')
|
|
23
|
+
.describe('Optional short label for the tool result. Never send intent alone — code is required. Prefer emitting code before intent.'),
|
|
24
|
+
visible: visibleField
|
|
20
25
|
};
|
|
21
26
|
/**
|
|
22
27
|
* Input schema for MCP-only document lifecycle tool `open_drawing`.
|
|
@@ -29,7 +34,8 @@ export const openDrawingInputSchema = {
|
|
|
29
34
|
mode: z
|
|
30
35
|
.enum(['read', 'write'])
|
|
31
36
|
.optional()
|
|
32
|
-
.describe('Open mode. Default: write when path is omitted, read when path is set. Use write to edit an existing file.')
|
|
37
|
+
.describe('Open mode. Default: write when path is omitted, read when path is set. Use write to edit an existing file.'),
|
|
38
|
+
visible: visibleField
|
|
33
39
|
};
|
|
34
40
|
/**
|
|
35
41
|
* Registers the script-first CAD tool surface on an MCP server.
|
|
@@ -46,13 +52,14 @@ export function registerCadMcpTools(server, options) {
|
|
|
46
52
|
// MCP SDK + zod generics often hit TS2589; register via a loose shim.
|
|
47
53
|
const register = server.registerTool.bind(server);
|
|
48
54
|
register('open_drawing', {
|
|
49
|
-
description: 'Open a DXF/DWG drawing (local path or http(s) URL), or omit path to create a blank ISO template. Call before editing an existing file. Drawing ops use execute_cad_script.',
|
|
55
|
+
description: 'Open a DXF/DWG drawing (local path or http(s) URL), or omit path to create a blank ISO template. Call before editing an existing file. Drawing ops use execute_cad_script. Pass visible=true when the user should see the browser/drawing; omit or false for headless (auto-closes after idle).',
|
|
50
56
|
inputSchema: openDrawingInputSchema
|
|
51
57
|
}, async (input) => {
|
|
52
58
|
try {
|
|
53
59
|
const result = await options.openDrawing({
|
|
54
60
|
path: input.path,
|
|
55
|
-
mode: input.mode
|
|
61
|
+
mode: input.mode,
|
|
62
|
+
visible: input.visible
|
|
56
63
|
});
|
|
57
64
|
return {
|
|
58
65
|
content: [{ type: 'text', text: JSON.stringify(result) }]
|
|
@@ -80,7 +87,8 @@ export function registerCadMcpTools(server, options) {
|
|
|
80
87
|
try {
|
|
81
88
|
const raw = await options.executeCadScript({
|
|
82
89
|
code: input.code,
|
|
83
|
-
intent: input.intent
|
|
90
|
+
intent: input.intent,
|
|
91
|
+
visible: input.visible
|
|
84
92
|
});
|
|
85
93
|
return toolResultToMcpContent(raw);
|
|
86
94
|
}
|
package/dist/catalogTools.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalogTools.js","sourceRoot":"","sources":["../src/catalogTools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAA;AAE7E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAA;AAExD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,IAAI,EAAE,CAAC;SACJ,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CACP,iHAAiH,CAClH;IACH,MAAM,EAAE,CAAC;SACN,MAAM,EAAE;SACR,GAAG,CAAC,GAAG,CAAC;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,2HAA2H,CAC5H;
|
|
1
|
+
{"version":3,"file":"catalogTools.js","sourceRoot":"","sources":["../src/catalogTools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAA;AAE7E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAA;AAExD,MAAM,YAAY,GAAG,CAAC;KACnB,OAAO,EAAE;KACT,QAAQ,EAAE;KACV,QAAQ,CACP,gTAAgT,CACjT,CAAA;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,IAAI,EAAE,CAAC;SACJ,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CACP,iHAAiH,CAClH;IACH,MAAM,EAAE,CAAC;SACN,MAAM,EAAE;SACR,GAAG,CAAC,GAAG,CAAC;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,2HAA2H,CAC5H;IACH,OAAO,EAAE,YAAY;CACtB,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,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CAAA;QACH,CAAC;IACH,CAAC,CACF,CAAA;IAED,QAAQ,CACN,oBAAoB,EACpB;QACE,WAAW,EAAE,sBAAsB;QACnC,WAAW,EAAE,2BAA2B;KACzC,EACD,KAAK,EAAC,KAAK,EAAC,EAAE;QACZ,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,gBAAgB,CAAC;gBACzC,IAAI,EAAE,KAAK,CAAC,IAAc;gBAC1B,MAAM,EAAE,KAAK,CAAC,MAA4B;gBAC1C,OAAO,EAAE,KAAK,CAAC,OAA8B;aAC9C,CAAC,CAAA;YACF,OAAO,sBAAsB,CAC3B,GAAqD,CACtD,CAAA;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;4BACnB,OAAO,EAAE,KAAK;4BACd,OAAO,EAAE,yBAAyB;4BAClC,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;yBAC9D,CAAC;qBACH;iBACF;gBACD,OAAO,EAAE,IAAI;aACd,CAAA;QACH,CAAC;IACH,CAAC,CACF,CAAA;AACH,CAAC"}
|
package/dist/cli.js
CHANGED
|
@@ -5,12 +5,19 @@ import { createCadMcpServer } from './server.js';
|
|
|
5
5
|
* stdio entry for `@mlightcad/cad-mcp-server`.
|
|
6
6
|
*
|
|
7
7
|
* stdout is reserved for MCP JSON-RPC — log only to stderr.
|
|
8
|
+
*
|
|
9
|
+
* Env (optional):
|
|
10
|
+
* - `CAD_MCP_VISIBLE=1` — default headed when tools omit `visible`
|
|
11
|
+
* - `CAD_MCP_IDLE_CLOSE_MS` — headless idle auto-close delay (default 30000)
|
|
8
12
|
*/
|
|
9
13
|
async function main() {
|
|
10
14
|
const server = createCadMcpServer();
|
|
11
15
|
const transport = new StdioServerTransport();
|
|
12
16
|
await server.connect(transport);
|
|
13
|
-
|
|
17
|
+
const visibleDefault = process.env.CAD_MCP_VISIBLE?.trim().toLowerCase() === '1' ||
|
|
18
|
+
process.env.CAD_MCP_VISIBLE?.trim().toLowerCase() === 'true' ||
|
|
19
|
+
process.env.CAD_MCP_VISIBLE?.trim().toLowerCase() === 'yes';
|
|
20
|
+
console.error(`[cad-mcp-server] listening on stdio (default ${visibleDefault ? 'headed' : 'headless'})`);
|
|
14
21
|
}
|
|
15
22
|
main().catch(error => {
|
|
16
23
|
console.error('[cad-mcp-server] fatal:', error instanceof Error ? error.message : error);
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAA;AAEhF,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAEhD
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAA;AAEhF,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAEhD;;;;;;;;GAQG;AACH,KAAK,UAAU,IAAI;IACjB,MAAM,MAAM,GAAG,kBAAkB,EAAE,CAAA;IACnC,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAA;IAC5C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;IAC/B,MAAM,cAAc,GAClB,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,GAAG;QACzD,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,MAAM;QAC5D,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,KAAK,CAAA;IAC7D,OAAO,CAAC,KAAK,CACX,gDAAgD,cAAc,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,GAAG,CAC1F,CAAA;AACH,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;IACnB,OAAO,CAAC,KAAK,CACX,yBAAyB,EACzB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAC/C,CAAA;IACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC,CAAC,CAAA"}
|
package/dist/headlessGpu.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Browser } from 'playwright';
|
|
2
2
|
/**
|
|
3
|
-
* ANGLE / GL backend tried for
|
|
3
|
+
* ANGLE / GL backend tried for WebGL, in preference order.
|
|
4
4
|
* `swiftshader` is the software renderer used when no hardware backend works.
|
|
5
5
|
*/
|
|
6
6
|
type GpuBackend = 'd3d11' | 'd3d9' | 'metal' | 'vulkan' | 'gl' | 'egl' | 'gles' | 'swiftshader';
|
|
@@ -24,9 +24,15 @@ export interface LaunchHeadlessChromiumOptions {
|
|
|
24
24
|
* When hardware is unavailable, falls back to SwiftShader.
|
|
25
25
|
*/
|
|
26
26
|
useGpu?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Show a Chromium window. Default `false` (headless).
|
|
29
|
+
*/
|
|
30
|
+
headed?: boolean;
|
|
27
31
|
}
|
|
28
32
|
/**
|
|
29
|
-
* Launches
|
|
33
|
+
* Launches Chromium for WebGL (same GPU strategy as cad-simple-viewer-cli).
|
|
34
|
+
*
|
|
35
|
+
* Pass `headed: true` to show a visible browser window.
|
|
30
36
|
*/
|
|
31
37
|
export declare function launchHeadlessChromium(options?: LaunchHeadlessChromiumOptions): Promise<HeadlessGpuLaunch>;
|
|
32
38
|
export {};
|
package/dist/headlessGpu.js
CHANGED
|
@@ -62,14 +62,17 @@ async function launchSwiftShader(base) {
|
|
|
62
62
|
return { browser, renderer, backend: 'swiftshader' };
|
|
63
63
|
}
|
|
64
64
|
/**
|
|
65
|
-
* Launches
|
|
65
|
+
* Launches Chromium for WebGL (same GPU strategy as cad-simple-viewer-cli).
|
|
66
|
+
*
|
|
67
|
+
* Pass `headed: true` to show a visible browser window.
|
|
66
68
|
*/
|
|
67
69
|
export async function launchHeadlessChromium(options = {}) {
|
|
68
70
|
const channel = options.channel;
|
|
69
71
|
const platform = options.platform ?? process.platform;
|
|
70
72
|
const useGpu = options.useGpu !== false;
|
|
73
|
+
const headed = options.headed === true;
|
|
71
74
|
const base = {
|
|
72
|
-
headless:
|
|
75
|
+
headless: !headed,
|
|
73
76
|
...(channel ? { channel } : {})
|
|
74
77
|
};
|
|
75
78
|
if (!useGpu) {
|
package/dist/headlessGpu.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"headlessGpu.js","sourceRoot":"","sources":["../src/headlessGpu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,QAAQ,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"headlessGpu.js","sourceRoot":"","sources":["../src/headlessGpu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,QAAQ,EAAE,MAAM,YAAY,CAAA;AA4BnD;;GAEG;AACH,MAAM,UAAU,eAAe,CAC7B,WAA4B,OAAO,CAAC,QAAQ;IAE5C,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,OAAO;YACV,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,CAAC,CAAA;QACzC,KAAK,QAAQ;YACX,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,aAAa,CAAC,CAAA;QACvC;YACE,OAAO,CAAC,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,CAAC,CAAA;IACzD,CAAC;AACH,C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,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAA;QAC3C,CAAC;aAAM,CAAC;YACN,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAA;QAC9C,CAAC;IACH,CAAC;IAED,IAAI,QAAQ,EAAE,CAAC;QACb,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACvB,OAAO,CAAC,KAAK,CACX,sEAAsE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAC3F,CAAA;QACH,CAAC;QACD,OAAO,QAAQ,CAAA;IACjB,CAAC;IAED,OAAO,CAAC,KAAK,CACX,iEAAiE,CAClE,CAAA;IACD,OAAO,iBAAiB,CAAC,IAAI,CAAC,CAAA;AAChC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
* @packageDocumentation
|
|
7
7
|
*/
|
|
8
8
|
export { executeCadScriptInputSchema, openDrawingInputSchema, registerCadMcpTools, type RegisterCadMcpToolsOptions } from './catalogTools.js';
|
|
9
|
-
export { createCadMcpServer } from './server.js';
|
|
9
|
+
export { createCadMcpServer, resolveVisible } from './server.js';
|
|
10
10
|
export { CadMcpSession, type CadMcpOpenMode, type CadMcpSessionCreateOptions } from './session.js';
|
|
11
11
|
export { toolResultToMcpContent, type McpContentBlock } from './toolResult.js';
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @packageDocumentation
|
|
7
7
|
*/
|
|
8
8
|
export { executeCadScriptInputSchema, openDrawingInputSchema, registerCadMcpTools } from './catalogTools.js';
|
|
9
|
-
export { createCadMcpServer } from './server.js';
|
|
9
|
+
export { createCadMcpServer, resolveVisible } from './server.js';
|
|
10
10
|
export { CadMcpSession } from './session.js';
|
|
11
11
|
export { toolResultToMcpContent } from './toolResult.js';
|
|
12
12
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,2BAA2B,EAC3B,sBAAsB,EACtB,mBAAmB,EAEpB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,2BAA2B,EAC3B,sBAAsB,EACtB,mBAAmB,EAEpB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAChE,OAAO,EACL,aAAa,EAGd,MAAM,cAAc,CAAA;AACrB,OAAO,EACL,sBAAsB,EAEvB,MAAM,iBAAiB,CAAA"}
|
package/dist/server.d.ts
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
/**
|
|
3
|
+
* Resolves whether the browser should be visible.
|
|
4
|
+
*
|
|
5
|
+
* Tool `visible` wins when set; otherwise `CAD_MCP_VISIBLE=1` / `true` / `yes`
|
|
6
|
+
* forces headed as the default for omitted `visible`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function resolveVisible(toolVisible?: boolean): boolean;
|
|
2
9
|
/**
|
|
3
10
|
* Builds the stdio MCP server that exposes CAD script tools.
|
|
4
11
|
*
|
|
5
|
-
* The
|
|
12
|
+
* The Chromium session is started lazily on the first tool call (headless or
|
|
13
|
+
* headed depending on `visible` / `CAD_MCP_VISIBLE`).
|
|
6
14
|
*/
|
|
7
15
|
export declare function createCadMcpServer(): McpServer;
|