# twincat-mcp [Health: Active]

**Category:** 🏭 Industrial & IoT  
**Repository:** https://github.com/eponce00/twincat-mcp  
**GitHub Stars:** 37  
**Views:** 1  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/twincat-mcp

## Description
MCP server for TwinCAT automation: build, deploy, run TcUnit, and inspect PLC data through ADS from AI clients.

## Claude Desktop Quick Installation
No generated config for this server: it installs through its own setup steps.

The project's own setup steps (from https://github.com/eponce00/twincat-mcp), copied verbatim. Follow them in order; they are not an mcpServers config.

1. Install:

```sh
.\scripts\setup.ps1
```

2. Add to your MCP client:

```sh
.\scripts\install-mcp.ps1
```

## Documentation

## What twincat-mcp does

twincat-mcp connects AI clients to TwinCAT engineering projects and PLC runtimes on Windows. Its operation catalog covers project authoring, builds, deployment, runtime inspection, ADS variable access, TcUnit workflows, object and folder management, and controlled job handling. The server exposes three public MCP tools rather than registering every catalog operation as a separate tool.

The catalog contains operations for both engineering contexts and runtime work. Engineering actions can target a selected solution, PLC, and AMS Net ID. Runtime operations can inspect state and symbols or interact with PLC data through ADS. Workflow operations combine validated catalog steps for tasks such as deployment, testing, state polling, and build verification.

## How it works

Use `twincat_search` to locate relevant operation IDs without loading the complete catalog. Call `twincat_describe` for schemas, prerequisites, and examples for up to five operations, then submit validated work through `twincat_execute`.

Long-running requests return a job handle, status, and bounded progress. `job.wait` waits for completion, while `job.get` inspects a receipt immediately and `job.result` reads large results in pages. A unique UUID `requestKey` makes submitted operations idempotent: resending the same operation, arguments, and key returns the existing receipt instead of executing the work again. Intentional repeats require a new key.

Engineering work starts with `context.open`, which fixes the solution, PLC, target, and optional TwinCAT version for that context. Only one engineering context can own the persistent shell in a server process. Operations that require authorization use scoped grants from `safety.grant`; high-impact operations may also require the literal confirmation value specified by their schema.

## Setup and configuration

The server requires Windows, Python 3.10 or newer, TwinCAT XAE, Visual Studio MSBuild, the .NET Framework 4.7.2 targeting pack, and Beckhoff's `TcXaeMgmt` PowerShell module. Run the PowerShell setup and installation scripts:

```powershell
.\scripts\setup.ps1
.\scripts\install-mcp.ps1
```

Setup creates a virtual environment, updates pinned packaging tools and reviewed dependencies, and builds `TcAutomation.exe` with MSBuild. Configure an MCP client with absolute paths to the virtual-environment Python executable and `mcp-server/server.py`. The installation script can merge an entry into the current VS Code workspace configuration with `-Workspace`. Reload the server in the client after installation.

Optional Scope configuration creation requires TE13xx and a worker built with Scope support. Scope capture and export are disabled; `runtime.record` provides bounded ADS recording instead.

## Tools and capabilities

The three public tools are:

- `twincat_search` searches operation categories and workflows.
- `twincat_describe` returns detailed schemas, prerequisites, and examples.
- `twincat_execute` validates and runs operations, or manages existing jobs.

Supported catalog capabilities include:

- Building projects and verifying expected symbols or types against TMC output.
- Deploying through the existing build, activation, and restart workflow.
- Configuring and running TcUnit tests with a structured report.
- Reading PLC variables and symbol information over ADS.
- Creating, listing, updating, moving, renaming, deleting, and importing TwinCAT or PLCopen project objects.
- Recording bounded runtime data, exporting libraries, and running ordered sequences of up to 32 validated steps.

## Limitations and notes

Scope capture, Scope export, status, stop, and export operations are disabled pending qualification. The server does not provide arbitrary Python or JavaScript execution, and sequences must use catalog operation IDs rather than raw command lines. Nested sequences and control operations are prohibited.

The server is designed as a local trusted stdio service and should not be exposed as an unauthenticated network service. Grants are scoped and expire; revoking one stops later workflow steps, although a native command already dispatched may finish. Existing output files are not overwritten, and library export does not install a library into a repository. Handles from a previous server process expire, and a lost worker invalidates its engineering context.

_Full upstream README: https://allmcps.com/mcp/twincat-mcp/readme_

