CODESYS Integrates AI Into PLC Programming via Model Context Protocol
CODESYS Opens the Door to AI-Powered PLC Programming
CODESYS Group announced in March 2026 the integration of Model Context Protocol (MCP) support into the CODESYS Development System V3.5 SP21, making it the first major IEC 61131-3 IDE to offer a standardized interface for large language models to read, generate, and validate PLC code. The feature, released as a technology preview, allows AI assistants to interact with live CODESYS projects while respecting the safety and determinism requirements of industrial control programming.
The announcement is significant because CODESYS is the most widely deployed IEC 61131-3 runtime in the world, powering controllers from over 500 hardware manufacturers including ABB, Bosch Rexroth, Schneider Electric, and WAGO. Any AI capability added to the CODESYS toolchain has immediate reach across a massive installed base.
Model Context Protocol: The Bridge Between LLM and PLC
Model Context Protocol (MCP), originally developed by Anthropic, provides a structured way for AI models to access external tools and data sources. In the CODESYS implementation, the MCP server exposes the project's variable declarations, function block interfaces, hardware configuration, and library dependencies as structured context that an LLM can query and reason about.
Critically, the MCP integration is read-write with gatekeeping. An AI model can propose code changes, but every modification passes through CODESYS's existing static analysis engine and type checker before being applied to the project. Code that violates IEC 61131-3 syntax rules, introduces type mismatches, or references undefined variables is rejected automatically. The engineer retains final approval authority through a diff-review interface before any generated code reaches the controller.
How It Works: From Natural Language to ST Code
The workflow targets Structured Text (ST) as the primary output language, given its procedural syntax and natural mapping to LLM code generation capabilities. An engineer describes a control requirement -- for example, "create a function block that implements a PID controller with anti-windup, auto-tuning gain scheduling based on three operating regions, and configurable output clamping" -- and the AI generates compliant ST code with proper VAR_INPUT, VAR_OUTPUT, and VAR declarations.
The MCP context layer ensures the generated code is aware of the project's existing data types, global variables, and hardware I/O mappings. If the project uses a Beckhoff EL3064 analog input module, the AI generates code that references the correct channel structure and scaling parameters rather than producing generic placeholders.
CODESYS reports that in internal benchmarks, the MCP-assisted workflow reduced function block development time by 45% for experienced engineers and by 70% for engineers new to Structured Text, with generated code passing static analysis on the first attempt in 89% of cases.
What This Means for Engineers
This is not a replacement for PLC programming expertise -- it is an amplifier. The MCP integration is most powerful in the hands of engineers who understand control theory, safety requirements, and process constraints, because they can evaluate and refine AI-generated code with domain authority. The key risk to watch is over-reliance: generated code that compiles and passes static analysis is not automatically correct in a control-theoretic sense. Engineers must validate loop tuning, timing behavior, and failure modes through simulation and commissioning, regardless of whether the code was written by hand or by an AI. The practical recommendation is to start with non-safety-critical utility function blocks to build confidence in the workflow before applying it to core process control logic.