te1000-mcp
This server provides an MCP interface for automating Beckhoff TwinCAT 3 XAE engineering via the TE1000 Automation Interface, enabling an AI agent to configure, build, and deploy industrial automation projects.
XAE Shell & Build
Check XAE status, open/save solutions, inspect errors, clean/build/rebuild solutions, run raw DTE commands (guarded), and resolve modal dialogs blocking XAE.
System Manager Tree & IO
Read/write any tree item (identity, children, XML parameters, rename, create, delete, import/export).
Build fully-populated EtherCAT boxes from ESI data; link/unlink variables between PLC and IO (with batch support).
Get/set AMS NetID, rescan PLC, scan IO boxes, and manage bulk variable mappings project-wide.
PLC Project & Code Authoring
Create PLC projects from templates, import existing projects, set boot flags, export/import PLCopen XML.
Author and edit POUs, DUTs, GVLs, interfaces, actions, methods, and properties; manage folders.
Surgical code edits (replace substrings/line ranges, insert, append) in declaration and implementation sections.
Read PLC source with line range or regex slicing, outline structure, and inspect graphical bodies (LD/FBD/SFC/CFC).
Project-wide code search (regex/substring) across all PLC objects.
Run CheckAllObjects offline; deploy PLC boot projects (guarded); control PLC online session (guarded).
Library Management
List, scan, add, remove library references and placeholders; set placeholder resolutions; freeze versions.
Manage machine-wide library repositories: install/uninstall, add/remove/move repos (guarded).
Realtime, Tasks & Routing
Manage RT tasks (list, create, set cycle time/priority/autostart, bind CPU affinity, link to PLC projects).
Configure RT core settings (max CPUs, affinity masks, base time, latency warnings).
ADS route management: list, broadcast-search LAN, add static/project routes (writes guarded).
Fieldbus & Platform
Configure non-EtherCAT fieldbuses: PROFINET, PROFIBUS, CANopen, DeviceNet, EAP — create masters/slaves/boxes, import GSD/GSDML, import DBC files.
NC motion tree: list NC tasks, axes, and axis details.
TcCOM module objects: list, create, configure, enable symbols, assign execution context (guarded).
TwinCAT C++ projects: create, open, generate TMC code, build, publish (publish guarded).
Project variant management: get/set variant config, select active variant, enable/disable tree items per variant.
Engineering settings: silent mode, target platform, solution/PLC archives, independent files.
Measurement & Licensing
Create TwinCAT Scope View/Analytics projects, manage scope elements, record live data (guarded).
Manage TIAN data loggers and stream helpers.
TwinCAT licensing: list license devices, add license nodes, activate OEM response files (guarded).
Runtime Deployment (Confirmation-Gated)
Activate TwinCAT configuration and restart the runtime — both require explicit confirmation tokens.
Safety & Reliability
All destructive/runtime-affecting actions are confirmation-gated and off by default.
The TwinSAFE safety project (
TISC-rooted paths) is never written to by policy.A dialog watchdog detects and optionally auto-dismisses XAE modal dialogs to prevent hangs.
A persistent native C# daemon caches the project tree and PLC source for fast repeated operations.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@te1000-mcpshow the current error list"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
te1000-mcp
A Model Context Protocol server for Beckhoff TwinCAT 3 engineering automation — drive the TE1000 / XAE Automation Interface from an AI agent or any MCP client.
te1000-mcp exposes the TwinCAT XAE engineering surface — the System Manager tree,
PLC project authoring, IO/EtherCAT configuration, variable linking, builds, and
runtime deployment — as a compact set of MCP tools. It talks to a running XAE Shell
through the TE1000 Automation Interface (COM/DTE), so an agent can configure and build
a TwinCAT project the same way an engineer would in the GUI.
A Node MCP front (index.js) owns the MCP protocol, tool schemas, and confirmation
guards; the COM/DTE work runs in a persistent native C#/.NET daemon
(Te1000Daemon.exe) that the front talks to over a Windows named pipe. The daemon is
the sole backend. See How it works.
This server drives areal engineering tool and can activate or download to a TwinCAT runtime. Every action that touches the target runtime (activate, restart, download, deletes, licensing) is confirmation-gated and off by default. See Safety & guards.
Contents
Related MCP server: TwinCAT Validator MCP Server
Highlights
25 noun-grouped tools covering the automatable TE1000 surface — tree, IO/EtherCAT, linking, PLC project & POU authoring, libraries, tasks, mapping, routes, fieldbuses, TcCOM, C++, measurement/scope, licensing, and variants.
Batch-first — every multi-item operation has a
*_batchform that runs N operations in one DTE attach and returns a compact continue-on-error roll-up, instead of paying a process spawn + attach per call.Native EtherCAT builder —
tc_ethercatcreates fully-populated EtherCAT boxes (correct identity, SyncManagers, FMMUs, PDOs) for any device class by the GUI's own "Add Box" route, driven from the device's ESI.Surgical PLC code edits —
plc_poureads, greps, and patches declaration/implementation text in place and returns only the changed region, keeping agent context small.Safe by default — destructive and runtime-affecting actions are confirmation-gated; the safety project is never written to, by policy.
Resilient to GUI modals — a dialog watchdog detects and (optionally) auto-dismisses modal dialogs that would otherwise hang a synchronous COM call forever.
Persistent native daemon — a long-lived C#/.NET daemon holds the COM session and caches the project tree and POU source text, so warm
plc_pou searchruns roughly 500× faster than the old per-call spawn model.
How it works
MCP client (agent)
│ stdio (JSON-RPC, MCP)
▼
index.js ───────────────► Te1000Daemon.exe ──COM/DTE──► XAE Shell (TE1000)
(Node 20) named pipe (persistent, x64, running TwinCAT project
daemonClient.js net472, STA COM session)
toolSchemas.jsTwo cooperating processes:
Node MCP front (
index.js) — speaks MCP/JSON-RPC over stdio, validates input with zod, single-sources every tool's input schema fromtoolSchemas.js, enforces the confirmation-token guards, and maps each toolactiononto a fine-grained bridge action name. It routes those actions to the daemon over a named pipe (daemonClient.js).Native daemon (
daemon/Te1000Daemon.exe) — a persistent net472/x64 process that acquires the DTE +ITcSysManageronce and keeps them, runs the dialog watchdog on an internal thread, caches the System Manager tree and POU source text, and serves the front over the pipe. It implements the same 164 bridge actions and returns the same JSON, so the tool surface is unchanged.
Pipe protocol
The front and daemon exchange newline-delimited JSON over \\.\pipe\te1000-mcp
(name overridable via TE1000_DAEMON_PIPE):
request: {"id": "<n>", "action": "<bridge_action>", "payload": { … }}
response: {"id": "<n>", "ok": true, "result": { … }}
| {"id": "<n>", "ok": false, "error": "…", "errorKind": "com_error|dialog_blocked|timeout", "dialog": { … }}Responses are correlated by id. The daemon serializes every COM call through a single
STA worker thread, so concurrent pipe clients are safe (XAE serializes anyway). The
daemon also answers two COM-free meta actions used for health checks: ping and
list_actions.
Why a daemon — the performance win
An earlier model spawned a fresh 32-bit powershell.exe bridge (plus a second watcher
process) on every call. Each spawn re-acquired the DTE/ITcSysManager COM handles
(a Running-Object-Table walk + Marshal.GetActiveObject), JIT-compiled the inline
Add-Type Win32 helpers, and — for plc_pou.find/search — re-walked the entire
project tree from the root (O(tree-size), ~2,900 COM round-trips on a full project),
so latency grew with project size.
The persistent daemon removes all of that from the hot path:
Persistent COM session (
ComSession.cs) — the DTE + sysmanager are acquired once, health-checked with a cheap property read, and transparently reconnected if stale.Two-layer tree cache (
TreeCache.cs) — per-object decl/impl source text and a flat enumeration of the project's code objects are memoized, so a warm full-project search does zero COM tree-walk. This is the ~500× warm-searchspeed-up.Edit watcher (
EditWatcher.cs) — an on-demandDTE.Documents/.Saveddirty check plus aFileSystemWatcherover the project directory invalidate the cache so it never serves stale source for an object you are editing in the IDE (or that changed on disk).Internal dialog watcher (
DialogWatcher.cs) — runs on its own thread, so there is no per-call watcher process. See Reliability.
Build the daemon with daemon/build.ps1 (in-box .NET Framework MSBuild — no SDK/NuGet).
The daemon requires the 64-bit TcXaeShell (DTE.17.0).
See docs/architecture.md for the end-to-end design and
docs/csharp-daemon-validation.md for the
build/cut-over/validation guide.
Requirements
OS | Windows |
TwinCAT | TwinCAT 3 XAE Shell / XAE installed, with the TE1000 Automation Interface |
Node.js | 20 or newer (the MCP front; the daemon does not remove the Node dependency) |
A running XAE Shell | the server attaches to an already-open instance (it does not launch XAE) |
Daemon (required backend) | the 64-bit TcXaeShell, a .NET Framework 4.x install (for the in-box MSBuild + net472 runtime), and |
The XAE ProgID defaults to TcXaeShell.DTE.17.0. Override it with the TE1000_PROGID
environment variable if your installation differs.
The daemon is not auto-built — build it once with daemon/build.ps1 (see
Build the daemon); thereafter the MCP front auto-spawns the prebuilt
Te1000Daemon.exe on first use. If the exe is absent, build it before the front can serve
calls.
Install
git clone https://github.com/Edge-JB/TwinCAT-XAE-MCP.git
cd TwinCAT-XAE-MCP
npm installVerify the server starts:
node index.js
# -> te1000-mcp server running on stdio (Ctrl-C to exit)The server communicates over stdio and is normally launched by an MCP client, not by hand. Running it directly just waits for a client on stdin.
Build the daemon
The native daemon is the backend, which you build once:
powershell -ExecutionPolicy Bypass -File daemon\build.ps1
# -> daemon\bin\Release\Te1000Daemon.exe (Release, x64, net472)Uses the in-box .NET Framework MSBuild (
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe) — no .NET SDK, no NuGet, no internet. The csproj is old-style (non-SDK) and targetsnet472; the produced x64 exe also runs on the net48 runtime.References
TCatSysManagerLib.dll(embedded interop) for the handful of vtable-onlyIUnknowninterfaces that late-bounddynamiccan't reach (ITcPlcProject, etc.).build.ps1probes the known TwinCAT install paths; if yours differs, edit the<HintPath>indaemon/Te1000Daemon.csprojand rebuild. Pass-Debugfor a Debug build.After building, the MCP front auto-spawns the exe (detached,
windowsHide) on the first call and connects to its pipe. The daemon is single-instance per pipe name (named mutex), so duplicate spawns are harmless, and it is detached so it survives an MCP-front restart. Verify it independently with no XAE attached:node daemon\test-ping.js # spawns the daemon on a test pipe, round-trips ping
The running daemonlocks Te1000Daemon.exe. To rebuild after a code change, stop any
running instance first: Get-Process Te1000Daemon | Stop-Process.
Configure your MCP client
Point your client at the absolute path of index.js in your clone. Example
(Claude Desktop / Claude Code / any MCP client that reads this shape):
{
"mcpServers": {
"te1000": {
"command": "node",
"args": ["C:\\path\\to\\TwinCAT-XAE-MCP\\index.js"]
}
}
}A ready-to-edit copy lives at examples/mcp-config.json.
Environment variables
All optional. The first group is read by the Node front (index.js / daemonClient.js);
the second by the native daemon process. Defaults are from the source.
Read by the Node front:
Variable | Default | Purpose |
|
| XAE Shell COM ProgID to attach to (passed through to the daemon as |
|
| Named-pipe name. The front and the daemon it spawns share this, so a custom value applies to both. |
|
| How long the client waits to connect to (and, if needed, spawn) the daemon before failing the request. |
|
| Node-side per-request ceiling: if no matching response arrives, the request is failed. Set comfortably above the daemon's own ~180 s ceiling so it never pre-empts a legitimately long call. |
| on |
|
| on |
|
|
| How long a blocking dialog must persist before the daemon recycles its COM worker. |
Read by the daemon:
Variable | Default | Purpose |
| unset | When multiple XAE instances are running, prefer the one whose open solution's full path matches this (otherwise the daemon prefers any instance with an open solution). |
| unset |
|
| unset | Explicit path for the daemon diagnostic log (implies logging on, overrides the default location). |
The daemon also accepts CLI flags (
--pipe,--no-watch,--no-autodismiss,--grace-ms,--allowlist). The front sets these from the dialog-watch env vars above when it spawns the daemon — you normally don't pass them by hand.Caveat — spawn-time only.
TE1000_DIALOG_WATCH,TE1000_DIALOG_AUTODISMISS, andTE1000_DIALOG_GRACE_MSare read by the Node front only when it spawns the daemon, and are translated into the daemon's--no-watch/--no-autodismiss/--grace-msflags. The daemon is single-instance per pipe, so changing one of these has no effect on an already-running daemon — kill that daemon process and let the front re-spawn it before the new value takes effect.
Quickstart
With XAE Shell open on your solution, an agent can drive a full configure → build loop. A typical session (tool name + arguments shown):
# 1. Confirm the server is attached and a solution is open
xae action: "status"
# 2. Inspect the IO tree
tc_tree action: "children" path: "TIID^Device 2 (EtherCAT)"
# 3. Add a populated EtherCAT rack from its ESI (digital in/out + analog)
tc_ethercat racks: [{
parent: "TIID^Device 2 (EtherCAT)^R01.Main.N01 (EK1200)",
modules: [{ type: "EL1008" }, { type: "EL2008" }, { type: "EL3064" }]
}]
save: true
# 4. Link a PLC input to a terminal channel
tc_link action: "link"
a: "TIPC^MyPlc^MyPlc Instance^PlcTask Inputs^MAIN.bStart"
b: "TIID^Device 2 (EtherCAT)^Term 1^Channel 1^Input"
# 5. Build the solution
xae_build action: "build"
# 6. (Optional, guarded) download to the target runtime
plc_download confirm: "ALLOW_PLC_DOWNLOAD"More end-to-end recipes — bulk linking, parameter edits via set_xml, POU authoring —
are in examples/.
Tool reference
Paths into the System Manager tree use ^ separators, e.g.
TIID^Device 2 (EtherCAT)^Box 1^Term 5^Channel 1. The leading token is the tree root
(TIPC = PLC, TIID = IO, TINC = NC, TIRC = realtime/license, …).
Engineering & build
Tool | Purpose | Key actions |
| XAE shell & solution control |
|
| Compile the active configuration |
|
| Run a raw DTE command 🔒 | any command name (guarded) |
System Manager tree, IO & linking
Tool | Purpose | Key actions |
| Read/write any tree item (identity, XML params, rename, create, delete) |
|
| Build fully-populated EtherCAT boxes from their ESI |
|
| Link/unlink variables; verify existing links |
|
| Target & rescan helpers |
|
| Bulk variable mapping |
|
| NC motion tree |
|
PLC project & code
Tool | Purpose | Key actions |
| PLC project lifecycle |
|
| Author + surgically edit POUs/DUTs/GVLs (offline) | author ( |
| Library refs / placeholders / repos |
|
| Deploy the active PLC project 🔒 | boot-project (default) or legacy command route |
| Online-session control via UI Automation |
|
Realtime, fieldbus & platform
Tool | Purpose | Key actions |
| RT tasks / cores / linked tasks |
|
| ADS routes |
|
| Engineering settings & archives |
|
| Non-EtherCAT fieldbuses (PROFINET/PROFIBUS/CANopen/DeviceNet/EAP) |
|
| TcCOM module objects |
|
| TwinCAT C++ projects/modules |
|
| Scope + Analytics (TIAN) |
|
| TwinCAT licensing |
|
| Project variant management |
|
Runtime (guarded)
Tool | Purpose |
| Activate the configuration on the target |
| Start/restart the TwinCAT runtime |
🔒 = confirmation-gated. See Safety & guards. Full action signatures, batch semantics, and return shapes are documented in docs/tools.md.
Safety & guards
The server never auto-activates, auto-restarts, or auto-deploys. Any action that
changes the target runtime, deletes a node, or alters licensing is blocked unless you pass
the matching confirm token:
Confirm token | Unlocks |
|
|
|
|
|
|
|
|
|
|
| node/object deletes (or use |
| machine-wide library repository administration |
| ADS route writes |
| TcCOM context changes |
| C++ driver publish |
| live scope acquisition |
| license activation |
Safety project policy. Nothing in this toolchain writes toward the TwinSAFE safety
project. Every authoring tool refuses safety-rooted (TISC) paths via an internal guard.
Safety remains read-only/diagnostic.
Reliability: dialog watchdog & PLC session control
A synchronous DTE/COM call blocks inside XAE's modal message loop if XAE raises a modal dialog (save-changes, "file changed externally", activate confirm, license prompt) — which would hang the MCP call and the calling agent indefinitely.
Dialog watchdog. This runs as an internal thread of the daemon (
DialogWatcher.cs) that polls (~750 ms) for an application-modal dialog owned by the XAE process. It detects application-modal dialogs owned by XAE and either auto-dismisses them (if they match a rule indialog-allowlist.json) or reports the dialog's title, body, and buttons back to the agent and abandons the call. If a non-allowlisted modal persists pastTE1000_DIALOG_GRACE_MS, the daemon recycles its COM worker thread (re-acquiring the session on a fresh STA thread) without killing the daemon, so subsequent calls recover once the dialog is cleared. Detection is dialog-driven, not a wall-clock timeout, so long legitimate builds are never killed. The allowlist ships empty (report-only by default) and must never auto-answer Activate / Run-mode / restart / download / safety prompts.Interactive resolution. When a dialog is not in the allowlist, the reported error tells the agent to ask the user which button to press (and whether to remember it), then call
xae dialog_resolve {button, remember?}. That action clicks the chosen button on the live dialog; withremember:trueit appends an auto-dismiss rule todialog-allowlist.jsonand hot-applies it to the running watcher (no restart). Destructive prompts (activate / run-mode / restart / download / boot project / TwinSAFE / safety) are refused for auto-remember — the one-time chosen click still happens, but no rule is persisted (rememberRefusedis reported). Usexae dialog_probe(read-only) to inspect the current dialog first.PLC session control (
powershell/plc-session.ps1) uses UI Automation to read and toggle the Login/Logout state (the DTE Login/Logout commands are unreachable on the 64-bit shell).plc_downloadauto-logs-out first (by default) so deferred source edits compile before the boot project is generated. It never logs back in.
Full details: docs/operations.md.
Troubleshooting
Te1000Daemon.exe not found— build it:daemon\build.ps1. The front cannot serve calls until the daemon is built.Build fails on
TCatSysManagerLib— the DLL wasn't found at the probed TwinCAT paths. Edit the<HintPath>indaemon/Te1000Daemon.csprojto your install and rebuild.Rebuild fails with the exe locked — a daemon is still running. Stop it first:
Get-Process Te1000Daemon | Stop-Process, then rebuild.Daemon won't start / stale behavior — kill it (above) and let the front re-spawn a fresh one on the next call. Enable
TE1000_DAEMON_DEBUG=1to capture%TEMP%\te1000-daemon-<pipe>.log.Wrong XAE instance picked (several open) — set
TE1000_MCP_SOLUTION_PATHto the solution's full path to pin the daemon to that instance.A modal dialog is blocking calls — clear it on the machine, or add a rule to
dialog-allowlist.json(never for Activate / restart / download / safety prompts). The daemon picks up the allowlist on start.
Examples
The examples/ directory contains:
mcp-config.json— a drop-in client configuration.README.md— copy-pasteable recipes: building an EtherCAT rack, bulk-linking IO, editing terminal parameters viaset_xml, authoring a POU, and a safe build → activate → download flow.
Documentation
Document | What's in it |
The Node-front + persistent C#/.NET daemon design end to end — pipe protocol, COM session, caching, edit-watching | |
Complete tool & action reference — signatures, batch semantics, return shapes | |
Dialog watchdog, PLC session control, and the safety/guard model in depth | |
Survey of the full TE1000 Automation Interface surface (the menu these tools are carved from) | |
The 164-action port coverage checklist (bridge action → C# handler) | |
Build, cut-over, and live-XAE smoke-test guide for the daemon | |
Running engineering notes / backlog discovered on real projects | |
Version history |
Contributing
Contributions are welcome — see CONTRIBUTING.md for the architecture, the daemon build/dev loop, the action-handler contract, and the safety rules every change must respect. In short:
npm run check # node --check index.js — syntax-validate the front
node daemon\test-ping.js # daemon process + pipe + JSON round-trip (no XAE)
powershell -ExecutionPolicy Bypass -File daemon\build.ps1 # rebuild the daemon after a C# changeLicense
MIT © Edge Automation.
Legal & trademarks
This is an independent, third-party project. It is not affiliated with, endorsed by, sponsored by, or supported by Beckhoff Automation GmbH & Co. KG.
All product names, logos, and brands are the property of their respective owners:
Beckhoff®, TwinCAT®, TE1000, and XAE Shell are trademarks or registered trademarks of Beckhoff Automation GmbH & Co. KG.
EtherCAT® is a registered trademark and patented technology, licensed by Beckhoff Automation GmbH, Germany.
These names are used for identification and descriptive purposes only; their use does not imply any affiliation with or endorsement by the trademark holders.
This project does not include, bundle, or redistribute any Beckhoff software. It automates a separately installed and licensed TwinCAT 3 / TE1000 environment that you must obtain from Beckhoff yourself. You are responsible for complying with all applicable Beckhoff license terms and for any action this tool performs against your engineering or runtime systems.
The software is provided "AS IS", without warranty of any kind, under the MIT License. See NOTICE for the full attributions.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Edge-JB/TwinCAT-XAE-MCP'
If you have feedback or need assistance with the MCP directory API, please join our Discord server