cx-programmer-mcp
cx-programmer-mcp
OMRON CX-Programmer のラダープログラムを、GUI を開かずにプログラムから編集するための MCP (Model Context Protocol) サーバーです。
OMRON CJ/CP/CS シリーズ PLC の .CXP / .CXT ファイルに対応しています。
対象範囲: プログラム、セクション、ラダーニーモニック、ラングコメント、シンボルテーブルのみ。 PLC セットアップ、I/O テーブル、ネットワーク設定、パスワード、PLC への転送には触れません。
仕組み
OMRON は .CXP を .CXT の圧縮版として定義しています。.CXT は CX-Programmer がインポート/エクスポートできるテキストベースの形式です。このサーバーは .CXP または .CXT を読み込み、メモリ上でプログラムを編集してから、実機の PLC に展開する前に CX-Programmer で確認できるよう、結果を .CXT / .CXP として保存します。
Python MCP SDK v2(MCPServer)を stdio トランスポートで使用します。
Related MCP server: TwinCAT Validator MCP Server
要件
Python >= 3.10
uv パッケージマネージャー
CX-Programmer がインストールされていること(
.cxp出力を開いて PLC にダウンロードするため)
インストール
cd cx-programmer-mcp
uv sync
uv run cx-programmer-mcpプロジェクトテンプレートのセットアップ
組み込みテンプレート(CJ2M CPU11)
ネイティブな CJ2M CPU11 テンプレートが同梱されています。空のプロジェクトを生成します:
uv run python make_template.py他の PLC モデル
PLC モデルごとにバイナリ構成が異なります。CJ2M CPU11 以外のモデルの場合:
お使いのマシンで CX-Programmer を開きます
ご利用の PLC モデル(CP1L、CS1G など)で新しい空のプロジェクトを作成します
.CXPまたは.CXTとして保存しますファイルを
project/フォルダーに配置しますmake_template.pyを更新して、ご利用のファイルを指定します:
SRC = Path(__file__).parent / "project" / "your_blank_template.cxp"make_template.pyを一度実行します
サンプルプログラム
サンプルのラダープログラムが同梱されています: project/example_basic_io.cxp
これは、以下の機能を持つシンプルなコンベヤー/IO コントローラーの例です:
手動出力制御(ホールド・トゥ・ラン)
RTC によるスケジュール自動運転(DM で設定可能)
タイマーによる運転時間
SET/RSET ラッチ
緊急リセット
ソースから再ビルドするには:
uv run python make_template.py
uv run python build_program.py出力: project/example_basic_io.cxp — CX-Programmer で開いて確認し、ダウンロードしてください。
プログラムのレビュー
uv run python review_program.pyMCP クライアント設定
MCP クライアント設定(Claude Desktop、Kiro、Cline など)に追加します:
{
"mcpServers": {
"cx-programmer": {
"command": "uv",
"args": ["run", "cx-programmer-mcp"],
"cwd": "ABSOLUTE_PATH_TO_THIS_FOLDER"
}
}
}Windows の例:
"cwd": "C:\\Users\\yourname\\cx-programmer-mcp"オプション — ファイルアクセスを特定のフォルダーに制限します:
CX_MCP_ALLOWED_ROOTS=C:\PLC_Projects実行時のスケジュール変更
CX-Programmer のオンラインモード → PLC メモリ → DM エリアを使用します:
DM | 機能 | 初期値 |
| スケジュール 1 — 時 | 6 |
| スケジュール 1 — 分 | 0 |
| スケジュール 2 — 時 | 16 |
| スケジュール 2 — 分 | 0 |
| 運転時間 x100ms | 300 (=30s) |
変更は PLC を再起動しなくてもすぐに反映されます。
テストの実行
uv run pytest -q利用可能な MCP ツール
ツール | 説明 |
|
|
| プロジェクト内のすべてのプログラムを一覧表示します |
| プログラム内のセクションを一覧表示します |
| プログラムの完全なラダーコンテンツを取得します |
| セクション内のラングを取得します |
| ラングの命令を置き換えます |
| 新しいラングを挿入します |
| ラングを削除します |
| ラングコメントを設定します |
| 複数のラング編集を原子的に一括実行します |
| 新しいセクションを追加します |
| 既存のセクションの名前を変更します |
| シンボルを追加または更新します |
| スコープ内のすべてのシンボルをクリアします |
| すべてのシンボルを一覧表示します |
| XML 構造を検証します |
|
|
| 再エンコードして |
| 利用可能な組み込みテンプレートを一覧表示します |
| テンプレートから新しい空のプロジェクトを作成します |
| ニーモニック命令を検証します |
| ラングのブールシミュレーションを行います |
| ラング構造を解析します |
| プログラムの完全な診断 |
| AI レビュー用のセマンティック JSON スナップショット |
| 保存して CX-Programmer で開きます(Windows) |
プロジェクト構造
cx-programmer-mcp/
├── src/cx_programmer_mcp/ # MCP server and CXT library
│ ├── server.py # MCP tool definitions
│ ├── cxt.py # CXT/CXP parser and editor
│ ├── ladder.py # Mnemonic compiler and simulator
│ ├── diagnostics.py # Program diagnostics
│ ├── recipes.py # Reusable ladder patterns
│ ├── templates/ # Built-in PLC templates
│ │ └── CJ2M_CPU11.cxt # Native CJ2M CPU11 template
│ └── ...
├── tests/ # Test suite (16 tests)
├── project/ # Output folder
│ └── example_basic_io.cxp # Example ladder program
├── build_program.py # Builds the example ladder program
├── write_build.py # Regenerates build_program.py
├── make_template.py # Generates blank template from base
├── review_program.py # Prints program content to console
└── pyproject.toml注意事項
実機の PLC にダウンロードする前に、必ず CX-Programmer でプログラムチェックを実行してください。
このツールはプログラムロジックのみを編集します — I/O テーブル、ユニット設定、PLC 構成はテンプレートからそのまま保持されます。
.CXP出力は CJ2M CPU11 上の CX-Programmer 9.73 とバイナリ互換です。他の PLC モデルの場合は、専用の空の
.CXPテンプレートを用意してください(プロジェクトテンプレートのセットアップ を参照)。
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityFmaintenanceA Model Context Protocol server that enables seamless interaction between MCP clients (like Claude Desktop) and CODESYS V3 programming environments, allowing automation of project management, POU creation, code editing, and compilation tasks.131114MIT
- AlicenseBqualityCmaintenanceAn MCP server for validating, auto-fixing, and scaffolding TwinCAT 3 XML files using deterministic code quality tools and IEC 61131-3 OOP checks. It enables AI assistants to perform structural validation, apply safe fixes, and generate canonical code skeletons for industrial automation projects.1633MIT
- FlicenseNot gradedqualityAmaintenanceMCP server that connects AI assistants to Siemens TIA Portal via the Openness API. AI-assisted PLC programming, project management, hardware configuration, cross-reference analysis, and deployment. 16 tools, 166 actions.27
- AlicenseBqualityBmaintenanceMCP server that enables AI agents to read, edit, and create PLC projects in EcoStruxure Control Expert via COM automation.52MIT
Related MCP Connectors
MCP Server for Slima - AI Writing IDE for Novel Authors with AI Beta Reader.
MCP server for generating rough-draft project plans from natural-language prompts.
2,000+ MCP servers read at source level. Know what one does before you connect. Free, no key.
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/BlackUppsss/Cx-Proggrammer-MCP'
If you have feedback or need assistance with the MCP directory API, please join our Discord server