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 — full documentation


Why TcKit

LLMs do not get smarter when you give them more tokens. Quality degrades as context fills up — Anthropic call this context rot, and PLC projects are an unusually fast way to trigger it: a single .TcPOU file is XML wrapped around code, easily thousands of lines for one function block. Pasting one in to ask about one method poisons the rest of the conversation.

TcKit is the layer in between. Instead of dumping files at the model, it exposes six capabilities shaped around the patterns Anthropic recommends for agent tools: layered just-in-time reads, a single source of truth for writes, and structured results from builds and tests.


What it solves

Problem What goes wrong without it TcKit's answer
Context rot as tokens accumulate Whole-POU paste to ask about one method ProjectReader — three precision levels from project structure → POU interface → single item
Pre-loading vs just-in-time retrieval Stuffing library manuals into context "just in case", or hallucinating vendor FB signatures DocsSearcher — fetch the one relevant doc page on demand
Drifting sources of truth Hand-edited XML diverging from project cross-refs; agent-invented GUIDs ProjectWriter — every structural change goes through the IDE, which stays authoritative
Unstructured tool output Scraping raw build/test logs for the one line that matters BuildRunner and TestRunner — parsed, structured results
Stable surface under churn Re-prompting every time the underlying tooling shifts Ports & adapters — swap the adapter, the tool shape stays the same

The six capabilities

Each port is the stable contract; adapters are interchangeable implementations behind it.

ProjectReader — read project structure and code at three precision levels. get_structure · get_pou_interface · get_pou_item · get_gvl · get_dut Why this shape: the agent pulls only what it needs, no whole-file dumps.

ProjectWriter — structural writes via the IDE, never raw XML. open_project · create_project · add_pou · add_method · update_pou_item Why this shape: the IDE owns GUIDs, cross-refs, and tree state. One source of truth.

BuildRunner — build, deploy, and runtime control with structured diagnostics. build · deploy · start_runtime · get_status Why this shape: errors come back as {file, line, message, severity}, not log scrape.

TestRunner — run unit tests and return parsed results. run_tests · wait_complete · get_results · get_status Why this shape: a suite/test tree the agent can act on; failing assertions point straight at a POU item.

DocGenerator — render documentation from comments embedded in the ST source. generate · get_status Why this shape: code-as-source-of-truth for docs. No drifting wiki.

DocsSearcher — fetch vendor documentation pages on demand. find_fb · find_library · search · get_page Why this shape: one page, fetched when needed — instead of pre-loading manuals or hallucinating signatures.

See Capabilities on the docs site for the full method tables and rationale.


Architecture

AI agent (any MCP client)
        │  MCP protocol
        ▼
 TcKit MCP Server          (Docker)
        │
        ├── ProjectReader  ──► reader adapter
        ├── ProjectWriter  ──► writer adapter      ──┐
        ├── BuildRunner    ──► build adapter       ──┤ Windows bridge
        ├── TestRunner     ──► test adapter        ──┤ (PowerShell → XAE)
        ├── DocGenerator   ──► doc-gen adapter        │
        └── DocsSearcher   ──► docs-search adapter ──┘
                                        │
                                  TwinCAT XAE
                                        │
                                   PLC / VM

Adapters are isolated behind port interfaces (Python ABCs). The server only calls ports — never adapters directly. Adapters may only import from ports and stdlib.


Quick Start

[!CAUTION] TcKit is an engineering tool for development environments. The deploy and start_runtime tools write to and restart a running PLC. By default these require explicit confirmed=True — always verify the target NetId. Set SAFETY_CONFIRMATIONS=false only on closed networks. Set BLOCKED_NETIDS=<netid>,... to permanently block targets (e.g. a production PLC); blocked NetIds cannot be bypassed even with confirmed=True.

Requirements (both paths): Claude Code, TwinCAT 3.1 Build 4026 + TcXaeShell on a Windows host (only for write/build/deploy/test; reads work without it). The Windows bridge service runs natively in PowerShell.

Plugin (recommended)

Needs uv installed (pip install 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 prompts and writes ~/.tckit/config.toml. The MCP server runs as uvx tckit, fetching the package from PyPI on first use.

Docker (opt-in)

For users who want isolation, multi-client setups, or a remote-server install:

git clone https://github.com/georgeturneruk/tckit
cd tckit
# In Claude Code:
> /tc-config init        # pick "docker" mode, fill in prompts

docker compose -f docker/docker-compose.yml up -d
claude mcp add --transport sse tckit http://localhost:8000/sse

You can install the plugin separately just for the skills.

Bridge (both paths)

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

.\bridge\Start-Bridge.ps1

Status

Capability State
ProjectReader Complete
DocsSearcher Complete
DocGenerator Complete
ProjectWriter Complete
BuildRunner Complete
TestRunner Planned

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.0.tar.gz (133.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.2.0-py3-none-any.whl (64.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tckit-0.2.0.tar.gz
  • Upload date:
  • Size: 133.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.2.0.tar.gz
Algorithm Hash digest
SHA256 109fad97562e23b1ae262cd9b201b56e9456af9e9e864190251cabfb6d670945
MD5 d51f01464bc492fb9bea02898d0beb10
BLAKE2b-256 6e45239dd42768e3db8cf0164a42d82ba03fe3db40f58ea168b14bb730616a79

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: tckit-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 64.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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fd24ff600262eaa266d6565c5dc691dcef05385e7c6241d393169cf5ff7c7122
MD5 ddf0e5dea99f48200ed1771119d2b6ce
BLAKE2b-256 2561a65e0cc6c9b876660513da6567f8af39da9938cdcbad9f7fa6705ebd11aa

See more details on using hashes here.

Provenance

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