CODESYS MCP Tools Explained: Configuration and Practice for AI-Driven PLC Programming
CODESYS MCP Tools Explained: Configura…
Complete guide to configuring and using CODESYS MCP for AI-assisted PLC programming.
This article provides a comprehensive breakdown of CODESYS MCP Server, explaining its three-layer architecture (Host, Client, Server), the 19 tools available for PLC programming tasks, step-by-step configuration for VS Code + Cline and Claude Desktop, and practical demonstrations including automatic traffic light and motion control program generation. It also covers capability boundaries, safety recommendations, and version requirements.
What is CODESYS MCP
MCP (Model Context Protocol) is a standardized, cross-platform, open protocol whose core purpose is to break down barriers between AI models and external resources, enabling large language models to securely and uniformly connect to and invoke various tools, data, and services. MCP was officially released by Anthropic in late 2024, with its design inspired by the success of the Language Server Protocol (LSP) — just as LSP solved the M×N integration problem by standardizing communication between editors and language services, MCP applies the same approach to connecting AI models with external tools. Before MCP, every AI application that needed to integrate external tools required custom integration code, resulting in massive amounts of redundant development work. By defining a unified JSON-RPC 2.0 message format and standardized capability negotiation mechanisms, MCP enables any AI client supporting the protocol to plug-and-play with any tool provided by an MCP Server.
CODESYS is an industrial automation programming platform developed by German company 3S-Smart Software Solutions. It is one of the world's most widely used IEC 61131-3 standard PLC programming environments, adopted by over 500 hardware manufacturers as the development environment for their PLC products. CODESYS has integrated an MCP Server into its IDE, enabling AI large language models to directly invoke tools and resources within the IDE to assist engineers in writing PLC programs.
CODESYS MCP has three key characteristics:
- Standardization: Establishes unified communication and interaction specifications, model-agnostic — any AI client or Agent supporting MCP Client can connect
- Cross-platform: Free from operating system and hardware constraints — both cloud-deployed and locally-deployed large models can use it
- Openness: Adopts an open-source technical architecture, lowering the barrier to entry for developers
CODESYS MCP Architecture Analysis
The CODESYS MCP architecture is divided into three layers. Understanding these three layers helps you quickly complete deployment and configuration.
MCP Host (AI Application Layer)
This is the AI application or AI Agent running the large language model, serving as the user's entry point — responsible for accepting user instructions and displaying processing results. Common MCP Hosts include Claude Desktop, VS Code + Cline, and other AI clients. The core responsibility of the MCP Host is managing user sessions, maintaining conversation context, and deciding when and how to invoke external tools to enhance the AI's response capabilities.
MCP Client (Communication Protocol Layer)
The underlying communication logic layer integrated within the AI client, acting as the "translator" between Host and Server. It automatically parses communication protocols, standardizes high-level semantic instructions, and forwards method calls. The MCP Client is responsible for establishing connections with the Server, performing Capability Negotiation to confirm which tools and resources the Server supports, and then providing this information to the large model so it can decide which tools to invoke during reasoning.
MCP Server (Execution Layer)
A process integrated within the CODESYS IDE, responsible for accepting tasks and executing specific operations, computing and returning critical business data in real time. Users simply need to enable it with one click in the IDE. The MCP Server exposes standardized tool descriptions (including tool names, parameter schemas, and functional descriptions), allowing AI models to understand the purpose and invocation method of each tool.
In practice, users primarily need to focus on MCP Host selection (which large model to use, cloud or local deployment), while the communication process between MCP Client and Server is nearly transparent to the user.
19 Tool Capabilities Provided by CODESYS MCP
The current version (1.0.0.0) provides 19 tools covering the core PLC programming workflow:
Project and Code Operations
- Project Structure Reading: Displays the entire project's hierarchical structure tree, providing AI with a global project view
- Code Reading: Reads and returns structured source code of specified Program Organization Units (POUs) or global objects. A POU (Program Organization Unit) is the basic building block defined in the IEC 61131-3 standard, including three types: Programs, Function Blocks, and Functions. Programs are the highest-level execution units bound to tasks; Function Blocks are instantiable encapsulated modules with internal state and persistent variables, suitable for implementing logic requiring memory such as PID controllers and state machines; Functions are stateless pure computation units.
- Code Editing: Performs precise text replacement operations in existing code, supporting template-based code generation
- Object Management: Creates, removes, and updates objects in the project (POUs, data types, folders, etc.)
Hardware and Library Management
- Device IO Configuration: Exports the topology and detailed IO configuration of hardware devices in the current project
- Library Management: Returns library information lists, including function blocks, functions, and data types from system libraries, application libraries, and custom libraries
- Library Addition: Searches for and adds required libraries to the project manager
Diagnostics and Verification
- Compilation Check: Checks for errors in the project and returns diagnostic information, enabling AI to automatically correct programs based on the results
These tools can essentially meet over 80% of daily PLC programming needs.
CODESYS MCP Configuration Guide
IDE-Side Configuration Steps
- Search for the "MCP Server" plugin (full name: CODESYS Development System MCP Server) in the CODESYS Store and install it
- Check "Enable MCP Connector" in the Tools menu to enable the MCP Server functionality
- Click "Configure Claude Desktop for MCP" to generate the configuration file (STDIO mode)
STDIO (Standard Input/Output) mode is one of two transport mechanisms supported by the MCP protocol (the other being SSE/HTTP Streaming mode). In STDIO mode, the MCP Client launches a local subprocess to run the MCP Server, and both parties communicate via standard input (stdin) and standard output (stdout). The advantages of this mode include no network configuration required, extremely low latency, and high security (data never leaves the local machine), making it particularly suitable for local IDE integration scenarios. In contrast, SSE mode is suited for remote server deployment scenarios, communicating via HTTP protocol.
VS Code + Cline Configuration Method
- Install the Cline plugin from the VS Code extension marketplace
- Register an account and select a language model in settings (multiple model options supported)
- In the MCP Server configuration, copy the configuration file content generated by CODESYS into Cline's MCP configuration
- After configuration is complete, check the tool permissions to grant to the AI
Claude Desktop Configuration Method
Compared to VS Code, Claude Desktop configuration is simpler — clicking the configuration button in the IDE automatically generates the configuration file, and the CODESYS IDE can be recognized in Claude Desktop's Connectors.
Practical Demonstration Results
Automatic Traffic Light PLC Program Generation
In the demonstration, Plan mode was used to have AI generate a two-direction traffic light program for a crossroad intersection. The AI first asked about specific requirements (traffic light type, timing requirements, output method), then planned the program architecture and output the complete program. When compilation errors occurred, the AI was able to read error information by invoking the compilation check tool and automatically corrected the program until compilation passed.
Automatic Motion Control Program Generation
The demonstration showed AI generating a jog control program for a virtual axis, with the following workflow:
- Scanned the project structure to identify existing axis objects
- Searched for standard function blocks such as MC_Power and MC_MoveVelocity in the SM3_Basic library. SM3_Basic is the foundational library in the CODESYS SoftMotion motion control framework, implementing standard function blocks defined in the PLCopen motion control specification. PLCopen is an international industrial automation standards organization whose motion control specification defines a unified set of function block interfaces, enabling engineers to control servo drives from different brands using the same programming approach. MC_Power is used to enable/disable axes, MC_MoveVelocity for velocity mode motion, MC_MoveAbsolute for absolute position positioning, and MC_Stop for stopping motion. These function blocks manage axis motion state transitions through a state machine model, ensuring safe execution of motion commands.
- Generated the control program and automatically handled compilation errors
- Added comments and modified variable references based on subsequent instructions
Interestingly, the quality of AI-generated programs is closely related to the selected large model, and the more detailed the prompts and constraints, the higher the quality of generated programs.
Capability Boundaries and Usage Considerations
Operations Not Supported in the Current Version
- Online monitoring
- Download/Login
- Modifying device tree configuration
- Modifying Task parameters
- Visualization content
Safe Usage Recommendations
- Manual review is mandatory: Critical programs involving motion control, safety circuits, and machine logic must undergo code review
- Compilation success ≠ logical correctness: Comprehensive logical reasoning and cross-verification must be performed in conjunction with actual operating conditions
- Test in simulation environments first: It is recommended to verify logical correctness in virtual environments first
- Version management: Use tools like Git for strict management of project files, logging every modification
- Sensitive information protection: Never provide AI with confidential information such as core device parameters, process flows, or customer data
Version and License Requirements
- CODESYS version 22.1 or above required
- MCP Server plugin requires PDA development tool authorization
- Can be purchased through the CODESYS official store
Summary
The core value of CODESYS MCP lies in enabling AI to operate projects independently like a skilled CODESYS engineer, outputting PLC programs that comply with the IEC 61131-3 standard. IEC 61131-3 is the international standard for programmable logic controller programming languages published by the International Electrotechnical Commission (IEC), first released in 1993 with the latest version being the third edition (2013). This standard unifies global PLC programming language specifications, defining the syntax and semantics of five programming languages (Structured Text, Ladder Diagram, Function Block Diagram, Instruction List, and Sequential Function Chart), as well as fundamental programming models including variable declarations, data types, and program organization units. Programs written in compliance with this standard have good portability and can be migrated between PLC platforms from different manufacturers.
Although the current version (1.0.0.0) is still a basic release, it can already significantly improve programming efficiency and reduce engineers' workload. As subsequent versions iterate and update, its functionality will become increasingly comprehensive, and the AI-assisted PLC programming experience will become increasingly mature.
Related articles

OpenAI Researcher: Spec Documents Are the Real Code
OpenAI researcher Sean Grove argues code is only 10-20% of value—spec documents are the real source code. From Vibe Coding insights to model alignment, why writing specs will be the scarcest skill in the AI era.
Launching on the App Store for Under $…
Launching on the App Store for Under $120: A Full Cost Breakdown of AI-Powered Development
Develop an app with AI coding tools and publish it on the App Store for as little as $99. A detailed breakdown of Apple Developer fees, servers, domains, AI tools, and compliance costs.

In-Depth Review of AI Role-Playing Chat Apps: A Realistic Analysis of High-Freedom AI Companion Experiences
In-depth analysis of high-freedom AI companion chat apps covering character customization and immersive dialogue, with rational comparison to Character.AI and other mainstream AI role-playing products.