Skip to main content

gx3-cli-mcp

日本語 · English · 简体中文 · 한국어

PyPI Python CI License gx3-cli-mcp MCP server

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-mcp

Python 3.10+. Use gx3-cli for the CLI and gx3-mcp-server for 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.gx3

guide 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.svg

For 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 next

Then 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.gx3

Many 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? trace-device, interlock-check
Where is this device written or read? xref where-used, xref downstream
What does this program do? rung-text, ladder-print, metrics
Export a ladder diagram as an SVG image ladder-export-svg PROGRAM --root PROJECT -o ladder.svg
What comes from outside the PLC? external-inputs, comm-refresh
What can never be true? dead-logic
What looks wrong? lint PROJECT (duplicate coils, multi-writer, operand widths, types)
What changed between versions? diff, semantic-diff
Did it read the project correctly? roundtrip

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

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.

gx3-mcp-server on Glama

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.

Metadata

Release files for gx3-cli-mcp 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gx3-cli-mcp 0.4.0
File Size Uploaded Provenance Actions
gx3_cli_mcp-0.4.0.tar.gz 502.4 kB With provenance Details for gx3_cli_mcp-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gx3-cli-mcp 0.4.0
File Interpreter ABI Platform Actions
gx3_cli_mcp-0.4.0-py3-none-any.whl Python 3 none any Details for gx3_cli_mcp-0.4.0-py3-none-any.whl

Total release size: 1.1 MB

Release files / gx3_cli_mcp-0.4.0.tar.gz

Download URL gx3_cli_mcp-0.4.0.tar.gz
Size 502.4 kB
Tags Source
SHA-256 checksum
How to use checksums
84a99d3a1536e4b2faa7fdee09265aa82ad17deca985326e1ec642718a5a2e7b
BLAKE2b-256 checksum
How to use checksums
7a96713612e658043522a79e7b5498f075c27213a52d31c2fed9c493654f4828
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Release files / gx3_cli_mcp-0.4.0-py3-none-any.whl

Download URL gx3_cli_mcp-0.4.0-py3-none-any.whl
Size 559.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
35fde95152af7e0dbbe3f1005cc7597877e5afc585addeca04e62ad2ea0baf11
BLAKE2b-256 checksum
How to use checksums
9d6f3b574ffb00aef99839ec8541f922cc1fc5733cd476b0b6f41ff734059502
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Security for gx3-cli-mcp 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for gx3_cli_mcp-0.4.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page