bricscad-mcp 0.1.0__tar.gz
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.
- bricscad_mcp-0.1.0/.gitignore +16 -0
- bricscad_mcp-0.1.0/LICENSE +21 -0
- bricscad_mcp-0.1.0/PKG-INFO +219 -0
- bricscad_mcp-0.1.0/README.md +193 -0
- bricscad_mcp-0.1.0/manifest.json +169 -0
- bricscad_mcp-0.1.0/pyproject.toml +58 -0
- bricscad_mcp-0.1.0/server.json +31 -0
- bricscad_mcp-0.1.0/src/bricscad_mcp/__init__.py +1 -0
- bricscad_mcp-0.1.0/src/bricscad_mcp/__main__.py +9 -0
- bricscad_mcp-0.1.0/src/bricscad_mcp/bridge.py +143 -0
- bricscad_mcp-0.1.0/src/bricscad_mcp/errors.py +27 -0
- bricscad_mcp-0.1.0/src/bricscad_mcp/lisp/audit.lsp +140 -0
- bricscad_mcp-0.1.0/src/bricscad_mcp/lisp/edit.lsp +456 -0
- bricscad_mcp-0.1.0/src/bricscad_mcp/lisp/json.lsp +80 -0
- bricscad_mcp-0.1.0/src/bricscad_mcp/lisp/listener.lsp +161 -0
- bricscad_mcp-0.1.0/src/bricscad_mcp/lisp/read.lsp +539 -0
- bricscad_mcp-0.1.0/src/bricscad_mcp/lispgen.py +51 -0
- bricscad_mcp-0.1.0/src/bricscad_mcp/platforms/__init__.py +49 -0
- bricscad_mcp-0.1.0/src/bricscad_mcp/platforms/base.py +84 -0
- bricscad_mcp-0.1.0/src/bricscad_mcp/platforms/linux.py +31 -0
- bricscad_mcp-0.1.0/src/bricscad_mcp/platforms/macos.py +53 -0
- bricscad_mcp-0.1.0/src/bricscad_mcp/platforms/windows.py +26 -0
- bricscad_mcp-0.1.0/src/bricscad_mcp/server.py +51 -0
- bricscad_mcp-0.1.0/src/bricscad_mcp/session.py +221 -0
- bricscad_mcp-0.1.0/src/bricscad_mcp/tools/__init__.py +22 -0
- bricscad_mcp-0.1.0/src/bricscad_mcp/tools/audit.py +42 -0
- bricscad_mcp-0.1.0/src/bricscad_mcp/tools/core.py +55 -0
- bricscad_mcp-0.1.0/src/bricscad_mcp/tools/drawing.py +87 -0
- bricscad_mcp-0.1.0/src/bricscad_mcp/tools/edit.py +304 -0
- bricscad_mcp-0.1.0/src/bricscad_mcp/tools/read.py +179 -0
- bricscad_mcp-0.1.0/src/bricscad_mcp/tools/shapes.py +204 -0
- bricscad_mcp-0.1.0/tests/conftest.py +137 -0
- bricscad_mcp-0.1.0/tests/fake_listener.py +58 -0
- bricscad_mcp-0.1.0/tests/real/conftest.py +85 -0
- bricscad_mcp-0.1.0/tests/real/helpers.py +134 -0
- bricscad_mcp-0.1.0/tests/real/test_attributes.py +55 -0
- bricscad_mcp-0.1.0/tests/real/test_audit.py +193 -0
- bricscad_mcp-0.1.0/tests/real/test_create.py +180 -0
- bricscad_mcp-0.1.0/tests/real/test_drawing.py +100 -0
- bricscad_mcp-0.1.0/tests/real/test_dynamic_blocks.py +123 -0
- bricscad_mcp-0.1.0/tests/real/test_end_to_end.py +109 -0
- bricscad_mcp-0.1.0/tests/real/test_erase.py +49 -0
- bricscad_mcp-0.1.0/tests/real/test_layers.py +76 -0
- bricscad_mcp-0.1.0/tests/real/test_listener.py +171 -0
- bricscad_mcp-0.1.0/tests/real/test_modify.py +119 -0
- bricscad_mcp-0.1.0/tests/real/test_read.py +241 -0
- bricscad_mcp-0.1.0/tests/real/test_save.py +87 -0
- bricscad_mcp-0.1.0/tests/real/test_undo.py +48 -0
- bricscad_mcp-0.1.0/tests/test_bridge.py +244 -0
- bricscad_mcp-0.1.0/tests/test_lispgen.py +65 -0
- bricscad_mcp-0.1.0/tests/test_packaging.py +63 -0
- bricscad_mcp-0.1.0/tests/test_platforms.py +204 -0
- bricscad_mcp-0.1.0/tests/test_session.py +230 -0
- bricscad_mcp-0.1.0/tests/test_stdio.py +54 -0
- bricscad_mcp-0.1.0/tests/test_tools_audit.py +46 -0
- bricscad_mcp-0.1.0/tests/test_tools_core.py +90 -0
- bricscad_mcp-0.1.0/tests/test_tools_drawing.py +139 -0
- bricscad_mcp-0.1.0/tests/test_tools_edit.py +306 -0
- bricscad_mcp-0.1.0/tests/test_tools_read.py +112 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Aleš Dolenec
|
|
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.
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: bricscad-mcp
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: MCP server for controlling BricsCAD through a LISP bridge
|
|
5
|
+
Project-URL: Homepage, https://github.com/alesdev88/bricscad-mcp
|
|
6
|
+
Project-URL: Issues, https://github.com/alesdev88/bricscad-mcp/issues
|
|
7
|
+
Author: Aleš Dolenec
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: bricscad,cad,dwg,dxf,lisp,mcp
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
13
|
+
Classifier: Operating System :: MacOS
|
|
14
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Topic :: Multimedia :: Graphics :: Editors :: Vector-Based
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering
|
|
21
|
+
Requires-Python: >=3.11
|
|
22
|
+
Requires-Dist: mcp<3,>=2.3
|
|
23
|
+
Requires-Dist: platformdirs>=4.2
|
|
24
|
+
Requires-Dist: psutil>=6.0
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
|
|
27
|
+
# BricsCAD MCP
|
|
28
|
+
|
|
29
|
+
An MCP server that lets Claude, or any MCP client, read and audit drawings in BricsCAD.
|
|
30
|
+
It starts its own BricsCAD window and controls it through a small LISP listener, so it works
|
|
31
|
+
at every licence level, including Lite, and doesn't need Windows COM.
|
|
32
|
+
|
|
33
|
+
Status: Phase 1 of 4. Reading and auditing work. Drawing and editing, plotting, and batch jobs
|
|
34
|
+
are planned.
|
|
35
|
+
|
|
36
|
+
## Platform support
|
|
37
|
+
|
|
38
|
+
| Platform | Server logic tests | Real BricsCAD tests | Status |
|
|
39
|
+
|---|---|---|---|
|
|
40
|
+
| macOS | CI | Passed on V26.1.6 Lite | Supported |
|
|
41
|
+
| Windows | CI | Passed on V25 Lite | Supported |
|
|
42
|
+
| Linux | CI | Not run: no test machine yet | Experimental |
|
|
43
|
+
|
|
44
|
+
A platform becomes Supported only when the real BricsCAD tests pass on it. CI has no BricsCAD.
|
|
45
|
+
The Linux install location is unverified, so set `BRICSCAD_EXECUTABLE` if yours is not found.
|
|
46
|
+
|
|
47
|
+
## Install
|
|
48
|
+
|
|
49
|
+
You need BricsCAD in every case.
|
|
50
|
+
|
|
51
|
+
### Claude Desktop
|
|
52
|
+
|
|
53
|
+
Download the bundle for your computer from the
|
|
54
|
+
[latest release](https://github.com/alesdev88/bricscad-mcp/releases/latest) and open it:
|
|
55
|
+
|
|
56
|
+
- macOS with Apple silicon: `bricscad-mcp-<version>-darwin-arm64.mcpb`
|
|
57
|
+
- Windows: `bricscad-mcp-<version>-win32.mcpb`
|
|
58
|
+
|
|
59
|
+
The bundle brings its own Python, so there is nothing to install first. Its settings let you pick a
|
|
60
|
+
BricsCAD version, or point to the program if it isn't found. On an Intel Mac, use the `uvx` setup
|
|
61
|
+
below.
|
|
62
|
+
|
|
63
|
+
### Claude Code, Codex and other clients
|
|
64
|
+
|
|
65
|
+
These run the server from PyPI with [uv](https://docs.astral.sh/uv/), so install uv first.
|
|
66
|
+
|
|
67
|
+
Claude Code:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
claude mcp add bricscad -- uvx bricscad-mcp
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Codex (the CLI, the IDE extension and the ChatGPT desktop app share this setting):
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
codex mcp add bricscad -- uvx bricscad-mcp
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Cursor, VS Code, Windsurf and other clients that take an `mcpServers` entry:
|
|
80
|
+
|
|
81
|
+
```json
|
|
82
|
+
{
|
|
83
|
+
"mcpServers": {
|
|
84
|
+
"bricscad": {
|
|
85
|
+
"command": "uvx",
|
|
86
|
+
"args": ["bricscad-mcp"],
|
|
87
|
+
"env": { "BRICSCAD_VERSION": "26" }
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
`env` is optional. See [Environment variables](#environment-variables).
|
|
94
|
+
|
|
95
|
+
### From source
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
git clone https://github.com/alesdev88/bricscad-mcp.git
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
cd bricscad-mcp && uv sync
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Then register it, using the full path to your copy:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
claude mcp add bricscad -- uv --directory "/full/path/to/bricscad-mcp" run bricscad-mcp
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Tools
|
|
112
|
+
|
|
113
|
+
| Tool | What it does |
|
|
114
|
+
|---|---|
|
|
115
|
+
| `bricscad_list_versions` | Lists installed versions |
|
|
116
|
+
| `bricscad_start` / `bricscad_stop` | Starts or closes the server's own BricsCAD |
|
|
117
|
+
| `bricscad_status` | Reports whether it's running, listener health and the current drawing |
|
|
118
|
+
| `bricscad_open_drawing` / `bricscad_close_drawing` | Opens a DWG or DXF (read-only by default), or closes it |
|
|
119
|
+
| `bricscad_drawing_info` | Name, path, state, units, entity count, layouts, and the limits and extents of the current layout |
|
|
120
|
+
| `bricscad_list_layers` / `_blocks` / `_xrefs` / `_layouts` | Lists what's in the drawing |
|
|
121
|
+
| `bricscad_query_entities` | Finds entities by type, layer, block, layout or bounding box |
|
|
122
|
+
| `bricscad_get_entity` | Returns all DXF values for one entity |
|
|
123
|
+
| `bricscad_read_attributes` | Reads block attributes, such as title block contents |
|
|
124
|
+
| `bricscad_find_text` | Searches TEXT, MTEXT, MULTILEADER, table cell and attribute text |
|
|
125
|
+
| `bricscad_audit_report` | Empty layers, unused blocks, missing xrefs, raised entities, off-standard layer names |
|
|
126
|
+
| `bricscad_create_entities` | Draws lines, polylines, circles, arcs, text, MTEXT, dimensions, hatches and block inserts |
|
|
127
|
+
| `bricscad_modify_entities` | Moves, rotates, scales, or changes layer, color, linetype or text |
|
|
128
|
+
| `bricscad_erase_entities` | Erases entities by handle |
|
|
129
|
+
| `bricscad_set_layer` | Creates or changes a layer |
|
|
130
|
+
| `bricscad_set_attributes` | Sets block attribute values, such as title block contents |
|
|
131
|
+
| `bricscad_undo` | Undoes edit tool calls, one step each |
|
|
132
|
+
| `bricscad_save_drawing` | Saves to a new path, or over the open file with `overwrite=true` |
|
|
133
|
+
| `bricscad_run_lisp` | Runs LISP for anything the other tools don't cover |
|
|
134
|
+
|
|
135
|
+
List tools take `limit` and `offset` and report `total`. The default limit is 200 and the maximum
|
|
136
|
+
is 2000.
|
|
137
|
+
|
|
138
|
+
## Good to know
|
|
139
|
+
|
|
140
|
+
- **One copy per version.** `bricscad_start` refuses if that BricsCAD version is already running,
|
|
141
|
+
because a second copy of the same version doesn't start its listener. Close it first, or choose
|
|
142
|
+
another version with `BRICSCAD_VERSION`.
|
|
143
|
+
- **The window is occupied.** While the listener runs, its BricsCAD window isn't meant for hand use,
|
|
144
|
+
and it may not show the open drawing. Trust the tools, not the window. Draw in a copy of another
|
|
145
|
+
version, or stop the server first.
|
|
146
|
+
- **Dynamic blocks go by their own name.** Their inserts are stored under anonymous names such as
|
|
147
|
+
`*U12`. Block filters, insert counts and attribute results use the name you know.
|
|
148
|
+
- **`bricscad_run_lisp` is powerful.** LISP can change or delete files and start programs, so every
|
|
149
|
+
call goes through your client's tool approval.
|
|
150
|
+
- **Timeouts.** If a dialog blocks BricsCAD, the call fails after its timeout (30 seconds by default)
|
|
151
|
+
and says to check the window.
|
|
152
|
+
|
|
153
|
+
## Safety
|
|
154
|
+
|
|
155
|
+
- Drawings open read-only by default.
|
|
156
|
+
- Closing or stopping refuses if there are unsaved changes, unless you pass `discard=true`.
|
|
157
|
+
- `bricscad_stop` only ever closes the copy this server started.
|
|
158
|
+
- If the client exits, a copy with nothing unsaved closes by itself. A copy with unsaved work stays
|
|
159
|
+
open so you can save it.
|
|
160
|
+
- The server doesn't permanently change BricsCAD settings.
|
|
161
|
+
- Each edit tool call is all-or-nothing and one undo step. Edits made through `bricscad_run_lisp` have
|
|
162
|
+
no step of their own, so they go back with the step before them.
|
|
163
|
+
- Entities on locked layers are refused, and missing layers are never created by drawing on them.
|
|
164
|
+
- Saving over an existing file needs `overwrite=true`, and the server checks that before BricsCAD is
|
|
165
|
+
involved. A read-only drawing can only be saved to a new path, a file open as another drawing or
|
|
166
|
+
marked read-only is never replaced, and a replaced file leaves a `.bak` beside it.
|
|
167
|
+
|
|
168
|
+
## Environment variables
|
|
169
|
+
|
|
170
|
+
| Variable | Purpose |
|
|
171
|
+
|---|---|
|
|
172
|
+
| `BRICSCAD_VERSION` | The version to start, for example `26`. Defaults to the newest installed |
|
|
173
|
+
| `BRICSCAD_EXECUTABLE` | Full path to BricsCAD, if it isn't found automatically |
|
|
174
|
+
|
|
175
|
+
## Known limits
|
|
176
|
+
|
|
177
|
+
- So far it has only been tested on drawings its tests created. Real project drawings may bring up
|
|
178
|
+
dialogs that haven't been seen yet, such as missing fonts or proxy objects.
|
|
179
|
+
- `vla-save` opens a dialog and `vla-saveas` fails on macOS, so use `_.QSAVE` and `_.SAVEAS` in LISP.
|
|
180
|
+
- On Windows, BricsCAD's LISP holds text in the Windows code page (`SYSCODEPAGE`), not Unicode.
|
|
181
|
+
Slovenian and other text in that code page works. LISP would turn characters outside it, such as
|
|
182
|
+
Chinese on a Central European system, into `?`, so the server refuses any call that contains them
|
|
183
|
+
and names each one. It detects the code page when it starts BricsCAD.
|
|
184
|
+
- Don't close the only open drawing with your own LISP, because the listener stops. `bricscad_close_drawing`
|
|
185
|
+
handles this for you.
|
|
186
|
+
|
|
187
|
+
## Development
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
uv run pytest
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
These tests need no BricsCAD. To run the real tests, close that version of BricsCAD first. They open
|
|
194
|
+
one copy at a time and use only temporary drawings:
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
uv run pytest -m bricscad
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
Passing them on Windows or Linux is what moves that platform to Supported.
|
|
201
|
+
|
|
202
|
+
Design and test results are in `docs/`: start with `docs/superpowers/specs/2026-11-06-bricscad-mcp-design.md`
|
|
203
|
+
and `docs/phase-0-results.md`.
|
|
204
|
+
|
|
205
|
+
## Releasing
|
|
206
|
+
|
|
207
|
+
1. Set the new version in `pyproject.toml`, `manifest.json` and `server.json`, then run `uv lock`.
|
|
208
|
+
A test checks that the three agree, and that `manifest.json` lists every tool.
|
|
209
|
+
2. Push a tag for it, such as `v0.1.0`. The `release` workflow tests the commit, checks a fresh
|
|
210
|
+
install of the wheel, builds both bundles, creates the GitHub release, publishes to PyPI and then
|
|
211
|
+
to the MCP registry.
|
|
212
|
+
3. Install each bundle on its platform before announcing the release. CI can't start them.
|
|
213
|
+
|
|
214
|
+
To build a bundle locally, `uv run python scripts/build_bundle.py --target darwin-arm64` (or `win32`
|
|
215
|
+
or `all`). It needs Node for the `mcpb` packer; `--no-pack` stops before packing and leaves the
|
|
216
|
+
unpacked bundle in `build/`.
|
|
217
|
+
|
|
218
|
+
PyPI publishing needs a trusted publisher on pypi.org for this repository, workflow `publish.yml`,
|
|
219
|
+
environment left blank.
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
# BricsCAD MCP
|
|
2
|
+
|
|
3
|
+
An MCP server that lets Claude, or any MCP client, read and audit drawings in BricsCAD.
|
|
4
|
+
It starts its own BricsCAD window and controls it through a small LISP listener, so it works
|
|
5
|
+
at every licence level, including Lite, and doesn't need Windows COM.
|
|
6
|
+
|
|
7
|
+
Status: Phase 1 of 4. Reading and auditing work. Drawing and editing, plotting, and batch jobs
|
|
8
|
+
are planned.
|
|
9
|
+
|
|
10
|
+
## Platform support
|
|
11
|
+
|
|
12
|
+
| Platform | Server logic tests | Real BricsCAD tests | Status |
|
|
13
|
+
|---|---|---|---|
|
|
14
|
+
| macOS | CI | Passed on V26.1.6 Lite | Supported |
|
|
15
|
+
| Windows | CI | Passed on V25 Lite | Supported |
|
|
16
|
+
| Linux | CI | Not run: no test machine yet | Experimental |
|
|
17
|
+
|
|
18
|
+
A platform becomes Supported only when the real BricsCAD tests pass on it. CI has no BricsCAD.
|
|
19
|
+
The Linux install location is unverified, so set `BRICSCAD_EXECUTABLE` if yours is not found.
|
|
20
|
+
|
|
21
|
+
## Install
|
|
22
|
+
|
|
23
|
+
You need BricsCAD in every case.
|
|
24
|
+
|
|
25
|
+
### Claude Desktop
|
|
26
|
+
|
|
27
|
+
Download the bundle for your computer from the
|
|
28
|
+
[latest release](https://github.com/alesdev88/bricscad-mcp/releases/latest) and open it:
|
|
29
|
+
|
|
30
|
+
- macOS with Apple silicon: `bricscad-mcp-<version>-darwin-arm64.mcpb`
|
|
31
|
+
- Windows: `bricscad-mcp-<version>-win32.mcpb`
|
|
32
|
+
|
|
33
|
+
The bundle brings its own Python, so there is nothing to install first. Its settings let you pick a
|
|
34
|
+
BricsCAD version, or point to the program if it isn't found. On an Intel Mac, use the `uvx` setup
|
|
35
|
+
below.
|
|
36
|
+
|
|
37
|
+
### Claude Code, Codex and other clients
|
|
38
|
+
|
|
39
|
+
These run the server from PyPI with [uv](https://docs.astral.sh/uv/), so install uv first.
|
|
40
|
+
|
|
41
|
+
Claude Code:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
claude mcp add bricscad -- uvx bricscad-mcp
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Codex (the CLI, the IDE extension and the ChatGPT desktop app share this setting):
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
codex mcp add bricscad -- uvx bricscad-mcp
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Cursor, VS Code, Windsurf and other clients that take an `mcpServers` entry:
|
|
54
|
+
|
|
55
|
+
```json
|
|
56
|
+
{
|
|
57
|
+
"mcpServers": {
|
|
58
|
+
"bricscad": {
|
|
59
|
+
"command": "uvx",
|
|
60
|
+
"args": ["bricscad-mcp"],
|
|
61
|
+
"env": { "BRICSCAD_VERSION": "26" }
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
`env` is optional. See [Environment variables](#environment-variables).
|
|
68
|
+
|
|
69
|
+
### From source
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
git clone https://github.com/alesdev88/bricscad-mcp.git
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
cd bricscad-mcp && uv sync
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Then register it, using the full path to your copy:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
claude mcp add bricscad -- uv --directory "/full/path/to/bricscad-mcp" run bricscad-mcp
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Tools
|
|
86
|
+
|
|
87
|
+
| Tool | What it does |
|
|
88
|
+
|---|---|
|
|
89
|
+
| `bricscad_list_versions` | Lists installed versions |
|
|
90
|
+
| `bricscad_start` / `bricscad_stop` | Starts or closes the server's own BricsCAD |
|
|
91
|
+
| `bricscad_status` | Reports whether it's running, listener health and the current drawing |
|
|
92
|
+
| `bricscad_open_drawing` / `bricscad_close_drawing` | Opens a DWG or DXF (read-only by default), or closes it |
|
|
93
|
+
| `bricscad_drawing_info` | Name, path, state, units, entity count, layouts, and the limits and extents of the current layout |
|
|
94
|
+
| `bricscad_list_layers` / `_blocks` / `_xrefs` / `_layouts` | Lists what's in the drawing |
|
|
95
|
+
| `bricscad_query_entities` | Finds entities by type, layer, block, layout or bounding box |
|
|
96
|
+
| `bricscad_get_entity` | Returns all DXF values for one entity |
|
|
97
|
+
| `bricscad_read_attributes` | Reads block attributes, such as title block contents |
|
|
98
|
+
| `bricscad_find_text` | Searches TEXT, MTEXT, MULTILEADER, table cell and attribute text |
|
|
99
|
+
| `bricscad_audit_report` | Empty layers, unused blocks, missing xrefs, raised entities, off-standard layer names |
|
|
100
|
+
| `bricscad_create_entities` | Draws lines, polylines, circles, arcs, text, MTEXT, dimensions, hatches and block inserts |
|
|
101
|
+
| `bricscad_modify_entities` | Moves, rotates, scales, or changes layer, color, linetype or text |
|
|
102
|
+
| `bricscad_erase_entities` | Erases entities by handle |
|
|
103
|
+
| `bricscad_set_layer` | Creates or changes a layer |
|
|
104
|
+
| `bricscad_set_attributes` | Sets block attribute values, such as title block contents |
|
|
105
|
+
| `bricscad_undo` | Undoes edit tool calls, one step each |
|
|
106
|
+
| `bricscad_save_drawing` | Saves to a new path, or over the open file with `overwrite=true` |
|
|
107
|
+
| `bricscad_run_lisp` | Runs LISP for anything the other tools don't cover |
|
|
108
|
+
|
|
109
|
+
List tools take `limit` and `offset` and report `total`. The default limit is 200 and the maximum
|
|
110
|
+
is 2000.
|
|
111
|
+
|
|
112
|
+
## Good to know
|
|
113
|
+
|
|
114
|
+
- **One copy per version.** `bricscad_start` refuses if that BricsCAD version is already running,
|
|
115
|
+
because a second copy of the same version doesn't start its listener. Close it first, or choose
|
|
116
|
+
another version with `BRICSCAD_VERSION`.
|
|
117
|
+
- **The window is occupied.** While the listener runs, its BricsCAD window isn't meant for hand use,
|
|
118
|
+
and it may not show the open drawing. Trust the tools, not the window. Draw in a copy of another
|
|
119
|
+
version, or stop the server first.
|
|
120
|
+
- **Dynamic blocks go by their own name.** Their inserts are stored under anonymous names such as
|
|
121
|
+
`*U12`. Block filters, insert counts and attribute results use the name you know.
|
|
122
|
+
- **`bricscad_run_lisp` is powerful.** LISP can change or delete files and start programs, so every
|
|
123
|
+
call goes through your client's tool approval.
|
|
124
|
+
- **Timeouts.** If a dialog blocks BricsCAD, the call fails after its timeout (30 seconds by default)
|
|
125
|
+
and says to check the window.
|
|
126
|
+
|
|
127
|
+
## Safety
|
|
128
|
+
|
|
129
|
+
- Drawings open read-only by default.
|
|
130
|
+
- Closing or stopping refuses if there are unsaved changes, unless you pass `discard=true`.
|
|
131
|
+
- `bricscad_stop` only ever closes the copy this server started.
|
|
132
|
+
- If the client exits, a copy with nothing unsaved closes by itself. A copy with unsaved work stays
|
|
133
|
+
open so you can save it.
|
|
134
|
+
- The server doesn't permanently change BricsCAD settings.
|
|
135
|
+
- Each edit tool call is all-or-nothing and one undo step. Edits made through `bricscad_run_lisp` have
|
|
136
|
+
no step of their own, so they go back with the step before them.
|
|
137
|
+
- Entities on locked layers are refused, and missing layers are never created by drawing on them.
|
|
138
|
+
- Saving over an existing file needs `overwrite=true`, and the server checks that before BricsCAD is
|
|
139
|
+
involved. A read-only drawing can only be saved to a new path, a file open as another drawing or
|
|
140
|
+
marked read-only is never replaced, and a replaced file leaves a `.bak` beside it.
|
|
141
|
+
|
|
142
|
+
## Environment variables
|
|
143
|
+
|
|
144
|
+
| Variable | Purpose |
|
|
145
|
+
|---|---|
|
|
146
|
+
| `BRICSCAD_VERSION` | The version to start, for example `26`. Defaults to the newest installed |
|
|
147
|
+
| `BRICSCAD_EXECUTABLE` | Full path to BricsCAD, if it isn't found automatically |
|
|
148
|
+
|
|
149
|
+
## Known limits
|
|
150
|
+
|
|
151
|
+
- So far it has only been tested on drawings its tests created. Real project drawings may bring up
|
|
152
|
+
dialogs that haven't been seen yet, such as missing fonts or proxy objects.
|
|
153
|
+
- `vla-save` opens a dialog and `vla-saveas` fails on macOS, so use `_.QSAVE` and `_.SAVEAS` in LISP.
|
|
154
|
+
- On Windows, BricsCAD's LISP holds text in the Windows code page (`SYSCODEPAGE`), not Unicode.
|
|
155
|
+
Slovenian and other text in that code page works. LISP would turn characters outside it, such as
|
|
156
|
+
Chinese on a Central European system, into `?`, so the server refuses any call that contains them
|
|
157
|
+
and names each one. It detects the code page when it starts BricsCAD.
|
|
158
|
+
- Don't close the only open drawing with your own LISP, because the listener stops. `bricscad_close_drawing`
|
|
159
|
+
handles this for you.
|
|
160
|
+
|
|
161
|
+
## Development
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
uv run pytest
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
These tests need no BricsCAD. To run the real tests, close that version of BricsCAD first. They open
|
|
168
|
+
one copy at a time and use only temporary drawings:
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
uv run pytest -m bricscad
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Passing them on Windows or Linux is what moves that platform to Supported.
|
|
175
|
+
|
|
176
|
+
Design and test results are in `docs/`: start with `docs/superpowers/specs/2026-11-06-bricscad-mcp-design.md`
|
|
177
|
+
and `docs/phase-0-results.md`.
|
|
178
|
+
|
|
179
|
+
## Releasing
|
|
180
|
+
|
|
181
|
+
1. Set the new version in `pyproject.toml`, `manifest.json` and `server.json`, then run `uv lock`.
|
|
182
|
+
A test checks that the three agree, and that `manifest.json` lists every tool.
|
|
183
|
+
2. Push a tag for it, such as `v0.1.0`. The `release` workflow tests the commit, checks a fresh
|
|
184
|
+
install of the wheel, builds both bundles, creates the GitHub release, publishes to PyPI and then
|
|
185
|
+
to the MCP registry.
|
|
186
|
+
3. Install each bundle on its platform before announcing the release. CI can't start them.
|
|
187
|
+
|
|
188
|
+
To build a bundle locally, `uv run python scripts/build_bundle.py --target darwin-arm64` (or `win32`
|
|
189
|
+
or `all`). It needs Node for the `mcpb` packer; `--no-pack` stops before packing and leaves the
|
|
190
|
+
unpacked bundle in `build/`.
|
|
191
|
+
|
|
192
|
+
PyPI publishing needs a trusted publisher on pypi.org for this repository, workflow `publish.yml`,
|
|
193
|
+
environment left blank.
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
{
|
|
2
|
+
"manifest_version": "0.4",
|
|
3
|
+
"name": "bricscad-mcp",
|
|
4
|
+
"display_name": "BricsCAD",
|
|
5
|
+
"version": "0.1.0",
|
|
6
|
+
"description": "Read, audit and edit drawings in BricsCAD through a LISP listener.",
|
|
7
|
+
"long_description": "Starts its own BricsCAD window and controls it through a small LISP listener, so it works at every licence level, including Lite, and doesn't need Windows COM. Reads and audits drawings, draws and edits entities, and runs LISP for anything else.\n\nSelf-contained: the bundle carries its own Python and every dependency, so there is nothing to install first. BricsCAD must be installed.\n\n**Updating:** install the newest `.mcpb` for your platform from the [releases page](https://github.com/alesdev88/bricscad-mcp/releases) over this one.",
|
|
8
|
+
"author": {
|
|
9
|
+
"name": "Aleš Dolenec",
|
|
10
|
+
"url": "https://github.com/alesdev88"
|
|
11
|
+
},
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/alesdev88/bricscad-mcp"
|
|
15
|
+
},
|
|
16
|
+
"homepage": "https://github.com/alesdev88/bricscad-mcp/releases",
|
|
17
|
+
"documentation": "https://github.com/alesdev88/bricscad-mcp#readme",
|
|
18
|
+
"support": "https://github.com/alesdev88/bricscad-mcp/issues",
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"_meta": {
|
|
21
|
+
"template": {
|
|
22
|
+
"note": "Template. scripts/build_bundle.py rewrites the server block and platforms for each bundle it builds; this shows the macOS shape."
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"server": {
|
|
26
|
+
"type": "binary",
|
|
27
|
+
"entry_point": "runtime/bin/python3",
|
|
28
|
+
"mcp_config": {
|
|
29
|
+
"command": "${__dirname}/runtime/bin/python3",
|
|
30
|
+
"args": [
|
|
31
|
+
"-I",
|
|
32
|
+
"-m",
|
|
33
|
+
"bricscad_mcp"
|
|
34
|
+
],
|
|
35
|
+
"env": {
|
|
36
|
+
"BRICSCAD_VERSION": "${user_config.bricscad_version}",
|
|
37
|
+
"BRICSCAD_EXECUTABLE": "${user_config.bricscad_executable}"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"tools": [
|
|
42
|
+
{
|
|
43
|
+
"name": "bricscad_audit_report",
|
|
44
|
+
"description": "Report empty layers, unused blocks, missing xrefs, entities not at zero elevation, and off-standard layer names."
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"name": "bricscad_list_versions",
|
|
48
|
+
"description": "List the BricsCAD versions installed on this computer, newest first."
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"name": "bricscad_start",
|
|
52
|
+
"description": "Start BricsCAD in its own window and connect to it. Refuses if that version is already running."
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"name": "bricscad_stop",
|
|
56
|
+
"description": "Close the BricsCAD this server started. Refuses if drawings have unsaved changes."
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"name": "bricscad_status",
|
|
60
|
+
"description": "Report whether BricsCAD is running, how recently its listener reported, and the current drawing."
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"name": "bricscad_run_lisp",
|
|
64
|
+
"description": "Run LISP in BricsCAD and return the value of its last expression."
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"name": "bricscad_open_drawing",
|
|
68
|
+
"description": "Open a DWG or DXF and make it the current drawing. Returns the same details as bricscad_drawing_info."
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"name": "bricscad_close_drawing",
|
|
72
|
+
"description": "Close the current drawing. Refuses if it has unsaved changes."
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"name": "bricscad_drawing_info",
|
|
76
|
+
"description": "Describe the current drawing: name, path, read-only and modified state, units, limits, entity count and layouts."
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"name": "bricscad_list_layers",
|
|
80
|
+
"description": "List layers with their on, frozen and locked state, color, linetype and entity count. Up to 2000 per call."
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"name": "bricscad_list_blocks",
|
|
84
|
+
"description": "List block definitions with insert counts, including nested inserts and inserts of dynamic blocks. Up to 2000 per call."
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"name": "bricscad_list_xrefs",
|
|
88
|
+
"description": "List external references with their stored path and whether the file was found. Up to 2000 per call."
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"name": "bricscad_list_layouts",
|
|
92
|
+
"description": "List Model and the paper space layouts with their entity counts. Up to 2000 per call."
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"name": "bricscad_query_entities",
|
|
96
|
+
"description": "Find entities in the current drawing. Returns handle, type, layer, layout and bounding box. Up to 2000 per call."
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"name": "bricscad_get_entity",
|
|
100
|
+
"description": "Return one entity's type, layer and all its DXF group codes, as [code, value] pairs."
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"name": "bricscad_read_attributes",
|
|
104
|
+
"description": "Read attribute values from block inserts, for example title block contents. Up to 2000 per call."
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"name": "bricscad_find_text",
|
|
108
|
+
"description": "Search TEXT, MTEXT, MULTILEADER, table cell and block attribute text for literal text."
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"name": "bricscad_undo",
|
|
112
|
+
"description": "Undo the last edits to the current drawing. Returns how many steps were undone."
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"name": "bricscad_erase_entities",
|
|
116
|
+
"description": "Erase entities by handle. Erases all of them or none. bricscad_undo restores them."
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"name": "bricscad_set_layer",
|
|
120
|
+
"description": "Create a layer, or change one that exists. Only the values you give are changed."
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"name": "bricscad_modify_entities",
|
|
124
|
+
"description": "Change entities by handle. Changes all of them or none, and refuses locked layers."
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"name": "bricscad_set_attributes",
|
|
128
|
+
"description": "Set attribute values on block inserts, such as a title block. Changes all of them or none."
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"name": "bricscad_create_entities",
|
|
132
|
+
"description": "Draw entities and return their handles. Draws all of them or none, as one undo step."
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"name": "bricscad_save_drawing",
|
|
136
|
+
"description": "Save the current drawing. Returns the same details as bricscad_drawing_info."
|
|
137
|
+
}
|
|
138
|
+
],
|
|
139
|
+
"user_config": {
|
|
140
|
+
"bricscad_version": {
|
|
141
|
+
"type": "string",
|
|
142
|
+
"title": "BricsCAD version",
|
|
143
|
+
"description": "The version to start, for example 26. Leave blank for the newest installed.",
|
|
144
|
+
"required": false,
|
|
145
|
+
"default": ""
|
|
146
|
+
},
|
|
147
|
+
"bricscad_executable": {
|
|
148
|
+
"type": "file",
|
|
149
|
+
"title": "BricsCAD program",
|
|
150
|
+
"description": "Only if BricsCAD isn't found automatically: the full path to the BricsCAD program.",
|
|
151
|
+
"required": false,
|
|
152
|
+
"default": ""
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
"keywords": [
|
|
156
|
+
"bricscad",
|
|
157
|
+
"cad",
|
|
158
|
+
"dwg",
|
|
159
|
+
"dxf",
|
|
160
|
+
"lisp",
|
|
161
|
+
"drawing"
|
|
162
|
+
],
|
|
163
|
+
"compatibility": {
|
|
164
|
+
"platforms": [
|
|
165
|
+
"darwin",
|
|
166
|
+
"win32"
|
|
167
|
+
]
|
|
168
|
+
}
|
|
169
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "bricscad-mcp"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "MCP server for controlling BricsCAD through a LISP bridge"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.11"
|
|
7
|
+
license = "MIT"
|
|
8
|
+
license-files = ["LICENSE"]
|
|
9
|
+
authors = [{ name = "Aleš Dolenec" }]
|
|
10
|
+
keywords = ["mcp", "bricscad", "cad", "dwg", "dxf", "lisp"]
|
|
11
|
+
classifiers = [
|
|
12
|
+
"Development Status :: 3 - Alpha",
|
|
13
|
+
"Intended Audience :: End Users/Desktop",
|
|
14
|
+
"Operating System :: MacOS",
|
|
15
|
+
"Operating System :: Microsoft :: Windows",
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"Programming Language :: Python :: 3.11",
|
|
18
|
+
"Programming Language :: Python :: 3.12",
|
|
19
|
+
"Programming Language :: Python :: 3.13",
|
|
20
|
+
"Topic :: Multimedia :: Graphics :: Editors :: Vector-Based",
|
|
21
|
+
"Topic :: Scientific/Engineering",
|
|
22
|
+
]
|
|
23
|
+
dependencies = [
|
|
24
|
+
"mcp>=2.3,<3",
|
|
25
|
+
"platformdirs>=4.2",
|
|
26
|
+
"psutil>=6.0",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[project.urls]
|
|
30
|
+
Homepage = "https://github.com/alesdev88/bricscad-mcp"
|
|
31
|
+
Issues = "https://github.com/alesdev88/bricscad-mcp/issues"
|
|
32
|
+
|
|
33
|
+
[project.scripts]
|
|
34
|
+
bricscad-mcp = "bricscad_mcp.server:main"
|
|
35
|
+
|
|
36
|
+
[dependency-groups]
|
|
37
|
+
dev = [
|
|
38
|
+
"ezdxf>=1.4.5",
|
|
39
|
+
"pytest>=8.0",
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
[build-system]
|
|
43
|
+
requires = ["hatchling"]
|
|
44
|
+
build-backend = "hatchling.build"
|
|
45
|
+
|
|
46
|
+
[tool.hatch.build.targets.wheel]
|
|
47
|
+
packages = ["src/bricscad_mcp"]
|
|
48
|
+
|
|
49
|
+
[tool.hatch.build.targets.sdist]
|
|
50
|
+
include = ["src/bricscad_mcp", "tests", "README.md", "LICENSE", "manifest.json", "server.json"]
|
|
51
|
+
|
|
52
|
+
[tool.pytest.ini_options]
|
|
53
|
+
testpaths = ["tests"]
|
|
54
|
+
pythonpath = ["tests"]
|
|
55
|
+
addopts = "-m 'not bricscad'"
|
|
56
|
+
markers = [
|
|
57
|
+
"bricscad: needs a real BricsCAD installation; run with -m bricscad",
|
|
58
|
+
]
|