Skip to main content

gx3-cli-mcp

PyPI Python CI License

Local GX Works3 project analysis for engineers and AI agents.

gx3-cli-mcp provides a Windows-first CLI and stdio MCP server for inspecting GX Works3 (.gx3) projects on your own machine. It helps you search devices, comments, cross references, ladder conditions, communication boundaries, and static review signals without modifying the source project.

日本語: GX Works3 (.gx3) プロジェクトをローカルで読み取り解析し、AI エージェントからも使える CLI / MCP サーバーです。プロジェクトを書き換えず、 デバイス、コメント、xref、ラダー根拠、通信境界を確認するための道具です。

This is an unofficial, independent tool. It is not endorsed by Mitsubishi Electric.

What You Can Do

  • Find where a device is used and whether it is read, written, or referenced.
  • Search device comments such as start, stop, alarm, cycle, step, or manual operation keywords.
  • Trace upstream conditions for a coil and print nearby ladder evidence.
  • Build xref and SQLite indexes so AI agents can answer from structured facts.
  • Review static risks such as duplicate coils, multi-writers, dead logic, and interlock possibilities.
  • Inspect external inputs, HMI/communication boundaries, IP maps, link maps, timing candidates, and project-wide summaries.

What It Does Not Do

  • It does not include real customer or production PLC projects.
  • It does not send project data to an online service by itself.
  • It does not provide a GUI in this release.
  • It does not require a license token or paid-plan token.
  • The MCP server does not expose project-mutating commands.

Install

python -m pip install gx3-cli-mcp
gx3-cli --version
gx3-mcp-server --version

Requires Python 3.10 or later. Installing into a virtual environment is recommended so the two console scripts stay off the system PATH.

If your site blocks PyPI, install the latest source directly:

python -m pip install git+https://github.com/purinzan/gx3-cli-mcp.git

For a local source checkout:

python -m pip install -e .

日本語: 通常は pip install gx3-cli-mcp だけで CLI と MCP サーバーの両方が 入ります。社内プロキシで PyPI に到達できない場合のみ、上の git 直接指定を 使ってください。

First Analysis

Run these three commands first for a real project:

gx3-cli doctor --root C:\path\to\project.gx3
gx3-cli index-lite build --root C:\path\to\project.gx3
gx3-cli xref build --root C:\path\to\project.gx3

Then inspect a device:

gx3-cli query-device M100 --root C:\path\to\project.gx3
gx3-cli xref where-used M100 --root C:\path\to\project.gx3
gx3-cli trace-device M100 --root C:\path\to\project.gx3 --strict-logic --compact

When you pass a .gx3 file, the tool extracts it into .gx3_cache\<sha256>\ and analyzes that local cache.

Common Tasks

Goal Command
Check project readiness gx3-cli doctor --root project.gx3
Build the search index gx3-cli index-lite build --root project.gx3
Build cross references gx3-cli xref build --root project.gx3
Look up one device gx3-cli query-device M100 --root project.gx3
Search by comment text gx3-cli query-comment "起動" --root project.gx3
Show external/HMI/communication boundary devices gx3-cli query-external --root project.gx3
Find cycle, step, or state candidates gx3-cli query-cycle --root project.gx3
Show used/free device ranges gx3-cli device-map --root project.gx3 --types M,D,W --min-free 100
Show writers/readers gx3-cli xref where-used M100 --root project.gx3
Trace coil conditions gx3-cli trace-device M100 --root project.gx3 --strict-logic --compact
Print ladder evidence gx3-cli ladder-print <PROGRAM_OR_LDDB> --root project.gx3 --device M100
Check static interlock possibility gx3-cli interlock-check M100 M200 --root project.gx3
Run static review checks gx3-cli lint project.gx3
Create a support summary gx3-cli support-bundle --root project.gx3 -o support.zip

Use the indexed commands above for normal lookup and discovery. Avoid starting AI workflows with raw text search over extracted GX3 files; GX Works3 projects contain binary/database files, and the CLI preserves device, comment, POU, role, and step context.

Use With MCP

The MCP server is intended for AI clients that support stdio MCP servers.

{
  "mcpServers": {
    "gx3": {
      "command": "python",
      "args": ["-m", "gx3cli.gx3_mcp_server"]
    }
  }
}

If your client can resolve console scripts from PATH:

{
  "mcpServers": {
    "gx3": {
      "command": "gx3-mcp-server"
    }
  }
}

The MCP server exposes read-only analysis tools and a restricted command runner. Synthetic demo generation is local CLI-only.

Demo Project

Use a synthetic project for screenshots, tutorials, and first-time tests.

gx3-cli synthetic-project demo.gx3 --overwrite
gx3-cli doctor --root demo.gx3
gx3-cli trace-device M100 --root demo.gx3 --strict-logic --compact

For a project with enough in it to be worth exploring, use the demo-line profile: a 14-station pick-and-place line, about 500 rungs across 10 programs with roughly 500 commented devices, chained so that tracing an output on the last station walks back through every station upstream.

gx3-cli synthetic-project line.gx3 --profile demo-line --overwrite
gx3-cli index-lite build --root line.gx3
gx3-cli xref build --root line.gx3
gx3-cli lint line.gx3
gx3-cli dead-logic --root line.gx3

It also contains a small number of deliberate faults - a duplicate coil, a latch with no reset, a coil nobody reads, a contact that can never close, and two devices whose comments contradict each other - so the review commands report findings instead of an empty table. This is also the fastest way to reproduce a bug for an issue without sending anyone a real project.

Data And Safety

  • Project files stay on your machine unless you pass outputs to another tool.
  • Some commands create local files such as SQLite indexes, CSV reports, ZIP support bundles, or Markdown summaries.
  • Analysis output is advisory. Verify findings in GX Works3 and through your own safety/quality process before changing real equipment.
  • The tool is not a substitute for PLC validation, machine safety review, or official engineering software.

Documentation

Recommended reading:

  1. User manual (JA): Japanese install and usage guide.
  2. Agent usage guide (JA): how AI agents should use the indexed tools.
  3. Security note (JA): local data handling and read-only MCP policy.
  4. Validation matrix (JA): verified scope and limitations.
  5. File usage guide (JA): repository file map for agents and contributors.

MCP configuration examples:

License In Plain Words

Full terms are in LICENSE.txt; this section is only a summary and the license text governs.

This is source-available proprietary software, not open source. In practice:

  • You may clone it, read the source, and run it for evaluation and for internal analysis work, including inside a company.
  • You may not redistribute it, host it as a service, resell it, or ship it as part of a paid product or commercial service without written permission.
  • There is no license token, activation, or paid plan to run it.
  • It is provided as is, with no warranty, and its output is advisory only.

日本語: 社内での評価・業務利用は許諾されています。禁止しているのは再配布、 SaaS としての提供、有償製品やサービスへの組み込みです。実行にライセンス キーや課金は不要です。商用利用の相談は Issue からご連絡ください。

For Contributors

Bug reports, questions, and small pull requests are welcome, in Japanese or English. Start with CONTRIBUTING.md, which covers the no-project-data rule, the development setup, and what a useful bug report contains. Issues labeled good first issue are scoped to be approachable without deep knowledge of the GX Works3 file format.

Before changing or publishing this project, run the same checks used by CI:

python run_tests.py
python scripts\release_gate.py .
python -m build --wheel
python scripts\release_gate.py dist\gx3_cli_mcp-*.whl

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gx3_cli_mcp-0.1.2.tar.gz (247.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gx3_cli_mcp-0.1.2-py3-none-any.whl (284.1 kB view details)

Uploaded Python 3

File details

Details for the file gx3_cli_mcp-0.1.2.tar.gz.

File metadata

  • Download URL: gx3_cli_mcp-0.1.2.tar.gz
  • Upload date:
  • Size: 247.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for gx3_cli_mcp-0.1.2.tar.gz
Algorithm Hash digest
SHA256 7a3b6cf9bc9ab19bd8f627934fb1680da83e206efa5355e9812b43e33ede0194
MD5 b27a109be165529d05c2b12cee5d865f
BLAKE2b-256 f087f74e97a0988ee6d797e9cc7965037ab6cb2e6e85ceff8bdf03e01598adfd

See more details on using hashes here.

Provenance

The following attestation bundles were made for gx3_cli_mcp-0.1.2.tar.gz:

Publisher: release.yml on purinzan/gx3-cli-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gx3_cli_mcp-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: gx3_cli_mcp-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 284.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for gx3_cli_mcp-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 83bdf248bd9ed68b0bfe4c63ee3bbc3d33b44953c2667cd877ceb68573f1f564
MD5 03c2b02eabf75115c8de9f507f2acaf0
BLAKE2b-256 a7ac77fd1f7937cbdaafdfcf20a4428abd3b4d73a3aaf14bbc0d362754360560

See more details on using hashes here.

Provenance

The following attestation bundles were made for gx3_cli_mcp-0.1.2-py3-none-any.whl:

Publisher: release.yml on purinzan/gx3-cli-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.1.4

2 files

0.1.3

2 files

This release

0.1.2 This release

2 files

0.1.0

2 files

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