e3d-mcp
by asqi-carter
README.md
# e3d-mcp
e3d-mcp lets an AI agent build, run, measure and film a model in Rockwell Emulate3D 2026 through one small MCP
server, and tells the agent only what it has checked. Every write is read back, every failure has a typed code, risky
actions are refused before anything changes, and each change leaves one line in an audit log.
It is built on the same ideas as ftx-mcp (FactoryTalk Optix) and logix-mcp (Studio 5000 / Logix). Those are separate
projects. They are not part of this repository and are not required: nothing in the service depends on them.
This project is not affiliated with Rockwell Automation, Inc. See `LICENSE` and `NOTICE`.
## Requirements
- Windows 10 or 11 with a licensed Emulate3D 2026 install (a demo licence works). Emulate3D is not included.
- Emulate3D's built-in MCP server enabled in Web Configuration, on HTTP port 9080.
- Python 3.11 or newer and git on the same machine.
- Optional: Logix Echo for tag IO (and logix-mcp, a separate project, if you want the agent to use it), NVIDIA Omniverse
Kit for rendering USD.
## Install and quickstart
On the Emulate3D box, from a git checkout of this repository, in PowerShell:
```powershell
agent\install-e3d-mcp.ps1 -RepoDir <path to this checkout> -Verify
agent\start-e3d.ps1 -Document <name>.demo3d
```
The first script makes a virtual environment under `%LOCALAPPDATA%\e3d-mcp`, installs the package, registers a
scheduled task that runs `e3d-mcp` at logon and checks `e3d_health`. The second, run in the interactive desktop
session, starts Emulate3D with the document from `Desktop\e3ddemos`, starts the web server on port 9080 and installs the
in-app bridge. Details are in `agent/README.md`.
**The template document.** The live validation (`ci/validate-win.ps1`) and the examples use a template document named `e3d-ci-base.demo3d` in
`<Desktop>\e3ddemos`. To get one, open any model in Emulate3D 2026, enable its MCP web server (Web Configuration, HTTP port 9080) and save the
model as `e3d-ci-base.demo3d` in that folder. `mcp-base` is a name the service never overwrites, so do not use it for
a document you want changed.
Point an MCP client at `http://127.0.0.1:8786/mcp` (`agent/mcp.json` is an example), then call `e3d_status` first:
```
python ci/mcpcall.py e3d_status
```
It returns the document, tag servers, bridge state, model time and camera in one call.
## Testing
```
make test-public # runs on any machine: the Python tests, no Emulate3D and no vendor files
make test # also compiles the bridge and runs the Omniverse tests
```
`make test-public` needs only Python 3.11 or newer and the dev dependencies (`pip install -e ".[dev]"`). `make test`
also compiles the C# bridge, so it needs the Emulate3D reference assemblies that you copy from your own install (see
`.localfeed/README.md`); it fails when they are missing. See `CONTRIBUTING.md`.
## Configuration
`e3d-mcp` serves the MCP tools over streamable HTTP at `http://<E3D_BIND>:<E3D_PORT>/mcp`. Configuration is by
environment variables:
| Variable | Default | Meaning |
| --- | --- | --- |
| `E3D_BIND` | `127.0.0.1` | Address to listen on. A non-loopback value is refused (exit 3) unless `E3D_TOKEN` is set. |
| `E3D_PORT` | `8786` | TCP port (`0` picks a free one). |
| `E3D_TOKEN` | unset | When set, every request needs `Authorization: Bearer <token>`, otherwise it gets 401. When unset no header is needed. |
| `E3D_UPSTREAM_URL` | `http://127.0.0.1:9080/mcp` | The Emulate3D built-in MCP server. |
| `E3D_STATE_DIR` | `%LOCALAPPDATA%\e3d-mcp` (Windows), `~/.e3d-mcp` | Audit log and state. |
| `E3D_DATA_DIR` | `Documents\e3d-mcp` (Windows), `~/e3d-mcp` | Folder with `views`, `parts`, `replay` and `textures` inputs; screenshots and recordings are written under it. |
| `E3D_ALLOW_REAL_TARGETS` | unset | Operator-only. `1` lets `e3d_tags` configure targets that are not emulators. Never a tool argument. |
On a loopback bind, DNS-rebinding protection accepts Host `127.0.0.1:<port>`, `localhost:<port>` and `[::1]:<port>`.
`ci/mcpcall.py <tool> [<json-args>]` is a stdlib-only client; it sends `Authorization: Bearer $E3D_TOKEN` when that
variable is set.
## Architecture
```
agent (Claude Code, any MCP client)
| MCP over HTTP, 127.0.0.1:8786, the only surface agents get
v
service/ Python: guards, verification, audit, 15 e3d_* tools
| MCP over HTTP, 127.0.0.1:9080, never exposed to agents
v
Emulate3D built-in MCP server --compiles--> E3dBridge (C#, inside the open document)
```
**Built-in tools.** The service sits in front of Emulate3D's own MCP server and does not pass its tools through. Six
of them carry the core:
| Built-in tool | Used for |
|---|---|
| `enumerate_document` | Listing the visuals of the open document. |
| `get_property` | Reading a property the bridge does not know, read only. |
| `get_scripts` | Seeing which script projects the document has, before a bridge install. |
| `run_scripted_tests` | Restarting the web server during a bridge install. Scripted NUnit tests are not exposed as a tool. |
| `create_c_sharp_project` | Creating the two bridge projects in a document that has none. |
| `modify_source_within_project` | Injecting the bridge source and compiling it. |
A few more (tag servers, finding, copying and deleting visuals) are called by individual tools. `document_reset` is
forbidden.
**C# bridge.** `bridge/` holds `E3dBridge` and `E3dBridgeRestart`. `e3d_bridge action=ensure` injects them into the open
document and compiles them, and does nothing when the installed version is current. They give UI-thread-safe `e3db_*`
actions that the built-in tools lack: verified property writes, running and resetting the simulation, saving and
opening documents, screenshots and views, recording and USD export. The bridge is versioned and the service refuses an
older one with `bridge_outdated`.
**Python pillars.** Verified writes (read back, report what was observed); one-call status (`e3d_status`); typed errors
with a code, hint and suggestions; guards that refuse before they mutate; an audit log (`audit.jsonl` in the state
directory, names and outcomes, never values); and skills for agents.
## Tools
| Tool | What it does |
|---|---|
| `e3d_status` | Call this first. One-shot state: capabilities, document, tag servers, bridge state, model time, camera. |
| `e3d_health` | Service and upstream connectivity: versions, URL, reachability, tool count. |
| `e3d_bridge` | Check (`status`) or install (`ensure`) the in-app E3dBridge tools the others depend on. |
| `e3d_find` | Find visuals whose name contains a substring, paged. |
| `e3d_get` | Read named properties of one visual, including custom and aspect properties, in one call. |
| `e3d_set` | Set properties on one visual and verify each by reading it back; `dry_run` validates only. |
| `e3d_run` | Run (`for`, `until`), `stop` or `reset` the simulation and return evidence of what happened. |
| `e3d_build` | Build a group of boxes, cylinders, spheres and labels from a parts list: `check`, `push`, `census`, `remove`. |
| `e3d_scene` | Set what a load creator makes, the background and floor, or a texture, and read it back. |
| `e3d_tags` | Tag-server IO that reports observed state: connect, list, load, bind, read, force; emulator targets only. |
| `e3d_observe` | Look without changing the model: screenshot, camera view, log tail, frame series, saved views. |
| `e3d_pid` | Build a P&ID knowledge graph into the model: check, plan, push, verify and match its tags to a controller tag list; then solve, tune, apply, bind, loopcheck, record and rules to run, look and adjust the process. `parts_source` picks the parts: `primitive` (default) or `tanks_and_pipes` (real fluid parts, with `start` and `process`). |
| `e3d_replay` | Replay a recorded CSV window into the model, row by row, and verify each step. |
| `e3d_record` | Record a run to `.raw3d`, film a camera path, or export a recording to Omniverse USD. |
| `e3d_document` | `save_copy`, `open` or `open_copy` a document without losing AI changes; `new` is refused. |
Tool notes:
- `e3d_tags action=add` creates a tag server and, with an address, sets up an Echo link in one call (`configure` writes the address first).
- Tag servers are addressed by their real names in `connect`, `disconnect`, `bind` and `unbind`.
- `e3d_tags action=load` no longer refuses a BOOL because its direction is `Input`, `Output` or `Bidirectional`.
- `e3d_build` accepts a `lamp` part, and `e3d_tags action=bind` takes `access` (`read_from_plc` by default for a custom property such as `Lit`).
- `e3d_set` on `IsActivated` of a lift while paused returns a warning, and `e3d_run action=reset` lists inconsistent lift actuators.
- `agent\start-e3d.ps1` foregrounds Demo3D and checks keyboard focus before typing into the Immediate Window.
## Error codes
Every failure is a typed error with `code`, `message`, `hint` and `docs_anchor`, plus `did_you_mean` and `state` when they apply, and a refusal says "Nothing was written."
- `bridge_missing`
- `bridge_outdated`
- `upstream_down`
- `app_not_responding`
- `target_not_emulator`
- `unknown_property`
- `readonly_property`
- `invalid_value`
- `tag_not_found`
- `server_connect_failed`
- `unsaved_ai_changes`
- `unknown_argument`
- `forbidden_upstream_tool`
- `tag_type_unsupported`
- `duplicate_binding`
- `bridge_compile_failed`
- `capability_missing`
## P&ID pipeline
The input of `e3d_pid` is the JSON knowledge graph written by Scott Duncan's open-source P&ID to Knowledge Graph skill,
<https://github.com/ScottDuncanAI/PID-to-Knowledge-Graph> (MIT). Five actions build
the model: `check` validates the graph, `plan` lays it out and lists the parts, `push` builds the parts into the open
model, `verify` reads them back, and `tagmap` matches the instrument tags to a controller tag list and reports what is
unmatched. Positions come from the drawing sheets, not from a plant layout.
Seven more actions run, look and adjust the process: `solve` computes steady-state flows and levels from the graph and
a parameter set, `tune` suggests PID gains per loop, `apply` writes parameters to the model (`dry_run` first),
`bind` connects the matched tags in one disconnect/connect cycle, `loopcheck` reports each tag pair's state, `record`
appends samples to a trend CSV, and `rules` checks a trend file against rules. `solve`, `tune` and `rules` only read.
The `e3d-build-from-pid` skill gives the order of calls ("Run, look, adjust").
Two parts sources build the model. `primitive` (the default) draws boxes and cylinders. `tanks_and_pipes` builds from
the Tanks and Pipes package: `check` and `plan` add the catalog, pipe connections, sizes and pump duty,
`push` and `verify` build and read back, `process` installs the pH and lime script (`process_options`,
`max_new_visuals` limit it and the push), and `start` runs the start sequence after every reset. Both new actions
refuse on `primitive`. A `record` after `start` takes `reset: false`, and `e3d_document save` keeps the build.
## Omniverse
`e3d_record action=start` begins an Emulate3D recording into `Documents\e3d-mcp\recordings\<name>.raw3d` and `stop` ends
it. `usd_export` turns a recording into USD through Rockwell's Omniverse connector (`connector` checks that it is
installed) and reads the result back, reporting the prim count and time codes. `tools/omniverse` then unpacks textures,
dresses the stage with lights and a camera, and renders it headless with Kit. See `tools/omniverse/README.md`. Install
the optional `omniverse` extra (`usd-core`) only outside a Kit environment.
## e3d-agent
`agent\install-e3d-agent.ps1` installs the driver, which runs Claude Code headless against the service and keeps the
session between calls.
```powershell
agent\e3d-agent.ps1 -Check # preflight, exit 0 on pass
agent\e3d-agent.ps1 -PromptFile task.txt # run a prompt, resumable; add -New for a fresh session
```
The prompt goes in on stdin, a watchdog enforces the timeout, and a lock stops two runs at once. See `agent/README.md`.
## Skills and evals
- `skills/` holds agent skills: short procedures with exact tool calls, gotchas and a verify checklist.
- `evals/` holds a task corpus and a scorer. Each task runs offline against a fake upstream, and live through
`e3d-agent.ps1 -PromptFile`.
## Known limits
- Windows only; one open document at a time.
- The unsaved-work gate sees only writes made through this service. Writes made by Emulate3D's own assistant or the
built-in MCP used directly are not seen.
- When a document is opened outside the service, the in-app tools are lost until `e3d_bridge action=ensure`.
- Scripted NUnit tests are not exposed as a tool.
- Tag targets are local emulators only (Echo on this machine), unless the operator sets `E3D_ALLOW_REAL_TARGETS=1`.
- A licensed or demo Emulate3D is needed; this repository does not include it or its reference assemblies.
- The live scripts (`agent\*.ps1`, `ci\validate-win.ps1`) are checked by text tests here and need a run on a real
Windows host. See `CONTRIBUTING.md`.
`ci/win-validate.sh` runs `ci/validate-win.ps1` on the Emulate3D host. It reads `E3D_HOST` (ssh target, `<e3d-host>`)
and `E3D_CI_DIR` (e.g. `C:/Users/example/e3d-ci`) from the environment, else from `$E3D_CI_CONFIG` or the untracked
`ci/local.env` (copy `ci/local.env.example`). A CI system that runs it also sets `E3D_CI_RUNNER` (runner label).
## More
`SECURITY.md` (what the agent can and cannot do), `CONTRIBUTING.md`, `CHANGELOG.md`, `skills/`, `evals/`,
`agent/README.md` and `ci/README.md`.
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues