Skip to main content

AI-assisted development toolchain for TwinCAT 3 PLC engineering

Project description

TcKit

TcKit

An MCP server that gives AI agents a precise, structured view of a TwinCAT 3 project, and the tools to change, build, and test it.

tckit.org for full documentation.


[!WARNING] TcKit is in active development and not yet production-ready. Expect breaking changes between minor versions, rough edges, and missing features.


Why TcKit

LLMs get worse as their context fills up. Anthropic call this context rot. TwinCAT's file format makes it worse: a .TcPOU is XML wrapped around code, easily thousands of lines for one function block. That XML contaminates context the moment it's loaded.

TcKit is the layer in between. It groups six MCP capabilities around three ideas: just-in-time retrieval for reads, a single source of truth for writes, and structured results from builds and tests.

Wired together, the model runs that loop without an engineer walking each cycle: write a method, build, test, fix the failure, build again.

Capabilities

Port Purpose
ProjectReader Layered reads: project structure → POU interface → single method/property
ProjectWriter Structural writes via the IDE so GUIDs and cross-refs stay consistent
BuildRunner Build, deploy, and runtime control with parsed {file, line, message, severity} diagnostics
TestRunner Run TcUnit suites and return parsed pass/fail trees
DocGenerator Render navigable HTML docs from comments in the ST source
DocsSearcher Fetch the one relevant Beckhoff infosys page on demand, no manual pre-loading

Each port is a stable contract; adapters are swappable. See tckit.org for method tables and rationale.

Benchmarks

Head-to-head writer-task runs of TcKit-equipped Claude vs vanilla Claude:

Task Tokens Wall time Tool calls
Add a VAR_INPUT to an FB 2.4× fewer (1,653 → 691) 1.27× faster (27.5s → 21.7s) 5 → 3
Add a method to an FB 2.4× fewer (1,236 → 508) 1.69× faster (26.2s → 15.5s) 5 → 2

N=1 per cell. See bench/findings/ for full methodology and a record of the harness gotchas behind the numbers.

See it in action

The doc generator run against TcUnit is published live at tckit.org/examples/tcunit/. Navigate the function block hierarchy, search the API, drill into a method, all rendered from TcUnit's source code. Under the hood, the same understanding of TwinCAT's XML powers ProjectReader: an agent reads a project the way you would, never loading more than the question needs.

Architecture

AI agent (MCP client) → TcKit MCP Server → Port (ABC) → Adapter → TwinCAT XAE / PLC

The server only calls ports. Adapters may only import from ports and stdlib, never from each other. CI enforces it. Full diagram at tckit.org/architecture/overview/.

Quick Start

[!CAUTION] The deploy and start_runtime tools write to and restart a running PLC. They require explicit confirmed=True by default. Always verify the target NetId. Set BLOCKED_NETIDS=<netid>,... to permanently block targets (e.g. a production PLC).

Requires Claude Code, plus TwinCAT 3.1 Build 4026 + TcXaeShell on a Windows host (only for write/build/deploy/test; reads work without it).

Plugin (recommended). Needs uv. In Claude Code:

/plugin marketplace add georgeturneruk/tckit
/plugin install tckit@tckit
> Set me up for TcKit.

The bundled tc-config skill walks you through setup. The MCP server runs as uvx tckit.

pip. If you'd rather manage the MCP server yourself: pip install tckit, then tckit init to scaffold ~/.tckit/config.toml, then claude mcp add tckit -- tckit.

Docker. CI / containerised dev only. See tckit.org/getting-started/docker-setup/ for the caveats.

Bridge. For write/build/deploy/test, run the bridge in a separate PowerShell window with TcXaeShell open:

.\bridge\Start-Bridge.ps1

Status

All six capabilities are implemented and shipping. See releases for version history.

Contributing

See CONTRIBUTING.md. MIT licence.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tckit-0.3.0.tar.gz (471.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tckit-0.3.0-py3-none-any.whl (204.8 kB view details)

Uploaded Python 3

File details

Details for the file tckit-0.3.0.tar.gz.

File metadata

  • Download URL: tckit-0.3.0.tar.gz
  • Upload date:
  • Size: 471.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tckit-0.3.0.tar.gz
Algorithm Hash digest
SHA256 18fd8b91cbfad295745c7373ac0c696792965f2bcd3a0c4aeda441b745e73f32
MD5 9375da28082b60aed67d817d78ecbf54
BLAKE2b-256 31abb818a810c1c8140c96d4e713563f267470a57758fc931c355a1ab77e62fe

See more details on using hashes here.

Provenance

The following attestation bundles were made for tckit-0.3.0.tar.gz:

Publisher: release.yml on georgeturneruk/tckit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tckit-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: tckit-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 204.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tckit-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 81ce909a6482bc67cdae8fe82168b4b1f5dae463e1add90975cf6e564e657c35
MD5 7d76d4582681328ffa44e582f7038b10
BLAKE2b-256 8a5cc9f14f41f6d0dd11248c5c0de331a010dc8377b824c2a75de3b66e24c950

See more details on using hashes here.

Provenance

The following attestation bundles were made for tckit-0.3.0-py3-none-any.whl:

Publisher: release.yml on georgeturneruk/tckit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page