@lineadraw/mcp 0.1.0

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/README.md ADDED
@@ -0,0 +1,85 @@
1
+ # @lineadraw/mcp
2
+
3
+ MCP server for Linea CAD documents, with the **full Linea editor in chat**
4
+ (MCP Apps extension): Claude creates/edits documents through tools and opens
5
+ them as a fully interactive editor directly in the conversation — the user
6
+ can draw, snap, dimension, and edit, and their changes flow back into the
7
+ same document Claude's tools operate on.
8
+
9
+ ## Run
10
+
11
+ ```bash
12
+ npm run build -w @lineadraw/mcp # bundles the editor into dist/editor.html
13
+ npm run serve -w @lineadraw/mcp # streamable HTTP on http://localhost:3001/mcp
14
+ ```
15
+
16
+ MCP server definition
17
+
18
+ ```json
19
+ "mcpServers": {
20
+ "linea": {
21
+ "command": "node",
22
+ "args": [
23
+ "C:\\Users\\MikhailKoshelev\\source\\repos\\linea\\packages\\mcp\\dist\\server.js",
24
+ "--stdio"
25
+ ]
26
+ }
27
+ }
28
+ ```
29
+
30
+ Claude (web and Desktop) requires an **https** connector URL. Two options:
31
+
32
+ **Tunnel** (no account, URL changes each run, briefly internet-reachable):
33
+
34
+ ```bash
35
+ npx cloudflared tunnel --url http://localhost:3001
36
+ ```
37
+
38
+ **Local TLS with [mkcert](https://github.com/FiloSottile/mkcert)** (nothing
39
+ leaves your machine; the mkcert CA lands in the Windows/macOS trust store,
40
+ which Claude Desktop honors):
41
+
42
+ ```powershell
43
+ mkcert -install
44
+ mkcert localhost
45
+ $env:TLS_CERT="localhost.pem"; $env:TLS_KEY="localhost-key.pem"; npm run serve -w @lineadraw/mcp
46
+ ```
47
+
48
+ Settings → Connectors → Add custom connector → the https URL + `/mcp`
49
+ (e.g. `https://localhost:3001/mcp`). The MCP endpoint answers on `/` too.
50
+
51
+ `node probe.mjs <url>` checks any URL the way a host would (GET probe + full
52
+ handshake + a tool call).
53
+
54
+ ## Tools
55
+
56
+ `linea_new_document` · `linea_open_document` · `linea_save_document` ·
57
+ `linea_add_objects` (model space or `layout`) · `linea_update_objects`
58
+ (per-id patches) · `linea_remove_objects` · `linea_transform`
59
+ (move/rotate/scale/mirror/copy/array; degrees) · `linea_create_layout` ·
60
+ `linea_summary` · `linea_get_document` · `linea_replace_document` (full-state
61
+ save used by the in-chat editor) · `linea_export` (svg/png/pdf/dxf) ·
62
+ **`linea_show_document`** — opens the in-chat editor.
63
+
64
+ ## The in-chat editor
65
+
66
+ `ui-editor/` bundles the real `@lineadraw/editor` (React + Tailwind v4 + Inter)
67
+ into ONE self-contained `dist/editor.html` (~5 MB) — the sandboxed iframe's
68
+ CSP allows no external assets. `linea_show_document` renders it with the
69
+ document pushed as the tool result. Committed edits are debounced into
70
+ `linea_replace_document`, so the conversation's granular tools and the
71
+ interactive editor share one source of truth (the server registry). Foreign
72
+ changes (Claude's tool calls) are detected by revision polling and remount
73
+ the editor with the camera restored.
74
+
75
+ Sizing: the app reports a real content height (720px inline) through the
76
+ protocol's auto-resize and fills the frame under the host's `fullscreen`
77
+ display mode. Placement is the host's decision — the protocol offers
78
+ `inline | fullscreen | pip` only, so a persistent "panel right of the chat"
79
+ isn't requestable today.
80
+
81
+ Open `dist/editor.html#demo` in a browser to develop the editor app
82
+ standalone (loads a built-in document, no MCP host needed).
83
+
84
+ In-chat caveat: disk-oriented menu items (Open/Save As) are limited by the
85
+ iframe sandbox — save through the conversation via `linea_save_document`.