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.2.1.tar.gz (411.1 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.2.1-py3-none-any.whl (99.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for tckit-0.2.1.tar.gz
Algorithm Hash digest
SHA256 b987c5ab61d963049988750014c341267b1232801997b21ea140a4724be5dfe2
MD5 0829b8970bfc9d9acfb21bfdff7f29a5
BLAKE2b-256 e4e0c637fe17f2338f9c12a305d25f9a4f3f60a87b478d16c298330097ef5d4f

See more details on using hashes here.

Provenance

The following attestation bundles were made for tckit-0.2.1.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.2.1-py3-none-any.whl.

File metadata

  • Download URL: tckit-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 99.6 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.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1662bfa6e7cfb972c517361b73754a036fe41ccc1ac28593c3d2e834964f6901
MD5 ac789119910ac31f6de443d1b366062d
BLAKE2b-256 0aa29faa2df17d6287132a5a9afe1e6a23c1ab63c3e120ed6be84d8c45f1a0ca

See more details on using hashes here.

Provenance

The following attestation bundles were made for tckit-0.2.1-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