gx3-mcp-server
Read-only MCP server for analyzing GX Works3 (.gx3) ladder projects without opening GX Works3 — trace circuits, cross-reference devices, lint, diff versions, and export SVG.
Explore available commands — list every read-only CLI command the server will run (
gx3_list_commands).Trace a device — derive ON/OFF/hold conditions from ladder topology with MC-zone and multi-coil warnings (
gx3_trace_device).Check interlocks — decide whether two coils can be ON at the same time, with a witness assignment (
gx3_interlock_check).Cross-reference devices — list writers/readers with POU name and step (
gx3_xref_where_used; needs xref DB).Follow data flow — conservative argument-level value-flow edges, unresolved ops flagged (
gx3_data_flow).Lint the project — duplicate coils, multi-writers, unused devices, type/width problems, alarm quality (
gx3_lint).Find dead logic — contacts that can never close, unread writes, unmatched SET latches (
gx3_dead_logic).Map device usage — per-type density and candidate free gaps (
gx3_device_map; needs index-lite).Inventory alarms — triggers, latching, timer setpoints, reset paths (
gx3_alarm_map).Diff versions — rung-level added/removed/changed, matched by block GUID (
gx3_semantic_diff).Map the network — IPs, CC-Link/SCON stations, safety relationships from project files only (
gx3_network_map).Export a ladder as SVG — save an image or return SVG text, with
device/pos_rangefilters (gx3_ladder_export_svg).Print ladder text — GX Works3 print-text layout for quoting a circuit verbatim (
gx3_ladder_print).Explain a snapshot — match a captured device snapshot against static enable conditions; files only, no PLC connection (
gx3_explain_snapshot).Replay captured logs — normalize, time series, change points, or export an instant as a snapshot (
gx3_replay_capture).Escape hatch — run any MCP-allowed, project-read-only CLI command with explicit args (
gx3_run_command).
All tools are read-only; generated CSV/JSON/SVG artifacts stay under GX3_MCP_OUTPUT_DIR.
Provides read-only analysis tools for Mitsubishi Electric GX Works3 (.gx3) PLC projects, enabling inspection of project structure, device usage, cross references, ladder conditions, communication boundaries, and static quality signals.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@gx3-mcp-server trace device M100 in the demo project"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
gx3-cli-mcp
Analyze GX Works3 projects and export ladder diagrams as SVG, without opening GX Works3.
Reads a GX Works3 .gx3 project on your own machine and answers questions
about it — where a device is written, what has to be true for a coil to turn
on, which conditions come from outside the PLC, which branches can never be
true. Read-only: it never writes back to the project.
It is a CLI, and the same analysis is a stdio MCP server, so an AI agent can answer from indexed facts instead of guessing at a binary file.
日本語: 三菱電機 MELSEC の .gx3 を GX Works3 を開かずに解析する CLI / MCP
サーバーです。「このコイルがなぜ ON にならないか」をラダーから追います。
読み取り専用で、元のプロジェクトは書き換えません。
中文: 不用打开 GX Works3,也能分析三菱电机 MELSEC 的 .gx3 工程,
从梯形图追查「这个线圈为什么不导通」。只读,不改写原工程。
完整中文说明见 README.zh-CN.md。
Install
python -m pip install -U gx3-cli-mcpPython 3.10+. Use gx3-cli for the CLI and gx3-mcp-server for MCP.
Related MCP server: openplc-engineering-mcp
Try it in 30 seconds
No project needed — generate one:
gx3-cli synthetic-project demo.gx3 --profile demo-line
gx3-cli guide --root demo.gx3guide reads the project and tells you which commands are worth running on it,
and why. That is the answer to "there are sixty commands, where do I start".
Export a GX Works3 ladder as SVG
The dedicated ladder-export-svg command is available from PyPI v0.4.0:
gx3-cli ladder-export-svg 001_LDDB.db --root demo.gx3 -o ladder.svgFor your own project, replace 001_LDDB.db with its program/POU name or
LDDB file name, and demo.gx3 with your .gx3 file or extracted folder.
Use --device M100 or --pos-range 0-100 to narrow the rungs.
If you still use v0.3.0, run
gx3-cli ladder-layout 001_LDDB.db --root demo.gx3 --format svg -o ladder.svg.
Without --format svg, ladder-layout defaults to coordinate JSON.
On a project
gx3-cli doctor --root project.gx3 # does it read?
gx3-cli index-lite build --root project.gx3
gx3-cli xref build --root project.gx3
gx3-cli guide --root project.gx3 # what to run nextThen ask it something:
# where is this device written, and what reads it?
gx3-cli xref where-used M100 --root project.gx3
# why is this coil not turning on?
gx3-cli trace-device M100 --root project.gx3 --strict-logic --compact
# the whole program, one line per rung
gx3-cli rung-text --root project.gx3
# search the comment you remember, not the device number you don't
gx3-cli query-comment "clamp pressure" --root project.gx3Many commands accept --format json for scripting and -o FILE to write
instead of print; check each command's --help. gx3-cli --help lists the
commands by group.
Passing a .gx3 extracts it to .gx3_cache/<sha256>/ and analyses that copy.
What it can tell you
Question | Command |
Why is this coil off? |
|
Where is this device written or read? |
|
What does this program do? |
|
Export a ladder diagram as an SVG image |
|
What comes from outside the PLC? |
|
What can never be true? |
|
What looks wrong? |
|
What changed between versions? |
|
Did it read the project correctly? |
|
Use with an AI agent
{
"mcpServers": {
"gx3": { "command": "gx3-mcp-server" }
}
}Or "command": "python", "args": ["-m", "gx3cli.gx3_mcp_server"] if your
client cannot resolve console scripts from PATH. The server exposes read-only
analysis tools and a restricted command runner.
From v0.4.0, use the dedicated gx3_ladder_export_svg tool with
program, root, and optionally output, device, or pos_range.
Saved files stay under GX3_MCP_OUTPUT_DIR (relative paths start there).
Use an extracted folder as root, or put a .gx3 archive inside that output
directory so its extraction cache also stays inside the boundary.
For a TXT ladder diagram in an answer, use gx3_ladder_print.
See Agent usage guide (JA) for how an agent should drive it.
Scope, honestly
Read-only analysis of ladder data in local .gx3 projects.
It does not edit projects, connect to a PLC to change anything, or replace GX
Works3. live-read can read live device values over MC Protocol/SLMP, CLI-only
and only with explicit connection parameters.
Output is advisory. Verify in GX Works3 and through your own safety process before touching real equipment.
If a project fails to parse, gx3-cli failure-corpus capture turns it into a
local regression sample without sending anything anywhere.
Troubleshooting
7z-style .gx3 — install 7-Zip, or point at it:
set GX3_7Z=C:\Program Files\7-Zip\7z.exe. Encrypted containers are not
decrypted; export the folder from GX Works3 instead.
PyPI blocked — pip install git+https://github.com/purinzan/gx3-cli-mcp.git
Something reads wrong — gx3-cli doctor --root ... first, then
open an issue.
Documentation
User manual (JA) / (EN) / (ZH)
Ladder practical tips (JA) — field-oriented modification and review tips
Security note (JA) — local data handling, read-only MCP policy
Verification tracking — verification tasks and acceptance criteria
Independent validation ledger (JA) — GX Works3 evidence tracked for Issue #49
Doctor acceptance ledger (JA) — project-health acceptance tracked for Issue #135
GX Works3 feature matrix (JA) — standard-feature coverage, gaps, and implementation priorities
File usage guide (JA) — repository map
Analysis benchmark (JA) — synthetic performance baseline and measurement limits
Review questions (JA) — the questions to ask a change before opening a pull request, and the bugs each of them found
Related projects (JA) — other GX Works3/MELSEC tools and what was taken from them
llms.txt — machine-readable summary of what this is and is not
Agent skills: existing project audit · failure corpus
Analysis contract migration
Current query-by-query status and remaining acceptance work for #153: 解析契約の移行台帳.
License
Source-available, not open source. Full terms in LICENSE.txt; this is a summary and the license text governs.
You may read the source and run it for evaluation and internal work, including inside a company. You may not redistribute it, host it as a service, or ship it in a paid product without written permission. There is no licence key, activation or paid plan.
日本語: 社内での評価・業務利用は許諾されています。禁止しているのは再配布、 SaaS 提供、有償製品への組み込みです。実行にライセンスキーや課金は不要です。 商用利用の相談は Issue からどうぞ。
Listed on Glama
Indexed as an MCP server, with per-tool scores for how well each tool describes what it does. Useful as outside feedback on the tool surface — the low scores there are the ones whose descriptions need work.
Contributing: CONTRIBUTING.md · AGENTS.md
For ladder CSV input, use gx3-cli rung-text --csv ladder.csv. See the
CSV parser guide for verified scope and limitations.
Available Tools
16 toolsgx3_alarm_mapA
Inventory every alarm and fault device with what triggers it, whether it latches, any timer setpoint, and what resets it. Answers "what raises this alarm and how is it cleared" without reading the ladder by hand. Reads the project; WRITES a CSV. Interpret clearing from the hold type: a plain OUT clears when its enable logic goes false; SET-latched alarms require a reset path, and self-hold circuits require their seal-in path to drop or reset logic to act. Do not infer a power-cycle requirement merely from an empty RST list. Requires the xref DB.
Inputs: root (required), mode, device.
gx3_data_flowA
Build conservative argument-level source-to-destination value-flow edges. Known transfer and other classified instructions produce edges with argument indexes, ranges, widths, execution condition, and confidence. Unknown or partially parsed operations are returned as unresolved records; no guessed edge is emitted. Device comments are included when available.
Inputs: root (required), device, format, opcode.
gx3_dead_logicA
Find logic that can never do anything: contacts that can never close, NC contacts on always-ON relays, coils and words written but never read, and SET latches with no matching RST. Returns findings grouped by kind with the device, its comment and where it appears. Reads the project; WRITES a CSV under the output directory. Devices refreshed from a network are excluded, since a remote station may be the real reader. Requires the xref DB.
Inputs: root (required).
gx3_device_mapA
Report, per device type, observed LD usage, density, and gaps in the index. Gaps are not verified free allocations: ST/FBD, unresolved accesses and external or reserved allocations are not excluded. Verify them in GX Works3 before adding devices. Read-only; returns a table and writes nothing. Requires the index-lite DB: run gx3-cli index-lite build --root <root> once per project first.
Inputs: root (required), types, min_free.
gx3_explain_snapshotA
Match a captured device snapshot against the enable conditions the static trace produced, and say what the snapshot does not answer for. Reads files only: this never opens a PLC connection, and there is no MCP tool that does. Report the analysis state with the result -- a device the snapshot holds no value for comes back as 'no measured value; file only', and the rows that did evaluate are not the whole answer when that appears. One snapshot explains the instant it was captured, never the cause of a past stop or trip: do not use it to answer 'why did this trip earlier'.
Inputs: root (required), device (required), snapshot (required), format, +3 more.
gx3_interlock_checkA
Static satisfiability check: can two coils' ON/enable conditions be true at the same time? A 'mutually-exclusive' verdict is sound; a 'simultaneous-possible' verdict returns a witness assignment but is not a reachability proof.
Inputs: root (required), device_a (required), device_b (required), max_vars, +1 more.
gx3_ladder_export_svgA
Export a GX Works3 ladder diagram as an SVG image for viewing or documents. Use this when asked to draw a ladder, export SVG, or save a ladder image. Equivalent CLI: gx3-cli ladder-export-svg PROGRAM --root PROJECT -o ladder.svg. Uses the same renderer as ladder-layout --format svg. Pass 'output' to save under GX3_MCP_OUTPUT_DIR; otherwise returns SVG text (large output spills to a file). Filter with 'device' or 'pos_range'. For TXT diagrams use gx3_ladder_print; for coordinate JSON use gx3_run_command with command='ladder-layout'.
Inputs: root (required), program (required), device, output, +1 more.
gx3_ladder_printA
Render a program in GX Works3 print-text layout. This is the output to show a user when explaining how a circuit is wired: quote it verbatim in a code block, never a JSON dump of the same rung. Output can be large; pass 'output' to write it to a file. To emit only the circuit under discussion, use 'list_sections' to discover section titles, then filter with 'section', 'pos_range' (A-B), or 'device'. For an SVG image export, use gx3_ladder_export_svg.
Inputs: root (required), program (required), device, output, +3 more.
gx3_lintA
Run static review checks over the whole project and return a per-check summary with finding counts by severity. Checks: duplicate coils, multi-writers, alarm quality, unused devices, contradictory comments, linked-device writes, and signed/width/division type problems. Reads the project; WRITES one CSV per check plus a JSON summary into the working directory. Findings are advisory: a duplicate coil may be a deliberate SET/RST pair, so report the severity and let the engineer judge. Needs the index and xref DBs for the full check set.
Inputs: root (required), checks.
gx3_list_commandsA
List every project-read-only GX3 CLI command this server will run, with a one-line summary of each. Read-only; touches no project. Call this before gx3_run_command when no typed tool fits, to see what is actually available rather than guessing a command name.
Inputs: no named parameters.
gx3_network_mapA
Map how this PLC is wired to everything outside it: IP addresses, CC-Link and SCON stations, and safety relationships, aggregated into one view. Use it to find which unit or remote station owns a device before assuming the program drives it. Reads the project and the comm detail CSVs; WRITES its own CSVs under the output directory. It does not communicate with any device -- everything is read from the project files.
Inputs: root (required), prefix.
gx3_replay_captureA
Read an already-captured CSV/JSON device log offline: normalize it, emit per-device time series, list value change points, or export one instant as a snapshot for gx3_explain_snapshot. Reads files only and never opens a PLC connection. An imported or polled log is not a scan-synchronized recording: two devices that appear to change together may simply have been sampled together, so do not read ordering between devices out of it.
Inputs: verb (required), input (required), at, root, +2 more.
gx3_run_commandA
Escape hatch: run any MCP-allowed, project-read-only GX3 CLI command with explicit arguments. Project-mutating commands and local demo generation commands are rejected. Local artifacts are confined to GX3_MCP_OUTPUT_DIR. Prefer the typed tools above when one fits; for SVG ladder images use gx3_ladder_export_svg. Both ladder-export-svg and the existing ladder-layout (JSON by default, or --format svg) remain available here.
Inputs: command (required), args, root, timeout_seconds.
gx3_semantic_diffA
Compare two versions of a project rung by rung and return what was added, removed or changed. Rungs are matched by their stable block GUID rather than by position, so inserting a rung does not report everything after it as changed. Use it to review what a revision actually did. Reads both projects; WRITES a detail CSV. Neither project is modified.
Inputs: new (required), old (required).
gx3_trace_deviceA
Trace a device's ON/OFF/hold conditions from exact ladder topology. MC master-control zone conditions are folded into the enable logic, and the output warns on multi-OUT-coil devices and rows below a conditional jump. The output carries each device's comment: keep every device paired with its comment when you report the result, and show the rung itself with gx3_ladder_print rather than describing it in prose.
Inputs: root (required), device (required), ja, compact, +2 more.
gx3_xref_where_usedA
Writers and readers of a device with POU name and real step. The first line carries the device comment; repeat it alongside the device in your answer instead of reporting a bare device number. Requires the xref DB: run gx3-cli xref build --root <root> once per project first.
Inputs: root (required), device (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 16 tools
Each tool targets a distinct analysis question (trace, interlock, xref, data flow, lint, dead logic, alarm, network, snapshot) and the descriptions explicitly disambiguate near-neighbors like ladder_print vs ladder_export_svg vs run_command. The main ambiguity is gx3_run_command, an escape hatch that can reproduce many of the typed tools' outputs, though guidance says to prefer typed tools.
All 16 tools share a consistent gx3_ prefix and snake_case format, which is highly readable. However the internal pattern varies—verb-first (trace_device, explain_snapshot), noun-first phrases (device_map, alarm_map, data_flow), and noun_verb (ladder_export_svg)—so it is not a strict verb_noun convention.
16 tools for a rich PLC static-analysis domain is slightly on the heavy side but each is well-scoped and earns its place through a distinct analysis capability. No redundant or trivial entries.
The read-only analysis surface is broadly complete: viewing, tracing, cross-reference, lint, dead logic, alarm/device maps, diff, network, and snapshot/capture workflows are all covered. Minor gap: prerequisite DB builds (xref build, index-lite build) are explicitly outside the MCP surface, so agents must run them externally before several tools work.
Maintenance
Related MCP Connectors
Read-only MCP for DualSoft AAS 3.0 / AASX specs, DS2 PLC control docs, and 3D line examples.
2,000+ MCP servers read at source level. Know what one does before you connect. Free, no key.
Render, verify, describe, and safely edit Mermaid diagrams through MCP.
Read, analyze, and safely edit Microsoft Project MPP files.
Related MCP Servers
- FlicenseAqualityDmaintenanceAn MCP server for ABB/Hitachi Energy PCM600 that provides offline IEC 61850 SCL file analysis, .apcmp project archive inspection, ACT logic recovery, and safe read-only drive of the PCM600 CLI for project exports and validation.231-
- AlicenseBqualityBmaintenanceEnables MCP-compatible agents to perform read-only inspection of OpenPLC Editor projects, including retrieving project structure and listing programs, function blocks, and functions.31Apache 2.0
- FlicenseAqualityCmaintenanceLets AI agents and users analyze Mitsubishi MELSEC .gx3 projects directly, tracing coil conditions, checking device references, comparing program changes, and inspecting ladder logic without opening GX Works3.134-
- AlicenseAqualityBmaintenanceEnables reading, patching, diffing, packaging, and native compilation of H3U PLC projects offline via MCP, without starting the AutoShop GUI.19MIT