festo-codesys-mcp
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
This server publishes no instructions, or was last inspected before Glama recorded them.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": true
} |
| prompts | {
"listChanged": true
} |
| resources | {
"listChanged": true
} |
| completions | {} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| create_function_block | Generate a CODESYS Function Block (.st + PLCopen XML) with the standard interface built in. USE WHEN: the user asks for a new FB and plc_library returned no reusable match. ALWAYS BEFORE: (1) plc_library action=search — never create what already exists; (2) plc_knowledge topics 'conventions' + 'abbreviations'. Standard pattern: bEnable/bExecute inputs, bDone/bBusy/bErr/nErrId outputs, nState state machine. Name auto-corrected to FB_ prefix. DO NOT: use this for servo motion logic — motion uses MC_*_Festo blocks (topic 'festo-ptp'), not custom FBs. |
| create_program | Generate a CODESYS Program (.st + PLCopen XML) for cyclic control logic. USE WHEN: you need a cyclic PRG (runs once per scan) — PRG_Main, PRG_Auto, sequence orchestration — and no reusable one exists. Programs run once per PLC scan (PRG_Main, PRG_Auto, etc.). Name auto-corrected to PRG_ prefix if missing. |
| create_data_type | Generate a CODESYS data type: ENUM (E_*) or STRUCT (ST_*), with .st + PLCopen XML output. USE WHEN: you need an ENUM (state/mode) or STRUCT (config/record) to back FB, GVL, or program declarations. Name auto-corrected to E_ (enum) or ST_ (struct) prefix if missing. |
| create_gvl | Generate a Global Variable List (.st + PLCopen XML) with {attribute 'qualified_only'}. USE WHEN: you need globals shared across POUs — I/O map, system flags, HMI tags (GVL_HMI), config. Name auto-corrected to GVL_ prefix if missing. Common: GVL_Sys, GVL_IO, GVL_HMI, GVL_Cfg. |
| generate_plcopen_xml | Batch-convert a directory of .st files into a single PLCopen TC6 0200 XML for CODESYS import. USE WHEN: .st sources are final and reviewed, and the user wants a CODESYS-importable file. ALWAYS BEFORE: plc_knowledge topic 'ground-truth' (anti-hallucination XML rules) if you have not loaded it this session. ALWAYS AFTER: validate_plcopen_xml -> validate_plcopen_xsd -> validate_plcopen_semantic. Never hand the XML to the user before the chain passes. DO NOT: hand-write PLCopen XML — always generate it from .st sources with this tool. |
| validate_plcopen_xml | Fast smoke check for PLCopen XML — XML well-formedness + 13 structural regex heuristics. USE WHEN: immediately after generate_plcopen_xml, as the fast first gate before the XSD/semantic validators. Use AFTER generate_plcopen_xml as a quick gate before the heavier validators. Checks: XML well-formedness, PLCopen namespace, XHTML namespace, fileHeader, contentHeader, coordinateInfo (fbd/ld/sfc), mandatory instances footer, zero-ID rule on connectionPoints, ST code wrapping in xhtml, inOutVariables on blocks, structural hierarchy. Returns: PASSED/ISSUES counts and VALID/FIX verdict. NOTE: this is a sanity check only. For full validation use:
|
| validate_plcopen_xsd | Strict schema validation against the official PLCopen TC6 v2.00 XSD (embedded). USE WHEN: after validate_plcopen_xml passes and you need strict schema conformance before import. Catches structural issues that the fast sanity check misses: malformed elements, required attributes missing, type mismatches, etc. Use AFTER generate_plcopen_xml for full structural validation before CODESYS import. Output: { gate, valid, summary, errors[{line, location, code, message}], counts } Codes: FILE_NOT_FOUND, XSD_NOT_FOUND, XSD_PARSE_ERROR, XML_PARSE_ERROR, XSD_VIOLATION. NOTE: requires lxml in the MCP python venv. Pair with validate_plcopen_semantic for end-to-end coverage (XSD catches structure, semantic catches missing vars/inits). |
| validate_plcopen_semantic | Compares variable/initializer counts between source .st files and generated PLCopen XML. USE WHEN: after validate_plcopen_xsd passes, to confirm no variables/initializers were silently dropped vs the .st sources. Detects bugs where the generator silently drops variables or initializers:
Use AFTER validate_plcopen_xsd. If XSD passes but semantic fails, the XML is structurally valid but missing content — exactly the silent-failure scenario that caused the 2026-05-22 incident (203 CODESYS errors). Tolerances are configurable; defaults are permissive (-25% vars, -30% inits). Output: { gate, valid, summary, errors[{line, location, code, message}], counts } |
| create_project_structure | Scaffold a standard CODESYS project directory for Festo CPX-E. USE WHEN: starting a new CODESYS project and you need the standard folder scaffold before creating POUs. Creates: src/0_Types, src/1_Globals, src/2_Programs, src/3_FunctionBlocks, src/4_Functions, src/5_Library, export/xml, docs. Set includeExamples=true to pre-populate with E_MachState, GVL_Sys, and PRG_Main stubs. After scaffolding, create files in order: Types → GVLs → FBs → Programs → generate XML. |
| plc_knowledge | Load embedded PLC reference documentation — the source of truth for Festo/CODESYS/EtherCAT/PLCopen. USE WHEN: before writing ANY Structured Text (load 'conventions' + 'abbreviations' first), before generating XML (load 'ground-truth'), before motion code (load 'festo-ptp' + 'ethercat-cia402'), or whenever a technical fact is needed — never answer from memory. Actions: 'topic' (load by name), 'search' (BM25 full-text across ALL topics + manuals), 'list_manuals', 'read_manual'. Topics (27): conventions, abbreviations, hungarian-notation, state-machines, engineering-discipline, ground-truth, xml-rules, plcopen-schema, plcopen-example, plcopen-extensions, festo-cpx, festo-ptp, festo-cdpx-hmi, festo-vtux-terminal, festo-cmmt-st, festo-mqtt, motion-patterns, ethercat-cia402, eplan, hmi-web-architecture, opcua-websocket-gateway, hmi-embedded-deploy, plc-architecture-patterns, plc-alarm-patterns, codesys-recipe-manager, codesys-gotchas, plc-testing-twin. Covers: Festo CPX/PtP/CMMT/MQTT, CODESYS, EtherCAT CiA 402, PLCopen XML, naming conventions, engineering discipline & quality gates, custom Web HMI + OPC-UA gateway, PLC program architecture + alarm design, recipes, testing without hardware, CODESYS gotchas, 19 device manuals. If information is not found here, you may search the web — but suggest saving useful findings to knowledge/manuals/ for future use. |
| debug_plc_code | Static analysis for Structured Text bugs — run BEFORE deploying to a real PLC. USE WHEN: ST code is convention-clean and you need runtime-bug analysis, or the user reports misbehavior. Catches: WHILE/REPEAT loops (watchdog risk), missing error handling (bErr/nErrId), CiA 402 safety gaps (MC_Power without MC_Stop), state machine issues (missing IDLE/ERROR), Hungarian notation violations, REAL-INT type mismatches, unused timer outputs. Returns categorized Critical/Warning/Suggestion results. |
| review_st_codeA | Validate ST code against naming conventions — returns ONLY violations, not reference dumps. USE WHEN: immediately after writing or editing any ST code. Checks: Hungarian notation (b=BOOL, n=INT, r=REAL, t=TIME, fb=FB instance), POU prefixes (FB_, PRG_, FC_), FB interface pattern (bEnable/bDone/bBusy/bErr/nErrId), state machine (0=IDLE, 90=DONE, 99=ERROR), snake_case detection. Includes quick-reference table when violations are found. |
| explain_error_codeA | Decode Festo/CODESYS/EtherCAT error codes using ALL embedded references. USE WHEN: any Festo/CODESYS/EtherCAT error code appears — 0x…, 16#…, drive fault, AL status. Never guess meanings. Accepts hex (0x7500), IEC (16#8011), or decimal formats. Searches: CiA 402, Festo PtP, CODESYS ground truth, ALL embedded topics, and all device manuals. If not found locally, search the web — then save useful findings to knowledge/manuals/ for future use. |
| plc_libraryA | Access the 38-block reusable ST library (30 Function Blocks + 8 shared DUTs) — ALWAYS check here BEFORE creating new FBs. USE WHEN: about to create any FB, or looking for ready-made motor/valve/PID/sensor/safety logic. Actions: 'search' (keyword match), 'list' (browse by category), 'get' (full source code). Categories: types (8), motion (4), actuators (5), sensors (4), safety (2), system (5), utilities (10). Contains ready-to-use blocks for motors, valves, PID, sensors, safety, and more. DO NOT create a new FB if a similar one already exists here. |
| plc_lookupA | Quick lookup for PLC conventions and error codes — instant answers without loading full knowledge topics. USE WHEN: you need a single fact — prefix, state number, error code — without loading a full topic. Try this BEFORE plc_knowledge for point lookups. Actions: 'hungarian' (type→prefix), 'type_prefix' (POU→prefix), 'state' (state number→name), 'error_code' (decode Festo/CiA402/CODESYS error), 'fb_interface' (standard FB pattern), 'list_standard' (full reference). |
| plc_validate | Validate PLC code against conventions — composable validators with consistent results. USE WHEN: you need to check ST against conventions programmatically — naming, FB interface, or state machine — without a full review. Actions: 'naming' (check variable names + Hungarian notation), 'fb_interface' (check FB pattern), 'state_machine' (check nState pattern), 'batch' (validate multiple items at once). Returns {valid, message, details} for each check. |
| st_symbolsA | Index a directory of .st files and navigate symbols across files — dialect-aware (CODESYS V3.5), comment/string-safe, better than grep. USE WHEN: you need to navigate an existing .st project — outline symbols or resolve a definition across files (better than grep). Actions: 'outline' — project map. Returns top-level symbols (functionBlock/program/function/enum/struct/gvl) by default; pass kindFilter to include vars/members (e.g. ["inputVar","globalVar"]). 'definition' — resolve a name (case-insensitive) to its definition(s); requires 'name'. Notes: sourceDir must be inside the workspace unless FESTO_MCP_ALLOW_OUTSIDE_WORKSPACE=1. Line numbers and find-references arrive in a later version (this version returns file + container). |
| st_find_referencesA | Find all references (usages) of an ST identifier across a directory of .st files — token-aware and comment/string-safe (unlike grep: ignores comments, strings, typed literals, and substring matches). USE WHEN: you need every usage of an ST identifier across files before renaming or refactoring. Each reference carries file, line/column, the line text, the containing POU, whether it is the declaration site, and disambiguation hints (e.g. resolves E_X.MEMBER member access via the qualifier). Note: sourceDir must be inside the workspace unless FESTO_MCP_ALLOW_OUTSIDE_WORKSPACE=1. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
| new-function-block | Guide for creating a new IEC 61131-3 Function Block for Festo CPX. |
| new-motion-fb | Guide for creating a Motion Control FB with PLCopen FBs for EtherCAT servo axes. |
| audit-plcopen-xml | Audit a PLCopen XML file for CODESYS import compatibility. |
| new-project | Guide for creating a complete CODESYS project structure with EtherCAT. |
| debug-axis | Guided EtherCAT axis debugging — CiA 402 state analysis, error recovery. |
| new-ethercat-slave | Template for adding a new EtherCAT slave device to a CODESYS project. |
| audit-naming | Audit existing ST code for naming convention violations. |
| decode-error-code | Look up an error code in the embedded references and produce a recovery plan. |
| validate-st-batch | Run naming + structure + PLCopen XML validation across an entire directory of .st files. |
| convert-manual | Guide for converting a PDF manual section to .md format for the knowledge base. |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
| naming-conventions | PascalCase + Hungarian Notation rules. MUST READ before writing any PLC code. |
| abbreviation-dictionary | Standard abbreviations for PLC variables (Pwr, Vel, Pos, Acc, Err, Sts, Cmd, Rdy, etc.). |
| hungarian-notation | Hungarian Notation rationale and complete reference — why PLC uses it, all prefixes. |
| state-machine-patterns | Standard state machine patterns for Function Blocks. |
| engineering-discipline | Engineering discipline & quality gates (non-negotiable) — verify before deliver, no regressions, zero pending issues, secret/safety hygiene, no over-engineering, definition of done. |
| codesys-ground-truth | CODESYS Bible — anti-hallucination, XML DNA, motion FB signatures. HIGHEST AUTHORITY. |
| plcopen-xml-protocol | PLCopen XML mandatory rules for CODESYS import. |
| festo-cpx-reference | Festo CPX-E platform — modules, EtherCAT, CiA 402, libraries. |
| festo-ptp-reference | Festo PtP Package — all 24 MC_*_Festo FB signatures, error codes, enums, properties. MANUFACTURER REFERENCE. |
| festo-motion-patterns | PLCopen Motion patterns for Festo (MC_Power, MC_Home, MC_MoveAbsolute). |
| ethercat-cia402 | EtherCAT CiA 402 drive profile — state machine, controlword, statusword, PDO mapping, fault recovery. |
| eplan-reference | EPLAN Platform reference — .NET API, Data Portal REST API, EDZ format, integration patterns with CODESYS/Festo. |
| festo-cdpx-hmi | Festo CDPX operator unit — HMI + PAC, Designer Studio, TargetVisu, WebVisu, CPX-E integration. |
| festo-vtux-terminal | Festo VTUX valve terminal — pneumatic valve control, CPX-AP-A/I, EtherCAT PDO mapping, vacuum. |
| festo-cmmt-st | Festo CMMT-ST stepper drive + EMMT-ST motor — CiA 402, absolute encoder, PLCopen FBs, homing methods. |
| festo-mqtt-iiot | CODESYS MQTT IIoT Library — MQTTClient, MQTTPublish, MQTTSubscribe FBs, JSON utilities, Topic Alias, QoS levels. |
| plcopen-xml-schema | Official IEC 61131-10 Ed 1.0 PLCopen XML Schema (XSD). Definitive structure reference for XML generation. |
| plcopen-xml-example | Official PLCopen XML example — 6 POUs (IL, ST, LD, FBD, SFC) with complete structure. |
| plcopen-extensions | PLCopen XML extension schemas — AddData, vendor extensions, event tasks. |
| hmi-web-architecture | Custom Web HMI architecture for CODESYS PLCs — three-layer SPA/WebSocket/OPC-UA design, tag manifest, PLC-hosted SPA, push data flow, write safety. |
| opcua-websocket-gateway | OPC-UA↔WebSocket gateway (Python/asyncua) — layered backends, asyncio loops, dynamic address-space browse, WebSocket JSON protocol, robustness patterns. |
| hmi-embedded-deploy | Deploying a Web HMI to embedded panels (Chromium 69 / ARMv7) — panel constraints, CSS/JS restrictions, unified panel installer, cross-arch build, PLC web server deploy. |
| plc-architecture-patterns | PLC program architecture — Input-Process-Output skeleton, CASE/IF/rungs rule, emergent coordination via a shared status bus (no orchestrator), mode MUX, ladder→ST bridge, why NOT GoF patterns in ST. |
| plc-alarm-patterns | PLC alarm design — STALL/TIMEOUT/DEVICE categories by time management, stuck-vs-slow heuristic, station×10+cause fault codes, boot-fault masking with an on-delay (STO during enable). |
| codesys-recipe-manager | CODESYS Recipe Manager — RecipeManCommands API, ReturnValues/InfoValues codes, .txtrecipe format, and gotchas (wildcard rejected, silent path rejection, no PLCopen XML export, unreliable auto-save). |
| codesys-gotchas | CODESYS gotchas — cosmetic device-editor crash, lost edge/pulse handoff between PROGRAMs, PersistentVars list vs the attribute, chronic runtime-crash triage method. |
| plc-testing-twin | Testing Structured Text without hardware — the Python twin method, scan-based TON/TOF timers, discriminative physical-result tests, swept-AABB/CCD collision to derive safe motion thresholds. |
| library-catalog | Complete catalog of reusable PLC Function Blocks (motion, sensors, safety, utilities, etc.) |
| E_AxisState | E_AxisState — Axis State Machine States |
| E_CpxModule | E_CpxModule — CPX-E Module Type Enumeration |
| E_CylinderType | E_CylinderType — Pneumatic Cylinder Classification |
| E_DriveType | E_DriveType — Motor/Drive Classification |
| ST_AlarmEntry | ST_AlarmEntry — Alarm/Event Record |
| ST_AxisConfig | ST_AxisConfig — Axis Configuration Parameters |
| ST_EtherCatDiag | ST_EtherCatDiag — EtherCAT Slave Diagnostic Data |
| ST_SensorConfig | ST_SensorConfig — Analog Sensor Configuration |
| FB_AxisScaler | FB_AxisScaler — Axis Unit Conversion (mm/pulses, mm-s/Hz) |
| FB_BrakeMotor | FB_BrakeMotor — Motor with Electromagnetic Brake |
| FB_StandardMotor | FB_StandardMotor — Direct-On-Line Motor with Contactor |
| FB_VfdDrive | FB_VfdDrive — Variable Frequency Drive Controller |
| FB_ButtonLamp | FB_ButtonLamp — Illuminated Pushbutton Controller |
| FB_PneumaticCylinder | FB_PneumaticCylinder — Pneumatic Cylinder Controller |
| FB_PumpManager | FB_PumpManager — Dual Pump Coordination with Failover |
| FB_SolenoidValve | FB_SolenoidValve — Solenoid Valve Controller |
| FB_TankHeater | FB_TankHeater — Tank Heater with Thermostat and Freeze Protection |
| FB_AnalogInput | FB_AnalogInput — Generic Analog Input with Scaling and Filtering |
| FB_FlowSensor | FB_FlowSensor — Flow Rate Sensor with Totalization |
| FB_LevelSensor | FB_LevelSensor — Tank Level Sensor with Alarms |
| FB_TemperatureSensor | FB_TemperatureSensor — Universal Temperature Sensor Interface |
| FB_FaultDetection | FB_FaultDetection — Multi-Input Fault Consolidation |
| FB_LightCurtain | FB_LightCurtain — Safety Light Curtain Monitor |
| FB_DataLogger | FB_DataLogger — Cyclic Data Logger to CSV File |
| FB_EventLogger | FB_EventLogger — Circular Event Buffer Logger |
| FB_FtpUploader | FB_FtpUploader — FTP File Upload via State Machine |
| FB_PasswordHash | FB_PasswordHash — FNV-1a 64-bit Password Hash with Salt (local ACL) |
| FB_SystemMonitor | FB_SystemMonitor — System Watchdog and Diagnostics |
| FB_AnalogFilter | FB_AnalogFilter — First-Order Low-Pass / Moving Average Filter |
| FB_Blink | FB_Blink — LED/Output Blink Pattern Generator |
| FB_Debounce | FB_Debounce — Digital Input Debounce Filter |
| FB_DelayedOutput | FB_DelayedOutput — Output with Post-Run Timer |
| FB_Hysteresis | FB_Hysteresis — On/Off Control with Deadband |
| FB_MqttPublisher | FB_MqttPublisher — Simplified MQTT Publish with Auto-Reconnect |
| FB_PidController | FB_PidController — Generic PID Controller with Anti-Windup |
| FB_ScaleInt | FB_ScaleInt — Linear INT Value Scaling |
| FB_ScaleReal | FB_ScaleReal — Linear REAL Value Scaling |
| FB_Totalizer | FB_Totalizer — Flow/Energy Integrator with Reset |
| manual-WEG_CFW100_Reference | User manual: WEG_CFW100_Reference (24 KB) |
| manual-festo-cpx-e-ec-coe-dictionary | User manual: festo cpx e ec coe dictionary (36 KB) |
| manual-festo-cpx-e-profinet-config | User manual: festo cpx e profinet config (15 KB) |
| manual-festo-cpx-io-python-setup | User manual: festo cpx io python setup (2 KB) |
| manual-festo-cpx-module-catalog | User manual: festo cpx module catalog (28 KB) |
| manual-festo-datalogging-ftp | User manual: festo datalogging ftp (5 KB) |
| manual-festo-opc-da-server | User manual: festo opc da server (4 KB) |
| manual-festo-point-to-point | User manual: festo point to point (75 KB) |
| manual-festo-synchronized-drive-control | User manual: festo synchronized drive control (11 KB) |
| manual-hw-cmmt-as-s1-reference | User manual: hw cmmt as s1 reference (35 KB) |
| manual-hw-cmmt-servo | User manual: hw cmmt servo (34 KB) |
| manual-hw-cpx-e-cec | User manual: hw cpx e cec (20 KB) |
| manual-hw-cpx-e-ethercat | User manual: hw cpx e ethercat (22 KB) |
| manual-hw-cpx-e-io | User manual: hw cpx e io (21 KB) |
| manual-hw-cpx-e-speciality | User manual: hw cpx e speciality (25 KB) |
| manual-hw-cpx-e-system | User manual: hw cpx e system (27 KB) |
| manual-hw-index | User manual: hw index (2 KB) |
| manual-hw-motion-library | User manual: hw motion library (19 KB) |
| manual-hw-safety-relay-weidmuller-scs | User manual: hw safety relay weidmuller scs (9 KB) |
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/efranceschetti/festo-codesys-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server