The Model Context Protocol integrates AI into Codesys for automating PLC engineering, increases efficiency through automated code generation, and improves debugging. It enables secure local solutions and supports developers with AI-assisted tasks such as test scripts or improvement suggestions, while version control ensures traceable changes.
(Image: Codesys)
SPS projects are becoming increasingly complex while also needing to be implemented faster. The Codesys Development System, as the leading IEC-61131-3 platform, offers numerous integrated functions for rapid project development, which simultaneously ensure high code quality, such as automatic syntax completion (similar to Microsoft's 'IntelliSense') or the productivity enhancement tools of the Professional Developer Edition. Additionally, with the Application Composer, complete application code can even be generated based on predefined modules. Whether with or without assistance, it is ultimately the SPS programmer who implements the logic task based on their experience and the available code pool from libraries.
Generative AI as an 'artificial colleague' promises relief from repetitive tasks, but integrating such systems into existing engineering tools has so far been complex and proprietary. Each provider followed their own approach, and unified interfaces were lacking. This is exactly where the Model Context Protocol (MCP) comes into play: Originally developed by Anthropic, the maker of the AI Claude, MCP defines a standardized protocol for data exchange between large language models (LLMs) and external applications. Codesys leverages this protocol with an integrated MCP server. This allows the Development System to be remotely operated by AI systems, creating a new level of human-machine collaboration in the automation environment: the automation task is formulated in natural language, and the AI takes over its implementation directly in the project—visible, traceable, and always adjustable.
Gallery
MCP as a Bridge between Language Model and Control Technology
To understand why the Model Context Protocol (MCP) is relevant to the automation world, it’s worth examining the fundamental limitations of large language models (LLMs). LLMs like GPT or Claude are trained on publicly available data. Their knowledge is limited to a specific cutoff date and does not include current project structures or proprietary libraries. While this suffices for generic questions, a model lacks the necessary context as soon as it is tasked with generating or analyzing PLC code within an active project. MCP addresses this issue through a universal protocol that standardizes information exchange: an MCP server provides defined tools and data access, an MCP client within the language model handles requests and forwards them, and an MCP host—such as Claude Desktop—interacts with the tool. This tripartite structure decouples the AI model from the specific data source, allowing users to switch the underlying LLM without having to rewrite the integration logic.
For Codesys, this means: The integrated MCP server connects the Development System to AI systems in a standardized way. The already existing command interface enables access to project structures, program blocks, libraries, and compiler messages. Complex tasks that a human would otherwise manually code step by step can be delegated via plain text command.
An example: The command ‘Create a function block for a two-point control with hysteresis and instantiate it in the main program’ prompts the AI to generate the block, populate the declaration, insert the instance call, and compile the project—all observable in the open editor. The AI independently identifies compiler errors, develops correction suggestions, and recompiles. This iterative cycle of generating, checking, and correcting runs automatically while the programmer retains control and can intervene at any time. The Codesys MCP server is already successfully communicating with Claude Desktop and OpenAI GPT-5. The prototype for Codesys V3.5 SP22 is currently achieving product status and will be available as a product add-on after its release in spring 2026.
The strength of AI usage via MCP does not lie in spectacular individual functions but in the accumulation of small reliefs that add up to noticeable time savings over a workday. It takes over monotonous tasks such as creating program blocks with instances, manually completing variable declarations, or writing test code. For less experienced developers, this significantly shortens the time to achieve a first runnable result. Instead of looking up syntax and library calls, they can focus on the logic task. Conversely, the AI can explain existing project code, identify structural weaknesses ("code smells"), and suggest improvements—which is also valuable for experienced users. Another use case: Codesys provides an integrated tool for automated testing with the Test Manager, but creating test scripts is time-consuming. The AI can independently generate test cases based on the project structure and library documentation, thereby implicitly contributing to code quality.
The same principles apply to AI as to human users: clear variable names, consistent coding guidelines, comprehensible comments, and clean documentation of the functions and libraries used measurably improve the results. Conversely, the language model can serve as a benchmark: if it doesn’t understand a project, new team members or external service providers will likely struggle as well. While the AI can assist in debugging, it does not replace professional validation before code is deployed to a machine. Version control tools such as Codesys Git document who made what changes and when—an important aspect as increasingly larger portions of an application are generated by machines.
Date: 08.12.2025
Naturally, we always handle your personal data responsibly. Any personal data we receive from you is processed in accordance with applicable data protection legislation. For detailed information please see our privacy policy.
Consent to the use of data for promotional purposes
I hereby consent to Vogel Communications Group GmbH & Co. KG, Max-Planck-Str. 7-9, 97082 Würzburg including any affiliated companies according to §§ 15 et seq. AktG (hereafter: Vogel Communications Group) using my e-mail address to send editorial newsletters. A list of all affiliated companies can be found here
Newsletter content may include all products and services of any companies mentioned above, including for example specialist journals and books, events and fairs as well as event-related products and services, print and digital media offers and services such as additional (editorial) newsletters, raffles, lead campaigns, market research both online and offline, specialist webportals and e-learning offers. In case my personal telephone number has also been collected, it may be used for offers of aforementioned products, for services of the companies mentioned above, and market research purposes.
Additionally, my consent also includes the processing of my email address and telephone number for data matching for marketing purposes with select advertising partners such as LinkedIn, Google, and Meta. For this, Vogel Communications Group may transmit said data in hashed form to the advertising partners who then use said data to determine whether I am also a member of the mentioned advertising partner portals. Vogel Communications Group uses this feature for the purposes of re-targeting (up-selling, cross-selling, and customer loyalty), generating so-called look-alike audiences for acquisition of new customers, and as basis for exclusion for on-going advertising campaigns. Further information can be found in section “data matching for marketing purposes”.
In case I access protected data on Internet portals of Vogel Communications Group including any affiliated companies according to §§ 15 et seq. AktG, I need to provide further data in order to register for the access to such content. In return for this free access to editorial content, my data may be used in accordance with this consent for the purposes stated here. This does not apply to data matching for marketing purposes.
Right of revocation
I understand that I can revoke my consent at will. My revocation does not change the lawfulness of data processing that was conducted based on my consent leading up to my revocation. One option to declare my revocation is to use the contact form found at https://contact.vogel.de. In case I no longer wish to receive certain newsletters, I have subscribed to, I can also click on the unsubscribe link included at the end of a newsletter. Further information regarding my right of revocation and the implementation of it as well as the consequences of my revocation can be found in the data protection declaration, section editorial newsletter.
Security and Local Alternatives
The exchange of data with cloud-based LLMs raises legitimate questions about information security. Companies whose machines and systems must operate offline or whose source code cannot leave the premises require different solutions. In collaboration with Intel, Codesys is working on a research project: using the OpenVINOTM AI runtime, locally optimized language models for PLC code generation are being fine-tuned. These models run without a cloud connection on local Intel processors. They leverage hybrid architectures with discrete GPUs as well as integrated AI acceleration through iGPU and NPU. New Intel CPUs, which are nearing release, significantly reduce hardware requirements, allowing them to be used on mid-performance systems. The advantage: prompts and source code remain fully within the company, while programming assistance is still available. Since the Codesys Development System also uses the MCP interface, public and local models can be easily switched. The technology is currently in a late research phase, with products expected to be available soon. Regardless of whether an external or local model is used, the explainability of AI suggestions remains a central issue. Generative language models can explain their decision processes in natural language, making it easier to assess their quality and usefulness. The challenge lies in maintaining oversight when a model autonomously makes changes to a project. This ties back to version control: with consistent commit logs, it can always be traced which changes were made manually and which were machine-generated.
Outlook: From Tool to Virtual Colleague
The development of AI-supported engineering functions is still in its early stages. Already available is the chatbot for the Codesys online help, which answers technical application questions based on official documentation and avoids hallucinations. This means: if it doesn’t find relevant information, it returns no result. Parallel research projects are underway for context-based code completion for Structured Text. By considering up to 200 lines of program context, its results go well beyond the aforementioned 'IntelliSense' functionality. External partners such as KS Solutions complement the ecosystem with AI-based code conversion between different PLC standards, such as AWL/SCL and ST according to IEC 61131-3.
In the future, highly qualified application specialists will continue to handle the exciting core tasks—but they will work more efficiently and creatively because the 'AI colleague' takes over tedious routine tasks. The focus is shifting from pure implementation to structuring into functional units and their precise problem description. The more accurately the task is formulated, the better the result. Incidentally, this is already true today, independent of AI, when using the aforementioned Codesys Application Composer: clearly described modules are also helpful here. In any case, automated testing and versioning will gain even more importance through AI, increasingly relieving PLC programmers—just like a helpful colleague.