@lineadraw/mcp
v0.7.0
Published
MCP server + in-chat viewer (MCP App) for Linea CAD documents.
Readme
@lineadraw/mcp
MCP server for Linea CAD documents, with the full Linea editor in chat (MCP Apps extension): the agent creates and edits documents through tools and opens them as a fully interactive editor directly in the conversation — you can draw, snap, dimension, and edit, and your changes flow back into the same document the agent's tools operate on.
Requires Node.js >= 20.
Use with an MCP client (stdio)
Add to your client's MCP configuration (Claude Desktop, Cursor, etc.):
{
"mcpServers": {
"lineadraw": {
"command": "npx",
"args": ["-y", "@lineadraw/mcp", "--stdio"]
}
}
}Claude Code:
claude mcp add linea -- npx -y @lineadraw/mcp --stdioUse as an HTTP connector
Without --stdio the server speaks streamable HTTP on
http://localhost:3001/mcp (PORT overrides):
npx -y @lineadraw/mcpClaude (web and Desktop) requires an https connector URL. Two options:
Tunnel (no account, URL changes each run, briefly internet-reachable):
npx cloudflared tunnel --url http://localhost:3001Local TLS with mkcert (nothing leaves your machine; the mkcert CA lands in the Windows/macOS trust store, which Claude Desktop honors):
mkcert -install
mkcert localhost
$env:TLS_CERT="localhost.pem"; $env:TLS_KEY="localhost-key.pem"; npx -y @lineadraw/mcpSettings → Connectors → Add custom connector → the https URL + /mcp
(e.g. https://localhost:3001/mcp). The MCP endpoint answers on / too.
All MCP sessions in one server process share the open documents, so a reconnecting client keeps its work.
Tools
linea_new_document · linea_open_document · linea_save_document ·
linea_add_objects (model space or layout) · linea_update_objects
(per-id patches) · linea_remove_objects · linea_transform
(move/rotate/scale/mirror/copy/array; degrees) · linea_query (filtered
read, optional measurements) · linea_list_layers · linea_layer
(add/update/remove/set-current) · linea_create_layout ·
linea_update_layout · linea_remove_layout · linea_set_dim_style ·
linea_set_text_style · linea_render (svg/png snapshot) · linea_undo ·
linea_redo · linea_summary · linea_get_document ·
linea_replace_document (full-state save used by the in-chat editor) ·
linea_export (svg/png/pdf/dxf/dwg) ·
linea_show_document — opens the in-chat editor.
Documents are plain .linea files (zod-validated JSON); units are
millimeters, Y-up, angles in radians. For scripted/batch editing without an
agent in the loop, the same engine is available as a Node SDK:
@lineadraw/sdk.
The in-chat editor
The package bundles the real @lineadraw/editor (React + Tailwind v4 + Inter)
into ONE self-contained editor.html (~8 MB) — the sandboxed iframe's
CSP allows no external assets. linea_show_document renders it with the
document pushed as the tool result. Committed edits are debounced into
linea_replace_document, so the conversation's granular tools and the
interactive editor share one source of truth (the server registry). Foreign
changes (the agent's tool calls) are detected by revision polling and remount
the editor with the camera restored.
Sizing: the app reports a real content height (720px inline) through the
protocol's auto-resize and fills the frame under the host's fullscreen
display mode. Placement is the host's decision — the protocol offers
inline | fullscreen | pip only, so a persistent "panel right of the chat"
isn't requestable today.
In-chat caveat: disk-oriented menu items (Open/Save As) are limited by the
iframe sandbox — save through the conversation via linea_save_document.
Ecosystem
- Linea editor — the browser CAD app; documents
are the same
.lineafiles. @lineadraw/sdk— the same engine as a Node API for scripts and batch tooling.lineadraw— typings + CLI for authoring block/command marketplace repositories (npm create lineadraw).lineadraw/lineadraw— the public collection: real blocks/commands, agent skill, guides.
