
DWG MCP Server
io.github.dimitrovakulenko由 GitHub 帳號 dimitrovakulenko 發布v0.2.3更新於 Oct 24, 2026
Read-only DWG file access for AI clients through MCP.
概覽
以唯讀方式存取 DWG 與 DXF 圖面,讓助理檢查圖元、查詢物件,並將視圖算繪為 PNG 或 SVG。
- 可以做什麼
- 從允許的資料夾開啟 DWG 或 DXF 檔案並回傳文件識別碼,供後續呼叫使用。工具可列出全域支援的類型與檔案內實際存在的類型、描述類型屬性、依控制代碼取得物件,並依篩選條件、範圍、關聯遍歷、排序、投影與分頁查詢物件。它只能在記憶體中修改標示為可寫的圖元屬性,並可將模型空間、圖紙空間配置與視埠算繪為 PNG 或 SVG。
- 適用情境
- 當助理需要讀取或分析 CAD 圖面時使用,例如檢查圖層、圖塊、配置與圖元屬性,或產生圖面的算繪影像。適用於 macOS、Windows 或 Linux 上的桌面 MCP 用戶端。
- 執行需求
- 以 npm 套件形式透過 stdio 在本機執行,首次使用時下載相符的原生建置。支援的平台為 macOS Apple Silicon、Windows x86_64,以及 Linux x86_64 或 ARM64。若用戶端不提供 MCP roots,需將 DWG_MCP_ALLOWED_ROOTS 設為以分號分隔的絕對目錄。未宣告需要帳號或 API 金鑰。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 DWG MCP Server,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
DWG MCP Server
DWG and DXF file format access for AI via MCP.
Connect DWG and DXF files to Claude, ChatGPT, Codex, Cursor, and other MCP clients. DWG MCP Server provides structured access to DWG data so AI can understand and reason about drawings. Source files remain read-only; supported entity properties can be changed in memory for inspection and rendering.
Quick Start
Use DWG MCP Server from the MCP client of your choice. The npm package downloads the matching native build from GitHub Releases on first use, verifies its SHA-256 checksum, caches it, and runs it directly. Docker and a separate Python installation are not required.
Native installers
macOS Apple Silicon:
Windows x64 (PowerShell):
Both installers download the latest native release and verify its SHA-256 checksum before installation.
After installing, point your MCP client at the installed executable. On macOS
add ~/.local/bin to PATH first, or use the absolute path reported by the
installer:
If your MCP client, AI agent, or test harness does not support MCP roots, set
DWG_MCP_ALLOWED_ROOTS to the folders that should be accessible.
Codex
Codex does not currently provide MCP client roots to stdio MCP servers. Configure explicit allowed roots for the folders that contain your drawings.
Claude
Claude Code provides MCP roots, so no extra path variable is usually needed.
Cursor
Exposed Tools
A typical flow is:
- Discover available folders with
dwg.list_roots. - Open a file from one of those folders with
dwg.open_file. - Inspect supported or file-local types with
dwg.list_types,dwg.list_file_types, ordwg.describe_type. - Fetch known handles with
dwg.get_objectsor search the drawing withdwg.query_objects. - Optionally change properties reported as writable with
dwg.set_entity_properties. - Discover and render drawing views with
dwg.list_render_viewsanddwg.render_view. - Close the session with
dwg.close_file, discarding in-memory changes.
Architecture
Runtime model
In the packaged deployment, DWG MCP Server is a standalone native application built for the host operating system. The Python host exposes the MCP tools, validates file access, and manages document sessions.
Each dwg.open_file call starts a dedicated Rust dwg-worker process for that DWG and returns a host-side documentId.
All later file-scoped calls use that document id.
dwg.close_file terminates the worker for that session.
Worker and query model
The Rust worker speaks newline-delimited JSON over stdin and stdout. When it opens a DWG through LibreDWG, it first builds an in-memory indexed document. That upfront indexing step is central to the design: the server pays the cost once when the file is opened, then answers later requests against the index instead of rescanning the DWG each time.
The indexed model stores object handles, kinds, type names, generic types, summary and full properties, and derived block, layout, and space membership. It also stores supported type metadata such as aliases, default projections, and property definitions.
When you request full object records, responses also include that derived membership under extendedData, including container block, layout, and model or paper space when known.
dwg.get_objects is direct lookup by handle.
dwg.query_objects runs over indices for handle, type, generic type, kind, exact property values, block, layout, and space, then applies filters, scopes, relation traversal, sorting, projection, and pagination.
This is what makes queries over blocks, layers, layouts, references, and related objects practical on an opened drawing.
dwg.set_entity_properties validates writes against the type catalog, updates
the native LibreDWG document, rebuilds the index, and invalidates the cached
rendering scene. Block-reference insertion points use OCS coordinates, block
scaling rules are enforced, and attributed block references are rejected until
their owned attributes can be transformed safely. The tool does not save or
overwrite the source file.
The worker lazily compiles a separate rendering scene on the first render call.
It expands block references and generated dimension blocks, draws common 2D
geometry, text, MTEXT, hatch contours, and approximated point-list entities,
and composes paper-space layouts through their viewports. SVG is the canonical
render output; PNG is rasterized from the same SVG in memory. Render responses
include coverage diagnostics for generated-block fallbacks and unsupported
entity types. Automatic fit rejects extreme sparse extents, WIPEOUT boundaries
mask earlier geometry, and explicit regions allow bounded rendering of dense
views. See docs/rendering.md for the protocol and
rendering model.
Access and packaging
DWG and DXF files must be opened from roots listed by dwg.list_roots. The server first
asks the MCP client for roots. If the client, AI agent, or test harness does not
support MCP roots, configure explicit allowed roots:
or:
DWG_MCP_ALLOWED_ROOTS is an authorization fallback for clients without roots.
It should be a semicolon-separated list of absolute directories.
Official releases contain a standalone MCP host, the statically linked Rust worker, and the LibreDWG schema files needed at runtime.
Native platforms
GitHub Actions builds and tests these release artifacts on their native runners:
x64, x86_64, and AMD64 name the same CPU architecture; the Windows and
Linux artifacts work on both Intel and AMD processors.
Build and Test From Source
Local source builds use the vendored third_party/libredwg submodule by default.
Prerequisites
- Rust toolchain
- Python 3.11 or newer
- autotools for local LibreDWG builds on macOS or Linux (
autoreconf,aclocal,automake,autoconf,make)
Bootstrap
Build and test
Run the MCP host locally
The Python host looks for dwg-worker under target/release or target/debug.
If you want a release build explicitly:
Then run the MCP host:
If the worker binary lives somewhere else, set DWG_WORKER_BIN to that executable.
Publish a native release
- Set the same version in
npm/package.json,server.json, and the Claude extension manifest when applicable. - Configure npm trusted publishing for
.github/workflows/native-release.yml. - Push the matching
v<version>tag.
The Native Release workflow builds and tests all four platforms, creates the
GitHub Release with checksum files, and then publishes the npm launcher. A
manual workflow run can build one selected platform or all four as downloadable
Actions artifacts without publishing.
Clean rebuild
Remove local Rust and Python build artifacts:
To also wipe the host LibreDWG build under third_party/libredwg:
Official MCP Registry
Registry metadata lives in server.json under the GitHub-authenticated name
io.github.dimitrovakulenko/dwg-mcp-server.
Before publishing a new registry version:
- Publish the matching npm package version from
npm/. - Confirm
npm/package.jsoncontains the samemcpNameasserver.json. - Run the manual
Publish MCP RegistryGitHub Actions workflow, or run:
The registry validates the published npm package, so server.json must point to
an npm version that already exists on the public npm registry.
License
This project is licensed under the GNU General Public License v3.0.
See LICENSE for the full license text.
來源:README.md,提交 f650f7b
工具
0版本歷史
1- v0.2.3最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分
