yade-mcp-bridge
HTTP + SSE bridge that runs inside a YADE process and enables execution tools for yade-mcp.
Features
- Async tasks with progress polling. Submit a long simulation script
(
execute_task) and poll its status and paginated log while it runs (check_task_status). - Live code during a run. Send
execute_codeat any time to inspect state or tune parameters mid-cycle — no need to bake probes into the script up front. It shares the simulation's__main__namespace. - Graceful interrupt. Stop a long cycling task on request
(
interrupt_task) without killing the YADE process. - Unified output capture. Python
printand YADE console output are interleaved in execution order in the task log. - Zero third-party dependencies. Pure stdlib HTTP + SSE.
Architecture
YADE's Qt GUI objects are main-thread-only, so the bridge keeps
execute_code on the main thread while running each task on its own
thread — a long O.run() then never blocks the server or live code.
flowchart TD
C[MCP client] -->|POST /command| S[HTTP + SSE server<br/>background thread]
C -.->|GET /events| S
S -->|execute_code → queue| Q[CodeExecutor<br/>one at a time]
Q -->|Qt timer GUI / daemon console| P[pump thread]
S -->|execute_task| T[ScriptRunner<br/>one thread per task]
T -->|O.run| Y[YADE C++ sim loop]
Y -.->|PyRunner callback| I[interrupt check]
S -.->|doorbells| C
- HTTP + SSE server (background thread). A threaded HTTP server takes
POST /<command>request/response calls and serves one long-livedGET /eventsSSE stream. It hands work off rather than touching YADE directly, so lightweight calls (status, interrupt) stay responsive even while a long task runs. - execute_code pump.
execute_codesubmissions are serialized through a queue drained by a single pump — so concurrent submissions run one at a time instead of racing on YADE state. The pump is a Qt timer on the main thread in GUI mode (mandatory foryade.qtobjects), or a background daemon thread in console mode. - Per-task threads.
ScriptRunnerruns eachexecute_taskscript on its own background thread, so a cyclingO.run()holds that thread, not the server or the main thread. - Cycle-gap interrupt. A
PyRunnercallback fires periodically duringO.run()to honor a pendinginterrupt_taskwithin ~one step. - SSE doorbells. Two no-payload server→client events
(
task_status_changed,console_entry) tell the client when to re-poll; all data travels over the plainPOST/GETcalls.
HTTP protocol
The bridge is the source of truth for the wire contract — yade-mcp is a
client of it. A request is POST /<command> with a JSON body carrying a
request_id; the response echoes the request_id.
| Command | Purpose | Key fields |
|---|---|---|
execute_task |
Submit a file-backed script as a tracked async task; the response returns the assigned task_id |
script_path, description |
check_task_status |
Poll a task's status and paginated log | task_id, skip_newest, limit, filter_text |
list_tasks |
List known tasks | offset, limit |
interrupt_task |
Request a graceful interrupt of a running task | task_id |
execute_code |
Run a snippet in the shared __main__ namespace |
code, timeout_ms |
console_history |
Read captured console output | limit |
Server→client SSE events on GET /events: task_status_changed,
console_entry. GET /health reports liveness and runtime mode.
Quick Start
In a YADE Python console, install the bridge using YADE's own interpreter:
import sys, subprocess
subprocess.check_call([sys.executable, "-m", "pip", "install", "--user", "yade-mcp-bridge"])
On PEP 668 externally-managed environments (pip refuses --user), see the bootstrap guide for a portable form.
Restart YADE, then in the Python console:
import yade_mcp_bridge
yade_mcp_bridge.start()
The bridge auto-detects the runtime: Qt timer in GUI mode, blocking poll in console mode.
Expected output (one line):
YADE MCP Bridge on http://localhost:9002, log: /your-working-dir/.yade-mcp/bridge.log
Detailed initialization logs go to bridge.log only (stdout shows warnings and errors).
Options
yade_mcp_bridge.start(
host="localhost", # Server host
port=9002, # Server port
mode="auto", # "auto", "gui", or "console"
)
Requirements
- Python >= 3.8
- YADE with Python bindings
- No third-party dependencies (stdlib HTTP + SSE)
Troubleshooting
| Symptom | Fix |
|---|---|
| Port in use | yade_mcp_bridge.start(port=9003), then set YADE_MCP_BRIDGE_URL=http://localhost:9003 |
| Connection failed | Check bridge is running, see .yade-mcp/bridge.log |
| PyRunner not available | YADE installation may lack PyRunner; interrupt checking during O.run() will be disabled |
Development
Run the bridge from source inside YADE:
import sys
sys.path.insert(0, '/path/to/yade-mcp/yade-mcp-bridge/src')
import yade_mcp_bridge
yade_mcp_bridge.start()
Code changes take effect on the next restart + start().
Relationship to MCP servers
This package is the in-process runtime only. Pair it with an MCP server that speaks its HTTP + SSE protocol — yade-mcp — for full client setup.
License: MIT (LICENSE).
Metadata
Release files for yade-mcp-bridge 0.10.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| yade_mcp_bridge-0.10.1.tar.gz | 36.5 kB | With provenance | Details for yade_mcp_bridge-0.10.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| yade_mcp_bridge-0.10.1-py3-none-any.whl | Python 3 | none | any | Details for yade_mcp_bridge-0.10.1-py3-none-any.whl |
Total release size: 89.1 kB
Release files / yade_mcp_bridge-0.10.1.tar.gz
| Download URL | yade_mcp_bridge-0.10.1.tar.gz |
|---|---|
| Size | 36.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
396e815b113254ac8ba0feaaacab1b8c6fd60d36d0bb7e11cbb15b60681d28ae
|
|
BLAKE2b-256 checksum How to use checksums |
6ee5de18f12e586af6d18236c662f9be9b66db9cc58ba2d796858e6bbb3fd34f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.
Transparency logRelease files / yade_mcp_bridge-0.10.1-py3-none-any.whl
| Download URL | yade_mcp_bridge-0.10.1-py3-none-any.whl |
|---|---|
| Size | 52.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b06271965ecd84da0f31728c93daea09aa868bbd52d2625b7e04197bf8311103
|
|
BLAKE2b-256 checksum How to use checksums |
19bb405a9bd3678407ec4e95851d328a86ae2a7c65474d95c202e46fa21adc7f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.
Transparency logSecurity for yade-mcp-bridge 0.10.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for yade_mcp_bridge-0.10.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.