paraview-mcp-python 0.1.1__tar.gz → 0.1.3__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.
- {paraview_mcp_python-0.1.1 → paraview_mcp_python-0.1.3}/PKG-INFO +213 -33
- {paraview_mcp_python-0.1.1 → paraview_mcp_python-0.1.3}/README.md +212 -32
- {paraview_mcp_python-0.1.1 → paraview_mcp_python-0.1.3}/bridge/command_handler.py +3 -1
- paraview_mcp_python-0.1.3/bridge/gui_bridge.py +264 -0
- {paraview_mcp_python-0.1.1 → paraview_mcp_python-0.1.3}/bridge/models.py +2 -2
- {paraview_mcp_python-0.1.1 → paraview_mcp_python-0.1.3}/bridge/server.py +13 -0
- {paraview_mcp_python-0.1.1 → paraview_mcp_python-0.1.3}/docs/architecture.md +27 -7
- {paraview_mcp_python-0.1.1 → paraview_mcp_python-0.1.3}/docs/python-execute-design.md +8 -4
- {paraview_mcp_python-0.1.1 → paraview_mcp_python-0.1.3}/pyproject.toml +2 -2
- paraview_mcp_python-0.1.3/scripts/start_paraview_gui_bridge.py +51 -0
- paraview_mcp_python-0.1.3/tests/test_gui_bridge.py +143 -0
- {paraview_mcp_python-0.1.1 → paraview_mcp_python-0.1.3}/.gitignore +0 -0
- {paraview_mcp_python-0.1.1 → paraview_mcp_python-0.1.3}/LICENSE +0 -0
- {paraview_mcp_python-0.1.1 → paraview_mcp_python-0.1.3}/bridge/__init__.py +0 -0
- {paraview_mcp_python-0.1.1 → paraview_mcp_python-0.1.3}/bridge/execution.py +0 -0
- {paraview_mcp_python-0.1.1 → paraview_mcp_python-0.1.3}/scripts/library/color_by.py +0 -0
- {paraview_mcp_python-0.1.1 → paraview_mcp_python-0.1.3}/scripts/library/create_contour.py +0 -0
- {paraview_mcp_python-0.1.1 → paraview_mcp_python-0.1.3}/scripts/library/create_slice.py +0 -0
- {paraview_mcp_python-0.1.1 → paraview_mcp_python-0.1.3}/scripts/library/open_dataset.py +0 -0
- {paraview_mcp_python-0.1.1 → paraview_mcp_python-0.1.3}/scripts/library/reset_camera.py +0 -0
- {paraview_mcp_python-0.1.1 → paraview_mcp_python-0.1.3}/scripts/library/save_screenshot.py +0 -0
- {paraview_mcp_python-0.1.1 → paraview_mcp_python-0.1.3}/scripts/paraview_bridge_request.py +0 -0
- {paraview_mcp_python-0.1.1 → paraview_mcp_python-0.1.3}/scripts/start_paraview_bridge.py +0 -0
- {paraview_mcp_python-0.1.1 → paraview_mcp_python-0.1.3}/src/paraview_mcp_server/__init__.py +0 -0
- {paraview_mcp_python-0.1.1 → paraview_mcp_python-0.1.3}/src/paraview_mcp_server/headless.py +0 -0
- {paraview_mcp_python-0.1.1 → paraview_mcp_python-0.1.3}/src/paraview_mcp_server/server.py +0 -0
- {paraview_mcp_python-0.1.1 → paraview_mcp_python-0.1.3}/tests/__init__.py +0 -0
- {paraview_mcp_python-0.1.1 → paraview_mcp_python-0.1.3}/tests/test_bridge_server.py +0 -0
- {paraview_mcp_python-0.1.1 → paraview_mcp_python-0.1.3}/tests/test_command_handler.py +0 -0
- {paraview_mcp_python-0.1.1 → paraview_mcp_python-0.1.3}/tests/test_protocol.py +0 -0
- {paraview_mcp_python-0.1.1 → paraview_mcp_python-0.1.3}/tests/test_server.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: paraview-mcp-python
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.3
|
|
4
4
|
Summary: MCP server for controlling ParaView via AI assistants
|
|
5
5
|
Project-URL: Homepage, https://github.com/djeada/paraview-mcp-server
|
|
6
6
|
Project-URL: Repository, https://github.com/djeada/paraview-mcp-server
|
|
@@ -31,50 +31,99 @@ Requires-Dist: pytest>=7.0; extra == 'dev'
|
|
|
31
31
|
Requires-Dist: ruff>=0.11; extra == 'dev'
|
|
32
32
|
Description-Content-Type: text/markdown
|
|
33
33
|
|
|
34
|
-
#
|
|
34
|
+
# ParaView MCP Server
|
|
35
35
|
|
|
36
36
|
**Control ParaView with AI assistants through the Model Context Protocol.**
|
|
37
37
|
|
|
38
|
-
`paraview-mcp-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
`paraview-mcp-python` provides an MCP server plus a ParaView-side bridge so
|
|
39
|
+
AI assistants such as Codex CLI and Claude Desktop can inspect a ParaView
|
|
40
|
+
session, open datasets, apply filters, color data, run ParaView Python, and
|
|
41
|
+
export screenshots.
|
|
42
|
+
|
|
43
|
+
The command installed for MCP clients is still:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
paraview-mcp-server
|
|
47
|
+
```
|
|
41
48
|
|
|
42
49
|
---
|
|
43
50
|
|
|
44
|
-
##
|
|
51
|
+
## What Parts Are There?
|
|
52
|
+
|
|
53
|
+
There are three moving pieces:
|
|
45
54
|
|
|
55
|
+
| Part | Runs where | Purpose |
|
|
56
|
+
|---|---|---|
|
|
57
|
+
| **MCP client** | Codex CLI, Claude Desktop, or another MCP host | Starts the MCP server and calls tools. |
|
|
58
|
+
| **MCP server** | Normal Python environment | Speaks MCP over stdio and forwards tool calls to ParaView over TCP. |
|
|
59
|
+
| **ParaView GUI bridge** | Already-open ParaView GUI process | Receives TCP JSON commands and executes `paraview.simple` operations in that live GUI session. |
|
|
60
|
+
|
|
61
|
+
The ParaView bridge is the ParaView-side component. It plays the same role as
|
|
62
|
+
the Blender add-on in `blender-mcp-server`: it must run inside the application
|
|
63
|
+
you want to control. For live GUI control, start the bridge from ParaView's
|
|
64
|
+
Python Shell using `scripts/start_paraview_gui_bridge.py`.
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
┌──────────────────────────────┐ stdio ┌────────────────────────┐
|
|
68
|
+
│ MCP Client │ ◄──────────────► │ MCP Server │
|
|
69
|
+
│ Codex / Claude / other host │ │ paraview-mcp-server │
|
|
70
|
+
└──────────────────────────────┘ └──────────┬─────────────┘
|
|
71
|
+
│ JSON/TCP
|
|
72
|
+
│ 127.0.0.1:9876
|
|
73
|
+
┌──────────▼─────────────┐
|
|
74
|
+
│ ParaView Bridge │
|
|
75
|
+
│ live GUI process │
|
|
76
|
+
└──────────┬─────────────┘
|
|
77
|
+
│
|
|
78
|
+
┌──────────▼─────────────┐
|
|
79
|
+
│ paraview.simple │
|
|
80
|
+
│ ParaView runtime │
|
|
81
|
+
└────────────────────────┘
|
|
46
82
|
```
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
paraview
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
83
|
+
|
|
84
|
+
Why a ParaView-side bridge? ParaView's useful automation API is
|
|
85
|
+
`paraview.simple`, and it must execute inside a ParaView Python runtime. The
|
|
86
|
+
MCP server itself is only a protocol adapter; it cannot modify a ParaView GUI
|
|
87
|
+
unless the bridge is running inside that GUI process.
|
|
88
|
+
|
|
89
|
+
For live GUI modification, use:
|
|
90
|
+
|
|
91
|
+
```text
|
|
92
|
+
Codex/Claude -> MCP server -> bridge inside open ParaView GUI -> live GUI session
|
|
54
93
|
```
|
|
55
94
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
- A **headless pvpython executor** lets the MCP server run scripts in a separate
|
|
62
|
-
`pvpython` process for long-running or async workflows (no bridge needed).
|
|
95
|
+
For headless automation, use:
|
|
96
|
+
|
|
97
|
+
```text
|
|
98
|
+
Codex/Claude -> MCP server -> bridge inside pvpython -> headless ParaView runtime
|
|
99
|
+
```
|
|
63
100
|
|
|
64
101
|
See [`docs/architecture.md`](docs/architecture.md) for a full diagram, protocol reference,
|
|
65
102
|
and tool namespace table.
|
|
66
103
|
|
|
67
104
|
---
|
|
68
105
|
|
|
69
|
-
##
|
|
106
|
+
## Install
|
|
70
107
|
|
|
71
|
-
###
|
|
108
|
+
### Option A: Install the MCP server from PyPI
|
|
109
|
+
|
|
110
|
+
Use this when you only need the MCP server executable in your normal Python
|
|
111
|
+
environment:
|
|
72
112
|
|
|
73
113
|
```bash
|
|
74
114
|
pip install paraview-mcp-python
|
|
75
115
|
```
|
|
76
116
|
|
|
77
|
-
|
|
117
|
+
This installs:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
paraview-mcp-server
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Option B: Clone this repository for the ParaView bridge
|
|
124
|
+
|
|
125
|
+
The bridge code must be available to ParaView's Python runtime. For live GUI
|
|
126
|
+
control and local development, clone the repository:
|
|
78
127
|
|
|
79
128
|
```bash
|
|
80
129
|
git clone https://github.com/djeada/paraview-mcp-server.git
|
|
@@ -84,18 +133,117 @@ source .venv/bin/activate # Windows: .venv\Scripts\activate
|
|
|
84
133
|
pip install -e .
|
|
85
134
|
```
|
|
86
135
|
|
|
87
|
-
|
|
136
|
+
This creates:
|
|
88
137
|
|
|
89
|
-
|
|
138
|
+
```bash
|
|
139
|
+
.venv/bin/paraview-mcp-server
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## Start Everything
|
|
145
|
+
|
|
146
|
+
Start the pieces in this order.
|
|
147
|
+
|
|
148
|
+
### 1. Start the ParaView GUI Bridge
|
|
149
|
+
|
|
150
|
+
Open ParaView, then run the GUI bridge script from the Python Shell:
|
|
151
|
+
|
|
152
|
+
1. In ParaView, open **Tools -> Python Shell**.
|
|
153
|
+
2. Click **Run Script**.
|
|
154
|
+
3. Select:
|
|
155
|
+
|
|
156
|
+
```text
|
|
157
|
+
/absolute/path/to/paraview-mcp-server/scripts/start_paraview_gui_bridge.py
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Expected output:
|
|
161
|
+
|
|
162
|
+
```text
|
|
163
|
+
ParaView MCP GUI bridge started on 127.0.0.1:9876
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Do not start the live GUI bridge with `paraview --script
|
|
167
|
+
scripts/start_paraview_gui_bridge.py`. ParaView runs startup scripts before the
|
|
168
|
+
embedded GUI Python environment is fully ready for pipeline edits. Use **Tools
|
|
169
|
+
-> Python Shell -> Run Script** for the live GUI bridge.
|
|
170
|
+
|
|
171
|
+
If `paraview-mcp-python` is installed into ParaView's Python environment, you
|
|
172
|
+
can also start the live GUI bridge directly from the Python Shell:
|
|
173
|
+
|
|
174
|
+
```python
|
|
175
|
+
from bridge.gui_bridge import start_gui_bridge, stop_gui_bridge
|
|
176
|
+
start_gui_bridge()
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Leave ParaView open. MCP commands now modify this live GUI session.
|
|
180
|
+
|
|
181
|
+
To stop the bridge from the ParaView Python Shell:
|
|
182
|
+
|
|
183
|
+
```python
|
|
184
|
+
stop_gui_bridge()
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### 2. Optional: Start a Headless `pvpython` Bridge
|
|
188
|
+
|
|
189
|
+
Use this only when you do not need to modify an already-open ParaView GUI:
|
|
90
190
|
|
|
91
191
|
```bash
|
|
192
|
+
cd /path/to/paraview-mcp-server
|
|
92
193
|
pvpython scripts/start_paraview_bridge.py
|
|
93
|
-
# → ParaView bridge ready on 127.0.0.1:9876
|
|
94
194
|
```
|
|
95
195
|
|
|
96
|
-
|
|
196
|
+
Expected output:
|
|
197
|
+
|
|
198
|
+
```text
|
|
199
|
+
ParaView bridge ready on 127.0.0.1:9876
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
Keep that terminal running. This controls the `pvpython` session, not a GUI
|
|
203
|
+
window opened separately.
|
|
204
|
+
|
|
205
|
+
### 3. Verify the Bridge Directly
|
|
206
|
+
|
|
207
|
+
Before involving an MCP client, send one raw bridge command:
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
python scripts/paraview_bridge_request.py scene.get_info
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Expected response shape:
|
|
214
|
+
|
|
215
|
+
```json
|
|
216
|
+
{
|
|
217
|
+
"success": true,
|
|
218
|
+
"result": {
|
|
219
|
+
"source_count": 0,
|
|
220
|
+
"active_view_type": "RenderView"
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
If this fails, fix the bridge before configuring Codex or Claude.
|
|
226
|
+
|
|
227
|
+
### 4. Register the MCP Server with Codex CLI
|
|
228
|
+
|
|
229
|
+
If you installed from PyPI:
|
|
230
|
+
|
|
231
|
+
```bash
|
|
232
|
+
codex mcp add paraview -- paraview-mcp-server
|
|
233
|
+
codex mcp list
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
If you are using the local repository:
|
|
97
237
|
|
|
98
|
-
|
|
238
|
+
```bash
|
|
239
|
+
codex mcp add paraview -- /absolute/path/to/paraview-mcp-server/.venv/bin/paraview-mcp-server
|
|
240
|
+
codex mcp list
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
Codex starts the MCP server automatically when needed. The ParaView bridge
|
|
244
|
+
must already be running separately.
|
|
245
|
+
|
|
246
|
+
### 5. Register with Claude Desktop
|
|
99
247
|
|
|
100
248
|
**Claude Desktop** — add to `claude_desktop_config.json`:
|
|
101
249
|
|
|
@@ -109,12 +257,42 @@ The bridge listens for JSON commands from the MCP server.
|
|
|
109
257
|
}
|
|
110
258
|
```
|
|
111
259
|
|
|
112
|
-
|
|
260
|
+
For a PyPI install, use the absolute path returned by:
|
|
113
261
|
|
|
114
262
|
```bash
|
|
115
|
-
|
|
263
|
+
which paraview-mcp-server
|
|
116
264
|
```
|
|
117
265
|
|
|
266
|
+
Restart Claude Desktop after editing the config.
|
|
267
|
+
|
|
268
|
+
### 6. Verify Through Your MCP Client
|
|
269
|
+
|
|
270
|
+
With the bridge still running, ask your MCP client:
|
|
271
|
+
|
|
272
|
+
```text
|
|
273
|
+
List all sources in the current ParaView session.
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
The client should call `paraview_scene_list_sources` and return the current
|
|
277
|
+
ParaView pipeline sources from the live GUI session if you started
|
|
278
|
+
`start_paraview_gui_bridge.py`.
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
## What Can It Control?
|
|
283
|
+
|
|
284
|
+
There are two levels of control:
|
|
285
|
+
|
|
286
|
+
1. **Fixed MCP tools** for common workflows: scene inspection, loading data,
|
|
287
|
+
filters, display/coloring, camera, screenshots, data export, and animation
|
|
288
|
+
export.
|
|
289
|
+
2. **Python execution** through `paraview_python_exec`, which can run trusted
|
|
290
|
+
local Python inside the ParaView bridge session. Use this for anything not
|
|
291
|
+
covered by a fixed tool, including arbitrary `paraview.simple` scripts.
|
|
292
|
+
|
|
293
|
+
So the fixed tool list is intentionally finite, but the Python execution tool
|
|
294
|
+
is the general escape hatch for the broader ParaView API.
|
|
295
|
+
|
|
118
296
|
---
|
|
119
297
|
|
|
120
298
|
## Example prompts
|
|
@@ -261,12 +439,12 @@ Async jobs run in a separate headless `pvpython` process via `HeadlessPvpythonEx
|
|
|
261
439
|
|
|
262
440
|
## Python execution trust model
|
|
263
441
|
|
|
264
|
-
- **Trusted local execution** — `paraview_python_exec` can run arbitrary Python available to
|
|
265
|
-
including imports and full `paraview.simple` workflows.
|
|
442
|
+
- **Trusted local execution** — `paraview_python_exec` can run arbitrary Python available to the active
|
|
443
|
+
ParaView Python process, including imports and full `paraview.simple` workflows.
|
|
266
444
|
- **Output bounding** — stdout/stderr capped at **50 KB**.
|
|
267
445
|
- **Cooperative timeout** — default 30 seconds per script execution.
|
|
268
446
|
- **Script path validation** — optionally restrict execution to approved root directories.
|
|
269
|
-
- The bridge runs inside
|
|
447
|
+
- The bridge runs inside ParaView's Python runtime with the same trust level as that local session.
|
|
270
448
|
- This is a local desktop automation tool — not a public API sandbox.
|
|
271
449
|
|
|
272
450
|
---
|
|
@@ -311,9 +489,11 @@ paraview-mcp-server/
|
|
|
311
489
|
├── bridge/
|
|
312
490
|
│ ├── __init__.py
|
|
313
491
|
│ ├── server.py # TCP socket bridge server
|
|
492
|
+
│ ├── gui_bridge.py # Non-blocking live GUI bridge lifecycle
|
|
314
493
|
│ ├── command_handler.py # Command registry + paraview.simple handlers (27 commands)
|
|
315
494
|
│ └── execution.py # trusted local python.execute helper
|
|
316
495
|
├── scripts/
|
|
496
|
+
│ ├── start_paraview_gui_bridge.py
|
|
317
497
|
│ ├── start_paraview_bridge.py
|
|
318
498
|
│ ├── paraview_bridge_request.py
|
|
319
499
|
│ └── library/ # Reusable pvpython snippets
|
|
@@ -1,47 +1,96 @@
|
|
|
1
|
-
#
|
|
1
|
+
# ParaView MCP Server
|
|
2
2
|
|
|
3
3
|
**Control ParaView with AI assistants through the Model Context Protocol.**
|
|
4
4
|
|
|
5
|
-
`paraview-mcp-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
`paraview-mcp-python` provides an MCP server plus a ParaView-side bridge so
|
|
6
|
+
AI assistants such as Codex CLI and Claude Desktop can inspect a ParaView
|
|
7
|
+
session, open datasets, apply filters, color data, run ParaView Python, and
|
|
8
|
+
export screenshots.
|
|
9
|
+
|
|
10
|
+
The command installed for MCP clients is still:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
paraview-mcp-server
|
|
14
|
+
```
|
|
8
15
|
|
|
9
16
|
---
|
|
10
17
|
|
|
11
|
-
##
|
|
18
|
+
## What Parts Are There?
|
|
19
|
+
|
|
20
|
+
There are three moving pieces:
|
|
12
21
|
|
|
22
|
+
| Part | Runs where | Purpose |
|
|
23
|
+
|---|---|---|
|
|
24
|
+
| **MCP client** | Codex CLI, Claude Desktop, or another MCP host | Starts the MCP server and calls tools. |
|
|
25
|
+
| **MCP server** | Normal Python environment | Speaks MCP over stdio and forwards tool calls to ParaView over TCP. |
|
|
26
|
+
| **ParaView GUI bridge** | Already-open ParaView GUI process | Receives TCP JSON commands and executes `paraview.simple` operations in that live GUI session. |
|
|
27
|
+
|
|
28
|
+
The ParaView bridge is the ParaView-side component. It plays the same role as
|
|
29
|
+
the Blender add-on in `blender-mcp-server`: it must run inside the application
|
|
30
|
+
you want to control. For live GUI control, start the bridge from ParaView's
|
|
31
|
+
Python Shell using `scripts/start_paraview_gui_bridge.py`.
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
┌──────────────────────────────┐ stdio ┌────────────────────────┐
|
|
35
|
+
│ MCP Client │ ◄──────────────► │ MCP Server │
|
|
36
|
+
│ Codex / Claude / other host │ │ paraview-mcp-server │
|
|
37
|
+
└──────────────────────────────┘ └──────────┬─────────────┘
|
|
38
|
+
│ JSON/TCP
|
|
39
|
+
│ 127.0.0.1:9876
|
|
40
|
+
┌──────────▼─────────────┐
|
|
41
|
+
│ ParaView Bridge │
|
|
42
|
+
│ live GUI process │
|
|
43
|
+
└──────────┬─────────────┘
|
|
44
|
+
│
|
|
45
|
+
┌──────────▼─────────────┐
|
|
46
|
+
│ paraview.simple │
|
|
47
|
+
│ ParaView runtime │
|
|
48
|
+
└────────────────────────┘
|
|
13
49
|
```
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
paraview
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
50
|
+
|
|
51
|
+
Why a ParaView-side bridge? ParaView's useful automation API is
|
|
52
|
+
`paraview.simple`, and it must execute inside a ParaView Python runtime. The
|
|
53
|
+
MCP server itself is only a protocol adapter; it cannot modify a ParaView GUI
|
|
54
|
+
unless the bridge is running inside that GUI process.
|
|
55
|
+
|
|
56
|
+
For live GUI modification, use:
|
|
57
|
+
|
|
58
|
+
```text
|
|
59
|
+
Codex/Claude -> MCP server -> bridge inside open ParaView GUI -> live GUI session
|
|
21
60
|
```
|
|
22
61
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
- A **headless pvpython executor** lets the MCP server run scripts in a separate
|
|
29
|
-
`pvpython` process for long-running or async workflows (no bridge needed).
|
|
62
|
+
For headless automation, use:
|
|
63
|
+
|
|
64
|
+
```text
|
|
65
|
+
Codex/Claude -> MCP server -> bridge inside pvpython -> headless ParaView runtime
|
|
66
|
+
```
|
|
30
67
|
|
|
31
68
|
See [`docs/architecture.md`](docs/architecture.md) for a full diagram, protocol reference,
|
|
32
69
|
and tool namespace table.
|
|
33
70
|
|
|
34
71
|
---
|
|
35
72
|
|
|
36
|
-
##
|
|
73
|
+
## Install
|
|
37
74
|
|
|
38
|
-
###
|
|
75
|
+
### Option A: Install the MCP server from PyPI
|
|
76
|
+
|
|
77
|
+
Use this when you only need the MCP server executable in your normal Python
|
|
78
|
+
environment:
|
|
39
79
|
|
|
40
80
|
```bash
|
|
41
81
|
pip install paraview-mcp-python
|
|
42
82
|
```
|
|
43
83
|
|
|
44
|
-
|
|
84
|
+
This installs:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
paraview-mcp-server
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Option B: Clone this repository for the ParaView bridge
|
|
91
|
+
|
|
92
|
+
The bridge code must be available to ParaView's Python runtime. For live GUI
|
|
93
|
+
control and local development, clone the repository:
|
|
45
94
|
|
|
46
95
|
```bash
|
|
47
96
|
git clone https://github.com/djeada/paraview-mcp-server.git
|
|
@@ -51,18 +100,117 @@ source .venv/bin/activate # Windows: .venv\Scripts\activate
|
|
|
51
100
|
pip install -e .
|
|
52
101
|
```
|
|
53
102
|
|
|
54
|
-
|
|
103
|
+
This creates:
|
|
55
104
|
|
|
56
|
-
|
|
105
|
+
```bash
|
|
106
|
+
.venv/bin/paraview-mcp-server
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Start Everything
|
|
112
|
+
|
|
113
|
+
Start the pieces in this order.
|
|
114
|
+
|
|
115
|
+
### 1. Start the ParaView GUI Bridge
|
|
116
|
+
|
|
117
|
+
Open ParaView, then run the GUI bridge script from the Python Shell:
|
|
118
|
+
|
|
119
|
+
1. In ParaView, open **Tools -> Python Shell**.
|
|
120
|
+
2. Click **Run Script**.
|
|
121
|
+
3. Select:
|
|
122
|
+
|
|
123
|
+
```text
|
|
124
|
+
/absolute/path/to/paraview-mcp-server/scripts/start_paraview_gui_bridge.py
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Expected output:
|
|
128
|
+
|
|
129
|
+
```text
|
|
130
|
+
ParaView MCP GUI bridge started on 127.0.0.1:9876
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Do not start the live GUI bridge with `paraview --script
|
|
134
|
+
scripts/start_paraview_gui_bridge.py`. ParaView runs startup scripts before the
|
|
135
|
+
embedded GUI Python environment is fully ready for pipeline edits. Use **Tools
|
|
136
|
+
-> Python Shell -> Run Script** for the live GUI bridge.
|
|
137
|
+
|
|
138
|
+
If `paraview-mcp-python` is installed into ParaView's Python environment, you
|
|
139
|
+
can also start the live GUI bridge directly from the Python Shell:
|
|
140
|
+
|
|
141
|
+
```python
|
|
142
|
+
from bridge.gui_bridge import start_gui_bridge, stop_gui_bridge
|
|
143
|
+
start_gui_bridge()
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Leave ParaView open. MCP commands now modify this live GUI session.
|
|
147
|
+
|
|
148
|
+
To stop the bridge from the ParaView Python Shell:
|
|
149
|
+
|
|
150
|
+
```python
|
|
151
|
+
stop_gui_bridge()
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### 2. Optional: Start a Headless `pvpython` Bridge
|
|
155
|
+
|
|
156
|
+
Use this only when you do not need to modify an already-open ParaView GUI:
|
|
57
157
|
|
|
58
158
|
```bash
|
|
159
|
+
cd /path/to/paraview-mcp-server
|
|
59
160
|
pvpython scripts/start_paraview_bridge.py
|
|
60
|
-
# → ParaView bridge ready on 127.0.0.1:9876
|
|
61
161
|
```
|
|
62
162
|
|
|
63
|
-
|
|
163
|
+
Expected output:
|
|
164
|
+
|
|
165
|
+
```text
|
|
166
|
+
ParaView bridge ready on 127.0.0.1:9876
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Keep that terminal running. This controls the `pvpython` session, not a GUI
|
|
170
|
+
window opened separately.
|
|
171
|
+
|
|
172
|
+
### 3. Verify the Bridge Directly
|
|
173
|
+
|
|
174
|
+
Before involving an MCP client, send one raw bridge command:
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
python scripts/paraview_bridge_request.py scene.get_info
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Expected response shape:
|
|
181
|
+
|
|
182
|
+
```json
|
|
183
|
+
{
|
|
184
|
+
"success": true,
|
|
185
|
+
"result": {
|
|
186
|
+
"source_count": 0,
|
|
187
|
+
"active_view_type": "RenderView"
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
If this fails, fix the bridge before configuring Codex or Claude.
|
|
193
|
+
|
|
194
|
+
### 4. Register the MCP Server with Codex CLI
|
|
195
|
+
|
|
196
|
+
If you installed from PyPI:
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
codex mcp add paraview -- paraview-mcp-server
|
|
200
|
+
codex mcp list
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
If you are using the local repository:
|
|
64
204
|
|
|
65
|
-
|
|
205
|
+
```bash
|
|
206
|
+
codex mcp add paraview -- /absolute/path/to/paraview-mcp-server/.venv/bin/paraview-mcp-server
|
|
207
|
+
codex mcp list
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Codex starts the MCP server automatically when needed. The ParaView bridge
|
|
211
|
+
must already be running separately.
|
|
212
|
+
|
|
213
|
+
### 5. Register with Claude Desktop
|
|
66
214
|
|
|
67
215
|
**Claude Desktop** — add to `claude_desktop_config.json`:
|
|
68
216
|
|
|
@@ -76,12 +224,42 @@ The bridge listens for JSON commands from the MCP server.
|
|
|
76
224
|
}
|
|
77
225
|
```
|
|
78
226
|
|
|
79
|
-
|
|
227
|
+
For a PyPI install, use the absolute path returned by:
|
|
80
228
|
|
|
81
229
|
```bash
|
|
82
|
-
|
|
230
|
+
which paraview-mcp-server
|
|
83
231
|
```
|
|
84
232
|
|
|
233
|
+
Restart Claude Desktop after editing the config.
|
|
234
|
+
|
|
235
|
+
### 6. Verify Through Your MCP Client
|
|
236
|
+
|
|
237
|
+
With the bridge still running, ask your MCP client:
|
|
238
|
+
|
|
239
|
+
```text
|
|
240
|
+
List all sources in the current ParaView session.
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
The client should call `paraview_scene_list_sources` and return the current
|
|
244
|
+
ParaView pipeline sources from the live GUI session if you started
|
|
245
|
+
`start_paraview_gui_bridge.py`.
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
## What Can It Control?
|
|
250
|
+
|
|
251
|
+
There are two levels of control:
|
|
252
|
+
|
|
253
|
+
1. **Fixed MCP tools** for common workflows: scene inspection, loading data,
|
|
254
|
+
filters, display/coloring, camera, screenshots, data export, and animation
|
|
255
|
+
export.
|
|
256
|
+
2. **Python execution** through `paraview_python_exec`, which can run trusted
|
|
257
|
+
local Python inside the ParaView bridge session. Use this for anything not
|
|
258
|
+
covered by a fixed tool, including arbitrary `paraview.simple` scripts.
|
|
259
|
+
|
|
260
|
+
So the fixed tool list is intentionally finite, but the Python execution tool
|
|
261
|
+
is the general escape hatch for the broader ParaView API.
|
|
262
|
+
|
|
85
263
|
---
|
|
86
264
|
|
|
87
265
|
## Example prompts
|
|
@@ -228,12 +406,12 @@ Async jobs run in a separate headless `pvpython` process via `HeadlessPvpythonEx
|
|
|
228
406
|
|
|
229
407
|
## Python execution trust model
|
|
230
408
|
|
|
231
|
-
- **Trusted local execution** — `paraview_python_exec` can run arbitrary Python available to
|
|
232
|
-
including imports and full `paraview.simple` workflows.
|
|
409
|
+
- **Trusted local execution** — `paraview_python_exec` can run arbitrary Python available to the active
|
|
410
|
+
ParaView Python process, including imports and full `paraview.simple` workflows.
|
|
233
411
|
- **Output bounding** — stdout/stderr capped at **50 KB**.
|
|
234
412
|
- **Cooperative timeout** — default 30 seconds per script execution.
|
|
235
413
|
- **Script path validation** — optionally restrict execution to approved root directories.
|
|
236
|
-
- The bridge runs inside
|
|
414
|
+
- The bridge runs inside ParaView's Python runtime with the same trust level as that local session.
|
|
237
415
|
- This is a local desktop automation tool — not a public API sandbox.
|
|
238
416
|
|
|
239
417
|
---
|
|
@@ -278,9 +456,11 @@ paraview-mcp-server/
|
|
|
278
456
|
├── bridge/
|
|
279
457
|
│ ├── __init__.py
|
|
280
458
|
│ ├── server.py # TCP socket bridge server
|
|
459
|
+
│ ├── gui_bridge.py # Non-blocking live GUI bridge lifecycle
|
|
281
460
|
│ ├── command_handler.py # Command registry + paraview.simple handlers (27 commands)
|
|
282
461
|
│ └── execution.py # trusted local python.execute helper
|
|
283
462
|
├── scripts/
|
|
463
|
+
│ ├── start_paraview_gui_bridge.py
|
|
284
464
|
│ ├── start_paraview_bridge.py
|
|
285
465
|
│ ├── paraview_bridge_request.py
|
|
286
466
|
│ └── library/ # Reusable pvpython snippets
|
|
@@ -8,6 +8,7 @@ is available.
|
|
|
8
8
|
from __future__ import annotations
|
|
9
9
|
|
|
10
10
|
import logging
|
|
11
|
+
import os
|
|
11
12
|
from typing import TYPE_CHECKING, Any
|
|
12
13
|
|
|
13
14
|
from bridge.models import (
|
|
@@ -346,7 +347,8 @@ class CommandHandler:
|
|
|
346
347
|
camera.SetViewUp(*params["view_up"])
|
|
347
348
|
if "parallel_scale" in params:
|
|
348
349
|
camera.SetParallelScale(params["parallel_scale"])
|
|
349
|
-
|
|
350
|
+
if os.environ.get("PARAVIEW_MCP_GUI_BRIDGE") != "1":
|
|
351
|
+
view.StillRender()
|
|
350
352
|
pos = list(camera.GetPosition())
|
|
351
353
|
fp = list(camera.GetFocalPoint())
|
|
352
354
|
up = list(camera.GetViewUp())
|