# Drawing MCP Server: local stdio

Extract data from, edit and view DWG drawings locally. AutoCAD, Docker, Python
and Rust are not required to run the native release. DXF is not supported yet.
Edits stay in memory; this server does not save changes to your source DWG.

## Downloads

Public distribution root:
<https://stdwhsdkdist.blob.core.windows.net/sdk/drawing-mcp/>

The release workflow publishes versioned downloads under `v<version>/` and a
`latest.txt` pointer after all selected builds pass. These URLs become available
when the first local release is published. The private source repository's
GitHub assets are the build record, not the public download channel.

| Platform | Archive suffix | Runtime |
| --- | --- | --- |
| macOS ARM64 | `aarch64-apple-darwin.tar.gz` | macOS 15+ |
| Windows x64 | `x86_64-pc-windows-msvc.tar.gz` | Windows 10/11 |
| Linux x64 | `x86_64-unknown-linux-gnu.tar.gz` | glibc 2.35+ |
| Linux ARM64 | `aarch64-unknown-linux-gnu.tar.gz` | glibc 2.39+ |
| macOS x64 (optional) | `x86_64-apple-darwin.tar.gz` | macOS 15+ |

Names start with `cad-drawing-mcp-server-<version>-`. Every archive has a
matching `.sha256` file. `SHA256SUMS` covers the full public release, including
the installers and this guide. Checksums detect corruption. Published macOS executables require Developer ID signing
and Apple notarization; Windows executables require timestamped Authenticode signatures.

## Install

With Node.js 18+, use the version-pinned npm launcher:

```sh
npx -y @dmytro-prototypes/cad-drawing-mcp-server@0.1.1 --allowed-root "$HOME"
```

npm installs the matching native platform package as an exact-version optional
dependency. Keep optional dependencies enabled. The shared router launches that binary;
it does not download from Azure at runtime.
The npm package becomes available after its first publication. The native
installer below works without Node.js.

macOS / Linux:

```sh
curl -fsSL https://stdwhsdkdist.blob.core.windows.net/sdk/drawing-mcp/install.sh -o /tmp/install-drawing-mcp.sh
sh /tmp/install-drawing-mcp.sh
```

The installer chooses your OS/CPU, verifies the archive checksum, installs into
`~/.local/share/cad-drawing-mcp-server/<version>/` and links the executable into
`~/.local/bin/`. Add that bin folder to PATH or use its absolute path in clients.
Set `DRAWING_MCP_VERSION=0.1.1` to pin a release. Optional install locations:
`DRAWING_MCP_INSTALL_ROOT` and `DRAWING_MCP_BIN_DIR`.

Alternatively, download the archive and its `.sha256` from `v<version>/`, compare
the digest using `shasum -a 256`, then extract it. Keep the included agreements and guide.
Run `cad-drawing-mcp-server --version` to check the executable before configuring
your client. To uninstall, remove the installed version and the Unix symlink.
Keep `~/.dwh-mcp` when updating or reinstalling.

## Client setup

Codex through npm:

```sh
codex mcp add drawing-local --env DRAWING_MCP_ALLOWED_ROOTS="$HOME" -- npx -y @dmytro-prototypes/cad-drawing-mcp-server@0.1.1
```

Claude Code through npm:

```sh
claude mcp add --scope user --transport stdio drawing-local --env DRAWING_MCP_ALLOWED_ROOTS="$HOME" -- npx -y @dmytro-prototypes/cad-drawing-mcp-server@0.1.1
```

On Windows, use `C:\Users\you\Drawings` as the allowed root. If the client
requires a shell to launch npm, set `"command": "cmd"` and prefix the args with
`["/d", "/s", "/c", "npx", ...]`, or use the extracted `.exe` directly.

For a JSON MCP configuration, use `"command": "npx"` and
`"args": ["-y", "@dmytro-prototypes/cad-drawing-mcp-server@0.1.1", "--allowed-root", "/Users/you"]`.
If a desktop client cannot find Node/npx, use the absolute npx path or the
installed native executable below.

Use an **absolute executable path**. Desktop clients may not inherit your shell's
PATH. Configure an existing drawing folder explicitly for predictable setup;
repeat `--allowed-root` for additional folders. Clients that offer MCP roots
replace these fallback roots after initialization. Spaces in local paths are supported; remote `file://host/...` roots are refused.

Chat attachments are not automatically passed to a stdio server. If the host
supplies a local attachment path inside an allowed root, open that copy directly.
Otherwise, save the attachment into an allowed drawing folder first. Upload,
stored-file listing and retention tools belong to HTTP connections with storage;
stdio lists only the drawings already open in its process. Model/layout/block
listing and rendering work over both transports.

Codex (native executable):

```sh
codex mcp add drawing-local -- "$HOME/.local/bin/cad-drawing-mcp-server" --allowed-root "$HOME"
```

Claude Code:

```sh
claude mcp add --scope user --transport stdio drawing-local -- "$HOME/.local/bin/cad-drawing-mcp-server" --allowed-root "$HOME"
```

For Claude Desktop or Cursor, add this entry to the client's MCP configuration
(substitute real absolute paths). Local server configuration requires a client
that supports launching stdio processes; an HTTPS-only connector cannot launch
this executable.

```json
{
  "mcpServers": {
    "drawing-local": {
      "command": "/Users/you/.local/bin/cad-drawing-mcp-server",
      "args": ["--allowed-root", "/Users/you"]
    }
  }
}
```

The alternative `DRAWING_MCP_ALLOWED_ROOTS` environment variable takes existing
absolute folder paths separated by semicolons on every OS.

After connecting, ask your client to:

1. Call `cad.list_roots` and confirm the expected folder.
2. Call `cad.open_file` with a returned `rootUri` and a relative DWG path.
3. Call `cad.query_objects`, then `cad.show_document` or `cad.render_view`.
4. Call `cad.license_status`, then `cad.close_file`.

MCP Apps viewers require client support. Plain MCP clients can use PNG/SVG
rendering. Viewer UI compatibility must be checked in each target client.

## Local licensing

The first 100 billable calls work anonymously and offline. The installation-local
counter persists across restarts in `~/.dwh-mcp/anonymous-calls` on macOS/Linux (`%LOCALAPPDATA%/.dwh-mcp/anonymous-calls` on Windows). Discovery/status/closing do
not spend calls. The counter is onboarding, not tamper protection.

Afterwards, run `npx -y @dmytro-prototypes/cad-drawing-mcp-server@0.1.1 --login`.
Your browser opens the shared portal for sign-in and explicit approval. Local MCP
processes automatically use the saved OAuth connection and refresh it as needed.
No manual key creation, copying, or credential environment variables are supported.

Signed-in billable calls require internet access: the backend verifies the
product and reserves one call before execution. A revoked connection, exhausted quota
or unavailable backend refuses the operation; there is no anonymous fallback
after sign-in. `cad.license_status` reports the latest authorization.
Trial and plan allowances are defined by the licensing backend. Local and hosted
call counters are separate; account cloud storage is shared.

The release already bundles its signed operator SDK licence and public
verification keys. End users do not need `DOG_CAD_LICENSE` or build-time keys.
Never configure `DWH_MCP_HOSTED_TOKEN` for a local client.

Local drawing operations process the DWG in this process. Routine licensing
sends credentials, device/build identifiers and usage, without drawing contents
or local paths. Requested results/images go to your AI client. Cloud upload/import/storage tools are absent from stdio; issue reports send
only the report/attachments you approve. The included `LICENSE.html`
contains the published Drawing agreements and privacy documents.

## Hosted connection

The existing hosted service remains available at
<https://cad-drawing.dmytro-prototypes.net/mcp>. Configure it separately from
`drawing-local` and use its existing OAuth flow. Local installation does not
change a hosted connection. No Control plugin or AutoCAD installation is involved.
