mcpBlender-tspspi 0.0.2__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.
Files changed (71) hide show
  1. mcpblender_tspspi-0.0.2/MANIFEST.in +6 -0
  2. mcpblender_tspspi-0.0.2/PKG-INFO +15 -0
  3. mcpblender_tspspi-0.0.2/README.md +267 -0
  4. mcpblender_tspspi-0.0.2/TODO.md +22 -0
  5. mcpblender_tspspi-0.0.2/USER_MANUAL.md +730 -0
  6. mcpblender_tspspi-0.0.2/VALIDATION.md +432 -0
  7. mcpblender_tspspi-0.0.2/docs/DEPLOYMENT.md +94 -0
  8. mcpblender_tspspi-0.0.2/docs/PUBLICATION_REVIEW.md +37 -0
  9. mcpblender_tspspi-0.0.2/examples/apache.conf +9 -0
  10. mcpblender_tspspi-0.0.2/examples/mcpblender.conf +53 -0
  11. mcpblender_tspspi-0.0.2/examples/rc.d/mcpblender +54 -0
  12. mcpblender_tspspi-0.0.2/mcpBlender_tspspi.egg-info/PKG-INFO +15 -0
  13. mcpblender_tspspi-0.0.2/mcpBlender_tspspi.egg-info/SOURCES.txt +69 -0
  14. mcpblender_tspspi-0.0.2/mcpBlender_tspspi.egg-info/dependency_links.txt +1 -0
  15. mcpblender_tspspi-0.0.2/mcpBlender_tspspi.egg-info/entry_points.txt +2 -0
  16. mcpblender_tspspi-0.0.2/mcpBlender_tspspi.egg-info/requires.txt +11 -0
  17. mcpblender_tspspi-0.0.2/mcpBlender_tspspi.egg-info/top_level.txt +1 -0
  18. mcpblender_tspspi-0.0.2/mcpblender/__init__.py +19 -0
  19. mcpblender_tspspi-0.0.2/mcpblender/action_contracts.py +12 -0
  20. mcpblender_tspspi-0.0.2/mcpblender/actions.py +175 -0
  21. mcpblender_tspspi-0.0.2/mcpblender/blender/__init__.py +1 -0
  22. mcpblender_tspspi-0.0.2/mcpblender/blender/actions.py +96 -0
  23. mcpblender_tspspi-0.0.2/mcpblender/blender/addon.py +57 -0
  24. mcpblender_tspspi-0.0.2/mcpblender/blender/assets.py +358 -0
  25. mcpblender_tspspi-0.0.2/mcpblender/blender/bootstrap.py +38 -0
  26. mcpblender_tspspi-0.0.2/mcpblender/blender/bridge.py +463 -0
  27. mcpblender_tspspi-0.0.2/mcpblender/blender/domains.py +317 -0
  28. mcpblender_tspspi-0.0.2/mcpblender/blender/morphs.py +497 -0
  29. mcpblender_tspspi-0.0.2/mcpblender/blender/rigging.py +456 -0
  30. mcpblender_tspspi-0.0.2/mcpblender/blender/shaders.py +324 -0
  31. mcpblender_tspspi-0.0.2/mcpblender/blender/workflows.py +236 -0
  32. mcpblender_tspspi-0.0.2/mcpblender/broker.py +480 -0
  33. mcpblender_tspspi-0.0.2/mcpblender/commands.py +595 -0
  34. mcpblender_tspspi-0.0.2/mcpblender/config.py +166 -0
  35. mcpblender_tspspi-0.0.2/mcpblender/launcher.py +119 -0
  36. mcpblender_tspspi-0.0.2/mcpblender/morph_commands.py +144 -0
  37. mcpblender_tspspi-0.0.2/mcpblender/network.py +96 -0
  38. mcpblender_tspspi-0.0.2/mcpblender/persistence.py +65 -0
  39. mcpblender_tspspi-0.0.2/mcpblender/retention.py +307 -0
  40. mcpblender_tspspi-0.0.2/mcpblender/server.py +734 -0
  41. mcpblender_tspspi-0.0.2/mcpblender/shader_contracts.py +155 -0
  42. mcpblender_tspspi-0.0.2/mcpblender/storage.py +58 -0
  43. mcpblender_tspspi-0.0.2/mcpblender/wire.py +93 -0
  44. mcpblender_tspspi-0.0.2/mcpblender/workflows.py +58 -0
  45. mcpblender_tspspi-0.0.2/pyproject.toml +35 -0
  46. mcpblender_tspspi-0.0.2/setup.cfg +4 -0
  47. mcpblender_tspspi-0.0.2/skill/blender-mcp-animation/SKILL.md +117 -0
  48. mcpblender_tspspi-0.0.2/skill/blender-mcp-design/SKILL.md +123 -0
  49. mcpblender_tspspi-0.0.2/skill/blender-mcp-render/SKILL.md +91 -0
  50. mcpblender_tspspi-0.0.2/tests/test_action_integration.py +379 -0
  51. mcpblender_tspspi-0.0.2/tests/test_actions.py +170 -0
  52. mcpblender_tspspi-0.0.2/tests/test_animation_contracts.py +57 -0
  53. mcpblender_tspspi-0.0.2/tests/test_asset_contracts.py +40 -0
  54. mcpblender_tspspi-0.0.2/tests/test_asset_editing.py +253 -0
  55. mcpblender_tspspi-0.0.2/tests/test_blender_integration.py +401 -0
  56. mcpblender_tspspi-0.0.2/tests/test_broker_startup.py +84 -0
  57. mcpblender_tspspi-0.0.2/tests/test_building_workflow.py +27 -0
  58. mcpblender_tspspi-0.0.2/tests/test_morph_contracts.py +60 -0
  59. mcpblender_tspspi-0.0.2/tests/test_operations.py +107 -0
  60. mcpblender_tspspi-0.0.2/tests/test_retention.py +191 -0
  61. mcpblender_tspspi-0.0.2/tests/test_retention_integration.py +45 -0
  62. mcpblender_tspspi-0.0.2/tests/test_server.py +137 -0
  63. mcpblender_tspspi-0.0.2/tests/test_shader_contracts.py +35 -0
  64. mcpblender_tspspi-0.0.2/tests/test_shaders.py +103 -0
  65. mcpblender_tspspi-0.0.2/tests/test_shape_keys.py +356 -0
  66. mcpblender_tspspi-0.0.2/tests/test_skeletal_animation.py +297 -0
  67. mcpblender_tspspi-0.0.2/tests/test_storage.py +40 -0
  68. mcpblender_tspspi-0.0.2/tests/test_wire.py +65 -0
  69. mcpblender_tspspi-0.0.2/tools/building_workflow.py +296 -0
  70. mcpblender_tspspi-0.0.2/tools/gui_smoke.py +76 -0
  71. mcpblender_tspspi-0.0.2/tools/install_skills.py +52 -0
@@ -0,0 +1,6 @@
1
+ include README.md USER_MANUAL.md VALIDATION.md TODO.md
2
+ recursive-include examples *.conf
3
+ recursive-include examples/rc.d *
4
+ recursive-include docs *.md
5
+ recursive-include skill SKILL.md
6
+ recursive-include tools *.py
@@ -0,0 +1,15 @@
1
+ Metadata-Version: 2.4
2
+ Name: mcpBlender-tspspi
3
+ Version: 0.0.2
4
+ Summary: Authenticated MCP control of live Blender sessions over private Unix sockets
5
+ Author-email: Thomas Spielauer <pypipackages01@tspi.at>
6
+ Requires-Python: >=3.11
7
+ Requires-Dist: fastmcp<5,>=4
8
+ Requires-Dist: pydantic<3,>=2.5
9
+ Requires-Dist: argon2-cffi>=23.1
10
+ Provides-Extra: remote
11
+ Requires-Dist: fastapi>=0.110; extra == "remote"
12
+ Requires-Dist: uvicorn>=0.24; extra == "remote"
13
+ Provides-Extra: test
14
+ Requires-Dist: pytest>=8; extra == "test"
15
+ Requires-Dist: httpx>=0.27; extra == "test"
@@ -0,0 +1,267 @@
1
+ # Blender MCP Server `mcpblender`
2
+
3
+ `mcpblender` is an MCP server for creating, inspecting, editing, animating,
4
+ rendering and exporting Blender scenes. It connects coding agents to a locally
5
+ installed Blender through a private Unix domain socket. Typed tools cover the
6
+ usual workflows; optional Python execution exposes the rest of Blender's API.
7
+ Blender does **not** need rebuilding.
8
+
9
+ __WORK IN PROGRESS — 0.2 implementation__
10
+
11
+ The main workflows are animation production, game/simulation asset modeling and
12
+ model visualization. Structured editing, textured materials, skeletal and morph
13
+ animation, rendering, video assembly and recovery are implemented and live-tested
14
+ on FreeBSD with Blender 5.0.1. Other Blender versions and platforms remain
15
+ unqualified. See [VALIDATION.md](VALIDATION.md) for the tested scope and limits.
16
+
17
+ The Python distribution is named **`mcpBlender-tspspi`**; the import package and
18
+ command are `mcpblender`. This is a separate implementation, without exact tool
19
+ compatibility with other Blender MCP servers.
20
+
21
+ ## Features
22
+
23
+ - scene and object inspection, mesh creation, modifiers, UV generation,
24
+ duplication, parenting, transforms and explicit asset preparation
25
+ - structured shader graphs, reusable PBR/glass/emission material presets,
26
+ packed image textures and material assignment
27
+ - lighting, cameras, fitted preview stages, viewport screenshots and still renders
28
+ - keyframes, skeletal rigs and clips, relative shape keys, deformation sampling,
29
+ frame sequences and animation previews
30
+ - Blender video sequence editing and video output, subject to installed FFmpeg
31
+ support
32
+ - project save/open, local GLB/glTF, OBJ and STL import, GLB export, and configured
33
+ external asset/API adapters
34
+ - validated named actions and operator-defined recipes for repeated workflows
35
+ - stdio MCP and authenticated Streamable HTTP with mcpFreeCAD-style API-key policies
36
+ - managed GUI/headless Blender startup, automatic reconnects, checkpoints and
37
+ crash recovery without automatic replay of interrupted edits
38
+ - multiple clients sharing one Blender session, durable operation tracking,
39
+ free-space feedback and scoped temporary-output retention
40
+ - repository-owned [coding-agent skills](#skills) for design, rendering and animation
41
+
42
+ ## Installation
43
+
44
+ Requires Python 3.11+, Blender 4.5+ and a Unix system with same-user socket peer
45
+ checks (`getpeereid` or `SO_PEERCRED`). Live qualification currently covers only
46
+ FreeBSD Blender 5.0.1.
47
+
48
+ Install from this checkout in a Python environment containing the declared
49
+ dependencies:
50
+
51
+ ```sh
52
+ pip install -e .
53
+ ```
54
+
55
+ For remote HTTP mode, install its optional dependencies as well:
56
+
57
+ ```sh
58
+ pip install -e ".[remote]"
59
+ ```
60
+
61
+ Neither command rebuilds Blender, installs a Blender add-on, creates configuration,
62
+ installs skills or enables a service. MCP dependencies run outside Blender; the
63
+ Blender bridge uses `bpy` and Python's standard library.
64
+
65
+ For a wheel-based runtime and persistent FreeBSD service, see
66
+ [persistent installation](docs/DEPLOYMENT.md).
67
+
68
+ ## Quick Start
69
+
70
+ 1. Create a private configuration and set its `stdio.library_root` to a directory
71
+ you control. Set `launch.executable` if Blender is not on the server's PATH:
72
+
73
+ ```sh
74
+ mcpblender --config ./mcpblender.conf --init-config
75
+ ```
76
+
77
+ 2. Start the stdio MCP server:
78
+
79
+ ```sh
80
+ mcpblender --config ./mcpblender.conf
81
+ ```
82
+
83
+ 3. From an MCP client, call `start_blender`, then `bridge_status` and
84
+ `get_scene_info`. Create an object with `create_primitive`, for example:
85
+
86
+ ```json
87
+ {"params": {"name": "Building", "kind": "CUBE", "scale": [2, 1, 1.5]}}
88
+ ```
89
+
90
+ 4. Apply a material, set up a camera and lights with `preview_setup` through
91
+ `run_action`, and submit `render_still`. Poll `get_job`, then use `get_image`
92
+ to inspect the rendered artifact. Domain-tool arguments go inside `params`;
93
+ named actions take `action` and `inputs` directly.
94
+
95
+ The MCP server can start without Blender running. With `launch.auto_start=true`,
96
+ the first operation needing Blender also starts it lazily. Default startup opens
97
+ a fresh GUI with factory settings, script auto-execution disabled and the bridge
98
+ bootstrapped. The welcome splash is disabled for that session; user preferences
99
+ are not saved or overwritten. Use `start_blender(background=true)` for headless
100
+ work; viewport screenshots require a GUI.
101
+
102
+ For complete workflows and tool arguments, see [USER_MANUAL.md](USER_MANUAL.md).
103
+
104
+ ## Configuration
105
+
106
+ The default configuration path is `~/.config/mcpblender.conf`. Create it explicitly
107
+ with `--init-config`, or copy [examples/mcpblender.conf](examples/mcpblender.conf).
108
+ The server does not create configuration during ordinary startup.
109
+
110
+ The JSON configuration separates the local bridge, application launch settings,
111
+ stdio policy, HTTP listener and API-key policies. A typical local configuration
112
+ uses this structure:
113
+
114
+ ```json
115
+ {
116
+ "mode": "stdio",
117
+ "bridge": {
118
+ "socket_path": "~/.local/state/mcpblender/bridge.sock",
119
+ "timeout_seconds": 120
120
+ },
121
+ "launch": {
122
+ "executable": "blender",
123
+ "background": false,
124
+ "auto_start": true,
125
+ "auto_recover": true
126
+ },
127
+ "stdio": {
128
+ "library_root": "~/blender-mcp-library",
129
+ "allow_code_execution": false
130
+ }
131
+ }
132
+ ```
133
+
134
+ This example selects structured-only editing. Generated defaults allow Python
135
+ execution; set `allow_code_execution=false` in each relevant policy to disable it.
136
+ Python execution has Blender's full OS permissions and is not sandboxed by
137
+ `library_root`. Structured file tools confine their entry paths to the active
138
+ library; Blender may resolve linked dependencies when loading projects or assets.
139
+
140
+ The bridge directory belongs to the desktop account with mode `0700`; its socket
141
+ is `0600` and verifies peer identity. It has no network listener or bridge token.
142
+ All clients share one Blender scene; API keys do not create separate applications.
143
+
144
+ For HTTP, use `remote_server.host="127.0.0.1"` and port `18081`, then generate a
145
+ key explicitly:
146
+
147
+ ```sh
148
+ mcpblender --config ./mcpblender.conf --genkey design-agent
149
+ ```
150
+
151
+ The command prints the key once and stores only its salted Argon2id verifier.
152
+ Each key has its own policy and library root. Keep actual configurations and keys
153
+ outside Git. If copying the example, replace its placeholder
154
+ `remote_server.url_prefix` with the deployed base URL, or set it to `null`.
155
+
156
+ ## Connecting with Agents
157
+
158
+ ### Codex example (stdio)
159
+
160
+ Adjust the executable and configuration paths for your installation:
161
+
162
+ ```toml
163
+ [mcp_servers.mcpblender]
164
+ command = "mcpblender"
165
+ args = ["--config", "/path/to/mcpblender.conf", "--transport", "stdio"]
166
+ startup_timeout_sec = 60
167
+ tool_timeout_sec = 120
168
+ ```
169
+
170
+ ### Codex example (remote HTTP)
171
+
172
+ ```toml
173
+ [mcp_servers.mcpblender]
174
+ url = "http://127.0.0.1:18081/mcp/?api_key=<MCPBLENDER_API_KEY>"
175
+ startup_timeout_sec = 60
176
+ tool_timeout_sec = 120
177
+ ```
178
+
179
+ ### PQC example (remote HTTP)
180
+
181
+ Enable MCP in the PQC instance and add this entry beneath `mcp.servers`:
182
+
183
+ ```json
184
+ {
185
+ "mcpblender": {
186
+ "enabled": true,
187
+ "transport": "http",
188
+ "url": "http://127.0.0.1:18081/mcp/",
189
+ "auth": {
190
+ "mode": "query_param",
191
+ "token": "<MCPBLENDER_API_KEY>",
192
+ "param_name": "api_key"
193
+ },
194
+ "policy": {
195
+ "enabled": true,
196
+ "visible_by_default": true,
197
+ "network_classification": "local"
198
+ }
199
+ }
200
+ }
201
+ ```
202
+
203
+ Use separate issued keys for separate clients. Reload the clients after changing
204
+ connections. For long-running work, request asynchronous execution and poll the
205
+ operation ID instead of holding one synchronous call open indefinitely.
206
+
207
+ ### FreeBSD service
208
+
209
+ The service is not installed or enabled automatically. The repository includes an
210
+ [rc.d template](examples/rc.d/mcpblender) for a supervised HTTP frontend running
211
+ under the desktop account. See [the deployment guide](docs/DEPLOYMENT.md) for
212
+ runtime installation, boot configuration, graphical-session access and private logs.
213
+
214
+ ## Running
215
+
216
+ Run stdio MCP mode:
217
+
218
+ ```sh
219
+ mcpblender --config ./mcpblender.conf --transport stdio
220
+ ```
221
+
222
+ Run authenticated Streamable HTTP mode:
223
+
224
+ ```sh
225
+ mcpblender --config ./mcpblender.conf --transport remotehttp
226
+ ```
227
+
228
+ HTTP mode requires an issued key. Authentication accepts `Authorization: Bearer`,
229
+ `X-API-Key`, `?mcp=` or `?api_key=`. `/status` is a public frontend health check;
230
+ `/mcp/` requires authentication. Keep query strings out of proxy access logs.
231
+ For TLS proxy configuration, see [examples/apache.conf](examples/apache.conf).
232
+
233
+ Use `shutdown_blender` to close the application; it requires saving or explicitly
234
+ discarding unsaved edits. Ordinary frontend disconnection leaves Blender running.
235
+ Operations execute serially in Blender, while the broker keeps status available.
236
+ Native rendering can occupy the GUI. Crash recovery restores a completed
237
+ checkpoint and reports interrupted work as uncertain; it does not replay edits.
238
+
239
+ ## Skills
240
+
241
+ - [blender-mcp-design](skill/blender-mcp-design/SKILL.md): modeling, inspection and asset preparation
242
+ - [blender-mcp-render](skill/blender-mcp-render/SKILL.md): materials, lighting, cameras and image review
243
+ - [blender-mcp-animation](skill/blender-mcp-animation/SKILL.md): animation, frame sequences and video delivery
244
+
245
+ Install the bundled skills explicitly, without overwriting existing directories:
246
+
247
+ ```sh
248
+ python3 tools/install_skills.py --client codex --dest "$HOME/.codex/skills"
249
+ python3 tools/install_skills.py --client pqc --dest "$HOME/.local/share/mcpblender/skills"
250
+ ```
251
+
252
+ For PQC, enable skill discovery and add its destination as a skill root. The
253
+ installer adds the metadata PQC needs while preserving the shared skill bodies.
254
+
255
+ ## Repository Layout
256
+
257
+ - `mcpblender/`: MCP server, policies, launcher, operation broker and Blender bridge
258
+ - `examples/`: configuration, reverse-proxy and FreeBSD service templates
259
+ - `skill/`: coding-agent skills for design, rendering and animation
260
+ - `tools/`: skill installer and representative building/GUI workflow fixtures
261
+ - `tests/`: contract, transport, retention and real-Blender integration tests
262
+ - `USER_MANUAL.md`: detailed operator and MCP-client workflows
263
+ - `docs/DEPLOYMENT.md`: persistent installation and client setup
264
+ - `VALIDATION.md`: test commands, evidence and qualification limits
265
+
266
+ For development checks, install `.[test]` and run `python3 -m pytest -q`. Set
267
+ `MCPBLENDER_TEST_BLENDER=1` to include disposable real-Blender integration tests.
@@ -0,0 +1,22 @@
1
+ # Follow-up work
2
+
3
+ Primary workflows: animation production; game/simulation asset modeling; model
4
+ visualization. Deployment follows qualification of the needed core workflows.
5
+
6
+ - Add representative physics-bake fixtures when selected. Small skeletal and
7
+ relative morph fixtures and structured clip tools are now qualified; see
8
+ VALIDATION.md for their scope and evidence.
9
+ - Verify GLB import in the resumed Godot project: units, axes, UVs/textures, animation
10
+ clips, shader fidelity and collision needs. Export alone is insufficient.
11
+ - Expand evaluated topology, UV and deformation helpers to more varied assets and
12
+ larger workloads; the first structured asset/rig workflows are qualified.
13
+ - Qualify concrete external generation/diffusion services when endpoints are chosen.
14
+ Generic authenticated JSON/download/upload adapters are implemented; specific
15
+ vendor and multipart protocols remain separate work.
16
+ - Consider background render workers when the GUI must remain responsive. Current
17
+ native rendering occupies Blender while the separate broker remains usable.
18
+ - Qualify more Blender/platform versions; current evidence is FreeBSD Blender 5.0.1.
19
+ - Qualify external HTTPS deployment if public ingress is requested. The local
20
+ authenticated service and client/skill installation have separate qualification.
21
+ - Verify service startup and graphical access after an actual reboot, and qualify
22
+ longer-duration operation and log rotation for permanent use.