Get the FREE Ultimate OpenClaw Setup Guide →

codesys -toolkit

Model Context Protocol server for CODESYS automation platform

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio johannespettersson80-codesys-mcp-toolkit npx -y @codesys/mcp-toolkit

How to use

The codesys-toolkit MCP server provides a bridge between MCP clients and a CODESYS V3 environment, enabling automated project management, POU creation and editing, and build/compile tasks through the CODESYS Scripting Engine. It exposes operations such as opening and creating projects, saving changes, creating various POU types (Program, Function Block, Function), setting code for declarations and implementations, creating properties and methods on Function Blocks, and triggering project compilation. Clients can interact with these capabilities via MCP commands and use resource URLs like codesys://project/... to inspect status, project structure, and POU code. To use it, install the toolkit globally (via npm) so that the codesys-mcp-tool command is available in your environment, then configure your MCP client to point at the tool with the appropriate CODESYS executable path and profile.

This server is designed to integrate with MCP clients such as Claude Desktop. You can perform operations by sending requests that map to the toolkit’s functions, for example opening a project, creating a new POU, and then compiling the project. The toolkit exposes convenient CLI flags for pointing to the CODESYS installation and profile, and you can wire these into your MCP client configuration or pass them directly when launching the tool from a wrapper.

Typical workflows include: creating a new CODESYS project from a standard template, editing or injecting POU code, adding properties or methods to Function Blocks, and compiling the project to validate changes. Use the provided codesys:// resources to inspect current state and the scripting engine status to ensure your environment is ready for automated tasks.

How to install

Prerequisites:

  • Node.js v18.0.0 or newer
  • npm (comes with Node.js)

Installation steps:

  1. Install the MCP toolkit globally so the codesys-mcp-tool command is available in your PATH:

    npm install -g @codesys/mcp-toolkit
    
  2. Verify installation by running the CLI help to ensure the command is accessible:

    codesys-mcp-tool --help
    
  3. In your MCP client configuration, reference the toolkit either directly (recommended) or via an npx wrapper (less reliable in some environments). If using the direct command approach, configure the server to point to the installed tool and supply the required CODESYS path and profile:

    {
      "mcpServers": {
        "codesys_local": {
          "command": "codesys-mcp-tool",
          "args": [
            "--codesys-path", "C:\\Program Files\\CODESYS\\3\\Devices\\YourDevice\\CODESYS.exe",
            "--codesys-profile", "Your CODESYS Profile Name"
          ]
        }
      }
    }
    
  4. If you cannot use the direct command method, you can fall back to npx, but be aware of potential PATH/environment issues:

    npm install -g @codesys/mcp-toolkit
    codesys-mcp-tool --help
    

Prerequisites recap:

  • A working CODESYS V3 installation with the Scripting Engine enabled
  • Access to a terminal where the codesys-mcp-tool is executable
  • An MCP client configured to use the codesys-toolkit server

Additional notes

Tips and caveats:

  • The toolkit interacts with CODESYS Scripting Engine, so ensure that the engine is enabled in your CODESYS installation and that the target profile is accessible.
  • When configuring via MCP clients, prefer the direct command approach (codesys-mcp-tool) to avoid PATH-related issues that can occur when launching through wrappers like npx.
  • If you encounter 'PATH' or 'command not found' errors, confirm that the npm global bin directory is in your system PATH and that the codesys-mcp-tool binary is visible to the MCP client.
  • Use the codesys:// resource paths to inspect project status and structure, and verify that you are pointing to valid project paths and POU identifiers when reading or editing code.
  • Logs from the MCP client (e.g., Claude Desktop) can help diagnose INTEROP or Python script execution issues; look for INTEROP:, DEBUG:, or ERROR: messages.
  • The toolkit notes mention CODESYS uses Python 2.7 internally; you generally do not need to manage Python versions yourself, but ensure your environment supports the toolkit's interaction with CODESYS.

Related MCP Servers

Sponsor this space

Reach thousands of developers