Codesys MCP Setup for VS Code using Johannes's instructions, https://mcpservers.org/servers/johannesPettersson80/codesys-mcp-toolkit
A Model Context Protocol (MCP) server for CODESYS V3 programming environments. This toolkit enables seamless interaction between MCP clients and CODESYS, allowing automation of project management, POU creation, code editing, and compilation tasks via the CODESYS Scripting Engine.
By adding this to VS Code, you can add more scripting functions and build a knowledgebase from the libraries available. This will enable vibe and spec coding using any coding agent available.
Scripting Functions
open_projectcreate_projectsave_projectcreate_pouset_pou_codecreate_propertycreate_methodcompile_project
MCP Resources
codesys://project/status: Check scripting status and currently open project state.codesys://project/{+project_path}/structure: Retrieve the object structure of a specified project.codesys://project/{+project_path}/pou/{+pou_path}/code: Read the declaration and implementation code for a specified POU, Method, or Property accessor.
- Open VS Code
- Hit
CTRL+SHIFT+P - Search for
MCP: Add Server
- Select
Install with NPM Package
- Type
@codesys/mcp-toolkitand hit enter This will take you to amcp.jsonfile in VS Code Editor - Edit the file to match these contents
{
"servers": {
"codesys_local": {
"command": "codesys-mcp-tool",
"args": [
"—codesys-path", // path to your Codesys Executable`
"...\\CODESYS\\Common\\CODESYS.exe",
"—codesys-profile", // codesys profile info (exact match)
"CODESYS V3.5 SP20 Patch 2",
"—workspace", // your workspace
"...\\codesys_ws"
],
"type": "stdio"`
}
},
"inputs": []
}
- Restart the server
- Verify if the tools are loaded
- Enable the MCP with the AI chatbot and Enjoy coding!!
Screen.Recording.2026-01-28.at.11.23.31.AM.mov
Screen.Recording.2026-01-28.at.11.29.45.AM.mov
I will continue updating this repo with more functions and add knowledgebases for ease.
Knowledgebase: https://content.helpme-codesys.com/en/libs/index.html (most/all chatbots can scrape through and fetch the correct information from within this list) IEC61131: https://www.isa.org/intech-home/2016/september-october/features/programming-standards-improve-automation-controls Best Practices: https://industrialmonitordirect.com/blogs/knowledgebase/plc-programming-standards-and-best-practices-for-maintainable-industrial-code?srsltid=AfmBOoo-eZO-8yFZP1p5q3V92zLdXW1sHeSexP0YCnbPeqW1vhN69COq
Thank you to everyone in the community!