mcpfreecad 0.0.1__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.
- mcpfreecad-0.0.1/LICENSE.md +12 -0
- mcpfreecad-0.0.1/PKG-INFO +256 -0
- mcpfreecad-0.0.1/README.md +240 -0
- mcpfreecad-0.0.1/mcpfreecad/__init__.py +12 -0
- mcpfreecad-0.0.1/mcpfreecad/app/__init__.py +1 -0
- mcpfreecad-0.0.1/mcpfreecad/app/server.py +1154 -0
- mcpfreecad-0.0.1/mcpfreecad/bridge/__init__.py +1 -0
- mcpfreecad-0.0.1/mcpfreecad/bridge/client.py +59 -0
- mcpfreecad-0.0.1/mcpfreecad/bridge/protocol.py +9 -0
- mcpfreecad-0.0.1/mcpfreecad/config/__init__.py +1 -0
- mcpfreecad-0.0.1/mcpfreecad/config/api_keys.py +92 -0
- mcpfreecad-0.0.1/mcpfreecad/config/config_manager.py +143 -0
- mcpfreecad-0.0.1/mcpfreecad/config/schema.py +73 -0
- mcpfreecad-0.0.1/mcpfreecad/freecad/__init__.py +1 -0
- mcpfreecad-0.0.1/mcpfreecad/freecad/bridge_server.py +2032 -0
- mcpfreecad-0.0.1/mcpfreecad/workbenches/__init__.py +12 -0
- mcpfreecad-0.0.1/mcpfreecad/workbenches/base.py +25 -0
- mcpfreecad-0.0.1/mcpfreecad/workbenches/builtin.py +89 -0
- mcpfreecad-0.0.1/mcpfreecad/workbenches/fasteners.py +161 -0
- mcpfreecad-0.0.1/mcpfreecad/workbenches/freecad_gears.py +109 -0
- mcpfreecad-0.0.1/mcpfreecad.egg-info/PKG-INFO +256 -0
- mcpfreecad-0.0.1/mcpfreecad.egg-info/SOURCES.txt +31 -0
- mcpfreecad-0.0.1/mcpfreecad.egg-info/dependency_links.txt +1 -0
- mcpfreecad-0.0.1/mcpfreecad.egg-info/entry_points.txt +2 -0
- mcpfreecad-0.0.1/mcpfreecad.egg-info/requires.txt +7 -0
- mcpfreecad-0.0.1/mcpfreecad.egg-info/top_level.txt +1 -0
- mcpfreecad-0.0.1/pyproject.toml +43 -0
- mcpfreecad-0.0.1/setup.cfg +4 -0
- mcpfreecad-0.0.1/tests/test_api_keys.py +16 -0
- mcpfreecad-0.0.1/tests/test_bridge_client.py +73 -0
- mcpfreecad-0.0.1/tests/test_bridge_tree.py +52 -0
- mcpfreecad-0.0.1/tests/test_server.py +223 -0
- mcpfreecad-0.0.1/tests/test_sketch_helpers.py +291 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Copyright 2026, Thomas Spielauer
|
|
2
|
+
|
|
3
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
4
|
+
|
|
5
|
+
* Redistributions of source code must retain the above copyright notice, this list of conditions, and the following disclaimer.
|
|
6
|
+
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions, and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
7
|
+
* Products that incorporate or use this software must include the acknowledgment “This product includes software developed by Thomas Spielauer.” in their documentation, credits, “About” page, or other reasonably accessible attribution notice.
|
|
8
|
+
* Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
9
|
+
|
|
10
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
11
|
+
|
|
12
|
+
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mcpfreecad
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: MCP server for controlling a running FreeCAD session
|
|
5
|
+
Author-email: Thomas Spielauer <pypipackages01@tspi.at>
|
|
6
|
+
Requires-Python: >=3.11
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE.md
|
|
9
|
+
Requires-Dist: mcp>=1.0.0
|
|
10
|
+
Requires-Dist: pydantic>2.5.0
|
|
11
|
+
Requires-Dist: argon2-cffi>=23.1.0
|
|
12
|
+
Provides-Extra: remote
|
|
13
|
+
Requires-Dist: fastapi>=0.110.0; extra == "remote"
|
|
14
|
+
Requires-Dist: uvicorn>=0.24.0; extra == "remote"
|
|
15
|
+
Dynamic: license-file
|
|
16
|
+
|
|
17
|
+
# FreeCAD MCP Server `mcpfreecad`
|
|
18
|
+
|
|
19
|
+
`mcpfreecad` is an MCP server for driving a running FreeCAD session. It exposes document management, modeling, inspection, snapshot, and optional workbench operations to MCP clients over `stdio` or authenticated remote HTTP.
|
|
20
|
+
|
|
21
|
+
The server is designed around a small Python bridge that is loaded into FreeCAD's embedded interpreter. The MCP process then talks to that bridge over localhost.
|
|
22
|
+
|
|
23
|
+
## Features
|
|
24
|
+
|
|
25
|
+
- `stdio` and API-key authenticated `remotehttp` transports
|
|
26
|
+
- document lifecycle tools for opening, saving, closing, and enumerating FreeCAD documents
|
|
27
|
+
- explicit model inspection via document tree, topology, sketch status, and sketch details tools
|
|
28
|
+
- modeling support for Part primitives, PartDesign bodies/pads/pockets, spreadsheets, Draft arrays, and snapshots
|
|
29
|
+
- reusable object library backed by BREP plus JSON metadata
|
|
30
|
+
- optional workbench integration for helpers such as `freecad.gears`, Fasteners, Curves sketch-on-surface workflows, and A2plus assembly operations when available
|
|
31
|
+
- remote snapshot retrieval through authenticated URLs or tokenized snapshot download URLs
|
|
32
|
+
|
|
33
|
+
For LLM-facing operating guidance, see `LLM_USAGE.md`.
|
|
34
|
+
|
|
35
|
+
## Installation
|
|
36
|
+
|
|
37
|
+
Install from PyPI:
|
|
38
|
+
|
|
39
|
+
```sh
|
|
40
|
+
pip install mcpfreecad
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
To enable remote HTTP mode:
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
pip install "mcpfreecad[remote]"
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
For local development:
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
git clone <repository-url>
|
|
53
|
+
cd mcpFreeCAD
|
|
54
|
+
pip install -e .
|
|
55
|
+
pip install -e ".[remote]"
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Quick Start
|
|
59
|
+
|
|
60
|
+
1. Start FreeCAD.
|
|
61
|
+
2. Load the bridge module inside the FreeCAD Python console.
|
|
62
|
+
3. Start `mcpfreecad` in `stdio` mode or `remotehttp` mode.
|
|
63
|
+
4. Connect your MCP client and call `bridge_status`.
|
|
64
|
+
|
|
65
|
+
Example bridge loading from a checkout:
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
exec(open("/path/to/mcpFreeCAD/examples/freecad_bridge_loader.py").read(), globals(), globals())
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
The loader starts the bridge on `127.0.0.1:48111` with token `change-me`. Adjust the example or call `start_bridge_server(...)` directly if you need different values.
|
|
72
|
+
|
|
73
|
+
## Configuration
|
|
74
|
+
|
|
75
|
+
The default configuration path is `~/.config/mcpfreecad.conf`.
|
|
76
|
+
|
|
77
|
+
Example configuration:
|
|
78
|
+
|
|
79
|
+
```json
|
|
80
|
+
{
|
|
81
|
+
"mode": "remotehttp",
|
|
82
|
+
"logging": {
|
|
83
|
+
"level": "INFO"
|
|
84
|
+
},
|
|
85
|
+
"bridge": {
|
|
86
|
+
"host": "127.0.0.1",
|
|
87
|
+
"port": 48111,
|
|
88
|
+
"token": "change-me",
|
|
89
|
+
"timeout_seconds": 30.0
|
|
90
|
+
},
|
|
91
|
+
"remote_server": {
|
|
92
|
+
"transport": {
|
|
93
|
+
"uds": "/var/run/mcpfreecad.sock"
|
|
94
|
+
},
|
|
95
|
+
"url_prefix": "https://mcp.example.com/freecad/"
|
|
96
|
+
},
|
|
97
|
+
"stdio": {
|
|
98
|
+
"library_root": "/srv/mcpfreecad/stdio-library",
|
|
99
|
+
"allow_code_execution": true,
|
|
100
|
+
"allow_library_write": true,
|
|
101
|
+
"allow_snapshots": true
|
|
102
|
+
},
|
|
103
|
+
"api_keys": [
|
|
104
|
+
{
|
|
105
|
+
"id": "cad-agent",
|
|
106
|
+
"kdf": {
|
|
107
|
+
"algorithm": "argon2id",
|
|
108
|
+
"salt": "BASE64",
|
|
109
|
+
"time_cost": 3,
|
|
110
|
+
"memory_cost": 65536,
|
|
111
|
+
"parallelism": 1,
|
|
112
|
+
"hash_len": 32,
|
|
113
|
+
"hash": "BASE64"
|
|
114
|
+
},
|
|
115
|
+
"library_root": "/srv/mcpfreecad/cad-agent-library",
|
|
116
|
+
"allow_code_execution": true,
|
|
117
|
+
"allow_library_write": true,
|
|
118
|
+
"allow_snapshots": true
|
|
119
|
+
}
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Generate or rotate a remote API key:
|
|
125
|
+
|
|
126
|
+
```sh
|
|
127
|
+
mcpfreecad --config ~/.config/mcpfreecad.conf --genkey cad-agent
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Running
|
|
131
|
+
|
|
132
|
+
StdIO mode:
|
|
133
|
+
|
|
134
|
+
```sh
|
|
135
|
+
mcpfreecad --config ~/.config/mcpfreecad.conf
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Remote HTTP mode:
|
|
139
|
+
|
|
140
|
+
```sh
|
|
141
|
+
mcpfreecad --config ~/.config/mcpfreecad.conf --transport remotehttp
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
The remote HTTP wrapper accepts:
|
|
145
|
+
|
|
146
|
+
- `Authorization: Bearer <token>`
|
|
147
|
+
- `X-API-Key: <token>`
|
|
148
|
+
- `?mcp=<token>`
|
|
149
|
+
- legacy `?api_key=<token>`
|
|
150
|
+
|
|
151
|
+
`/status` is intentionally public so it can be used for health checks.
|
|
152
|
+
|
|
153
|
+
## Reverse Proxy Notes
|
|
154
|
+
|
|
155
|
+
The FastMCP instance is created with:
|
|
156
|
+
|
|
157
|
+
```python
|
|
158
|
+
TransportSecuritySettings(enable_dns_rebinding_protection=False)
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
That is intentional for reverse-proxy deployments.
|
|
162
|
+
|
|
163
|
+
Example Apache layout:
|
|
164
|
+
|
|
165
|
+
```apache
|
|
166
|
+
ProxyPass /freecad/status http://127.0.0.1:18080/status
|
|
167
|
+
ProxyPassReverse /freecad/status http://127.0.0.1:18080/status
|
|
168
|
+
|
|
169
|
+
ProxyPass /freecad/mcp/ http://127.0.0.1:18080/mcp/
|
|
170
|
+
ProxyPassReverse /freecad/mcp/ http://127.0.0.1:18080/mcp/
|
|
171
|
+
|
|
172
|
+
ProxyPass /freecad/snapshots/ http://127.0.0.1:18080/snapshots/
|
|
173
|
+
ProxyPassReverse /freecad/snapshots/ http://127.0.0.1:18080/snapshots/
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
When `remote_server.url_prefix` is configured, snapshot download URLs are returned as absolute URLs rooted there. Otherwise they fall back to relative `../snapshots/...` paths.
|
|
177
|
+
|
|
178
|
+
## Snapshot Retrieval
|
|
179
|
+
|
|
180
|
+
`capture_snapshot(...)` returns:
|
|
181
|
+
|
|
182
|
+
- `snapshot_id`
|
|
183
|
+
- `download_url`
|
|
184
|
+
- `download_url_with_token`
|
|
185
|
+
|
|
186
|
+
`download_url` requires normal MCP auth again.
|
|
187
|
+
|
|
188
|
+
`download_url_with_token` is an easier direct-fetch URL for clients that cannot conveniently resend MCP auth. It contains a random in-memory token and returns `image/png`.
|
|
189
|
+
|
|
190
|
+
You can also retrieve a registered snapshot inline through:
|
|
191
|
+
|
|
192
|
+
```text
|
|
193
|
+
get_snapshot_base64(snapshot_id="...")
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
Snapshots are exposed only if they were created through `capture_snapshot(...)`. Arbitrary server files are not downloadable through the snapshot route.
|
|
197
|
+
|
|
198
|
+
## FreeBSD rc.d Service
|
|
199
|
+
|
|
200
|
+
A sample rc.d script is included at `freebsd/rc.d/mcpfreecad`.
|
|
201
|
+
|
|
202
|
+
Install it as:
|
|
203
|
+
|
|
204
|
+
```sh
|
|
205
|
+
install -m 0555 freebsd/rc.d/mcpfreecad /usr/local/etc/rc.d/mcpfreecad
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Default `rc.conf` settings:
|
|
209
|
+
|
|
210
|
+
```sh
|
|
211
|
+
mcpfreecad_enable="YES"
|
|
212
|
+
mcpfreecad_config="/usr/local/etc/mcpfreecad.conf"
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Optional overrides:
|
|
216
|
+
|
|
217
|
+
```sh
|
|
218
|
+
mcpfreecad_daemon_user="mcpfreecad"
|
|
219
|
+
mcpfreecad_command="/usr/local/bin/mcpfreecad"
|
|
220
|
+
mcpfreecad_transport="remotehttp"
|
|
221
|
+
mcpfreecad_flags=""
|
|
222
|
+
mcpfreecad_pidfile="/var/run/mcpfreecad.pid"
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
## Optional Workbenches
|
|
226
|
+
|
|
227
|
+
`mcpfreecad` only surfaces optional workbench tools when the corresponding workbench is available on the host. This currently includes support for areas such as:
|
|
228
|
+
|
|
229
|
+
- `freecad.gears`
|
|
230
|
+
- Fasteners
|
|
231
|
+
- Curves
|
|
232
|
+
- A2plus
|
|
233
|
+
|
|
234
|
+
## Repository Layout
|
|
235
|
+
|
|
236
|
+
- `mcpfreecad/`: package source
|
|
237
|
+
- `examples/`: bridge loader and smoke examples
|
|
238
|
+
- `freebsd/`: FreeBSD service helper
|
|
239
|
+
- `tests/`: automated test suite
|
|
240
|
+
- `skill/`: Codex skill material
|
|
241
|
+
|
|
242
|
+
## Testing
|
|
243
|
+
|
|
244
|
+
Run the Python test suite with:
|
|
245
|
+
|
|
246
|
+
```sh
|
|
247
|
+
pytest -q
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
For bridge-side smoke testing from a checkout:
|
|
251
|
+
|
|
252
|
+
```sh
|
|
253
|
+
python3 examples/freecad_bridge_smoke.py
|
|
254
|
+
python3 examples/freecad_bridge_smoke.py --with-fasteners
|
|
255
|
+
```
|
|
256
|
+
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
# FreeCAD MCP Server `mcpfreecad`
|
|
2
|
+
|
|
3
|
+
`mcpfreecad` is an MCP server for driving a running FreeCAD session. It exposes document management, modeling, inspection, snapshot, and optional workbench operations to MCP clients over `stdio` or authenticated remote HTTP.
|
|
4
|
+
|
|
5
|
+
The server is designed around a small Python bridge that is loaded into FreeCAD's embedded interpreter. The MCP process then talks to that bridge over localhost.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- `stdio` and API-key authenticated `remotehttp` transports
|
|
10
|
+
- document lifecycle tools for opening, saving, closing, and enumerating FreeCAD documents
|
|
11
|
+
- explicit model inspection via document tree, topology, sketch status, and sketch details tools
|
|
12
|
+
- modeling support for Part primitives, PartDesign bodies/pads/pockets, spreadsheets, Draft arrays, and snapshots
|
|
13
|
+
- reusable object library backed by BREP plus JSON metadata
|
|
14
|
+
- optional workbench integration for helpers such as `freecad.gears`, Fasteners, Curves sketch-on-surface workflows, and A2plus assembly operations when available
|
|
15
|
+
- remote snapshot retrieval through authenticated URLs or tokenized snapshot download URLs
|
|
16
|
+
|
|
17
|
+
For LLM-facing operating guidance, see `LLM_USAGE.md`.
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
Install from PyPI:
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
pip install mcpfreecad
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
To enable remote HTTP mode:
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
pip install "mcpfreecad[remote]"
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
For local development:
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
git clone <repository-url>
|
|
37
|
+
cd mcpFreeCAD
|
|
38
|
+
pip install -e .
|
|
39
|
+
pip install -e ".[remote]"
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Quick Start
|
|
43
|
+
|
|
44
|
+
1. Start FreeCAD.
|
|
45
|
+
2. Load the bridge module inside the FreeCAD Python console.
|
|
46
|
+
3. Start `mcpfreecad` in `stdio` mode or `remotehttp` mode.
|
|
47
|
+
4. Connect your MCP client and call `bridge_status`.
|
|
48
|
+
|
|
49
|
+
Example bridge loading from a checkout:
|
|
50
|
+
|
|
51
|
+
```python
|
|
52
|
+
exec(open("/path/to/mcpFreeCAD/examples/freecad_bridge_loader.py").read(), globals(), globals())
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The loader starts the bridge on `127.0.0.1:48111` with token `change-me`. Adjust the example or call `start_bridge_server(...)` directly if you need different values.
|
|
56
|
+
|
|
57
|
+
## Configuration
|
|
58
|
+
|
|
59
|
+
The default configuration path is `~/.config/mcpfreecad.conf`.
|
|
60
|
+
|
|
61
|
+
Example configuration:
|
|
62
|
+
|
|
63
|
+
```json
|
|
64
|
+
{
|
|
65
|
+
"mode": "remotehttp",
|
|
66
|
+
"logging": {
|
|
67
|
+
"level": "INFO"
|
|
68
|
+
},
|
|
69
|
+
"bridge": {
|
|
70
|
+
"host": "127.0.0.1",
|
|
71
|
+
"port": 48111,
|
|
72
|
+
"token": "change-me",
|
|
73
|
+
"timeout_seconds": 30.0
|
|
74
|
+
},
|
|
75
|
+
"remote_server": {
|
|
76
|
+
"transport": {
|
|
77
|
+
"uds": "/var/run/mcpfreecad.sock"
|
|
78
|
+
},
|
|
79
|
+
"url_prefix": "https://mcp.example.com/freecad/"
|
|
80
|
+
},
|
|
81
|
+
"stdio": {
|
|
82
|
+
"library_root": "/srv/mcpfreecad/stdio-library",
|
|
83
|
+
"allow_code_execution": true,
|
|
84
|
+
"allow_library_write": true,
|
|
85
|
+
"allow_snapshots": true
|
|
86
|
+
},
|
|
87
|
+
"api_keys": [
|
|
88
|
+
{
|
|
89
|
+
"id": "cad-agent",
|
|
90
|
+
"kdf": {
|
|
91
|
+
"algorithm": "argon2id",
|
|
92
|
+
"salt": "BASE64",
|
|
93
|
+
"time_cost": 3,
|
|
94
|
+
"memory_cost": 65536,
|
|
95
|
+
"parallelism": 1,
|
|
96
|
+
"hash_len": 32,
|
|
97
|
+
"hash": "BASE64"
|
|
98
|
+
},
|
|
99
|
+
"library_root": "/srv/mcpfreecad/cad-agent-library",
|
|
100
|
+
"allow_code_execution": true,
|
|
101
|
+
"allow_library_write": true,
|
|
102
|
+
"allow_snapshots": true
|
|
103
|
+
}
|
|
104
|
+
]
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Generate or rotate a remote API key:
|
|
109
|
+
|
|
110
|
+
```sh
|
|
111
|
+
mcpfreecad --config ~/.config/mcpfreecad.conf --genkey cad-agent
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Running
|
|
115
|
+
|
|
116
|
+
StdIO mode:
|
|
117
|
+
|
|
118
|
+
```sh
|
|
119
|
+
mcpfreecad --config ~/.config/mcpfreecad.conf
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Remote HTTP mode:
|
|
123
|
+
|
|
124
|
+
```sh
|
|
125
|
+
mcpfreecad --config ~/.config/mcpfreecad.conf --transport remotehttp
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
The remote HTTP wrapper accepts:
|
|
129
|
+
|
|
130
|
+
- `Authorization: Bearer <token>`
|
|
131
|
+
- `X-API-Key: <token>`
|
|
132
|
+
- `?mcp=<token>`
|
|
133
|
+
- legacy `?api_key=<token>`
|
|
134
|
+
|
|
135
|
+
`/status` is intentionally public so it can be used for health checks.
|
|
136
|
+
|
|
137
|
+
## Reverse Proxy Notes
|
|
138
|
+
|
|
139
|
+
The FastMCP instance is created with:
|
|
140
|
+
|
|
141
|
+
```python
|
|
142
|
+
TransportSecuritySettings(enable_dns_rebinding_protection=False)
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
That is intentional for reverse-proxy deployments.
|
|
146
|
+
|
|
147
|
+
Example Apache layout:
|
|
148
|
+
|
|
149
|
+
```apache
|
|
150
|
+
ProxyPass /freecad/status http://127.0.0.1:18080/status
|
|
151
|
+
ProxyPassReverse /freecad/status http://127.0.0.1:18080/status
|
|
152
|
+
|
|
153
|
+
ProxyPass /freecad/mcp/ http://127.0.0.1:18080/mcp/
|
|
154
|
+
ProxyPassReverse /freecad/mcp/ http://127.0.0.1:18080/mcp/
|
|
155
|
+
|
|
156
|
+
ProxyPass /freecad/snapshots/ http://127.0.0.1:18080/snapshots/
|
|
157
|
+
ProxyPassReverse /freecad/snapshots/ http://127.0.0.1:18080/snapshots/
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
When `remote_server.url_prefix` is configured, snapshot download URLs are returned as absolute URLs rooted there. Otherwise they fall back to relative `../snapshots/...` paths.
|
|
161
|
+
|
|
162
|
+
## Snapshot Retrieval
|
|
163
|
+
|
|
164
|
+
`capture_snapshot(...)` returns:
|
|
165
|
+
|
|
166
|
+
- `snapshot_id`
|
|
167
|
+
- `download_url`
|
|
168
|
+
- `download_url_with_token`
|
|
169
|
+
|
|
170
|
+
`download_url` requires normal MCP auth again.
|
|
171
|
+
|
|
172
|
+
`download_url_with_token` is an easier direct-fetch URL for clients that cannot conveniently resend MCP auth. It contains a random in-memory token and returns `image/png`.
|
|
173
|
+
|
|
174
|
+
You can also retrieve a registered snapshot inline through:
|
|
175
|
+
|
|
176
|
+
```text
|
|
177
|
+
get_snapshot_base64(snapshot_id="...")
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Snapshots are exposed only if they were created through `capture_snapshot(...)`. Arbitrary server files are not downloadable through the snapshot route.
|
|
181
|
+
|
|
182
|
+
## FreeBSD rc.d Service
|
|
183
|
+
|
|
184
|
+
A sample rc.d script is included at `freebsd/rc.d/mcpfreecad`.
|
|
185
|
+
|
|
186
|
+
Install it as:
|
|
187
|
+
|
|
188
|
+
```sh
|
|
189
|
+
install -m 0555 freebsd/rc.d/mcpfreecad /usr/local/etc/rc.d/mcpfreecad
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Default `rc.conf` settings:
|
|
193
|
+
|
|
194
|
+
```sh
|
|
195
|
+
mcpfreecad_enable="YES"
|
|
196
|
+
mcpfreecad_config="/usr/local/etc/mcpfreecad.conf"
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Optional overrides:
|
|
200
|
+
|
|
201
|
+
```sh
|
|
202
|
+
mcpfreecad_daemon_user="mcpfreecad"
|
|
203
|
+
mcpfreecad_command="/usr/local/bin/mcpfreecad"
|
|
204
|
+
mcpfreecad_transport="remotehttp"
|
|
205
|
+
mcpfreecad_flags=""
|
|
206
|
+
mcpfreecad_pidfile="/var/run/mcpfreecad.pid"
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## Optional Workbenches
|
|
210
|
+
|
|
211
|
+
`mcpfreecad` only surfaces optional workbench tools when the corresponding workbench is available on the host. This currently includes support for areas such as:
|
|
212
|
+
|
|
213
|
+
- `freecad.gears`
|
|
214
|
+
- Fasteners
|
|
215
|
+
- Curves
|
|
216
|
+
- A2plus
|
|
217
|
+
|
|
218
|
+
## Repository Layout
|
|
219
|
+
|
|
220
|
+
- `mcpfreecad/`: package source
|
|
221
|
+
- `examples/`: bridge loader and smoke examples
|
|
222
|
+
- `freebsd/`: FreeBSD service helper
|
|
223
|
+
- `tests/`: automated test suite
|
|
224
|
+
- `skill/`: Codex skill material
|
|
225
|
+
|
|
226
|
+
## Testing
|
|
227
|
+
|
|
228
|
+
Run the Python test suite with:
|
|
229
|
+
|
|
230
|
+
```sh
|
|
231
|
+
pytest -q
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
For bridge-side smoke testing from a checkout:
|
|
235
|
+
|
|
236
|
+
```sh
|
|
237
|
+
python3 examples/freecad_bridge_smoke.py
|
|
238
|
+
python3 examples/freecad_bridge_smoke.py --with-fasteners
|
|
239
|
+
```
|
|
240
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Application entrypoints for mcpfreecad."""
|