Skip to content
Conduit

mcp server

NiRuLogic

Open-source IEC 61131-3 ladder logic editor for Arduino: draw it, simulate it, flash it over USB, then watch live power flow through your rungs on the running hardware. Includes an MCP connector so AI

NiRuLabs/NiRuLogiccommunitylistedunreviewed

Set up

Runs on your computer. Pick your agent and operating system.

This project does not publish an install method we can turn into a config. Follow the README instead.

README

synced Oct 21, 2026

What is NiRuLogic?

NiRuLogic brings industrial PLC programming to the Arduino world. You draw ladder logic the way you would in a professional PLC environment — contacts, coils, timers, counters, comparison and math blocks on a proper rung grid — then run it against a built-in simulator, flash it to real hardware, and stay connected to watch the program execute live on the board.

It runs as a single Go binary that serves the editor to your browser. There is nothing to install beyond the binary itself, and everything runs locally: your programs never leave your machine.

Who it's for: automation students learning IEC 61131-3, educators who need a PLC environment without PLC-sized budgets, and engineers prototyping control logic on cheap hardware before committing to a real PLC.

Features

Visual ladder editor

  • Drag-and-drop rung editing on a proper grid, with wire routing and collision detection
  • Marquee multi-select, group move and delete
  • 15 built-in element types: NO/NC contacts, coils (plain, set, reset), TON/TOF timers, CTU/CTD counters, rising/falling edge triggers, MOVE, MATH, SCALE and comparison blocks

Simulation

  • Full in-browser scan-cycle simulator — no hardware required
  • Live value inspection: watch addresses, force inputs, and see powered rungs highlight as they energise
  • Step-debug a scan, or run continuously

Version history

  • Every save commits the program into its own Git repository, automatically
  • Browse past versions, diff them, restore any commit, and pin the ones that matter

Hardware and online mode

  • Compiles ladder logic to Arduino C++ and flashes it over USB straight from the browser (WebSerial)
  • Online monitoring: leave the cable connected and watch live power flow through your actual rungs on the running hardware, with real signal values updating as the PLC scans — the same workflow a commercial PLC toolchain gives you, on a board that costs a few dollars
  • Arduino Uno and Nano targets included, defined as editable JSON

Extensible by design

  • Element types, hardware targets, and their simulation behaviour are all plain JSON — add your own without touching Go
  • Plugin system with an in-browser IDE for building and installing extensions

AI-assisted programming

  • A built-in MCP server exposes the editor over SSE, streamable HTTP, or WebSocket
  • Tested with Claude Code (SSE) and OpenAI Codex (streamable HTTP); Claude Desktop connects through the mcp-remote bridge, and any other MCP client can use the same endpoints

Quick Start

Requirements

  • Go 1.25+ to build
  • arduino-cli — optional, only needed to compile and flash to real hardware
git clone https://github.com/NiRuLabs/NiRuLogic.git
cd NiRuLogic/platform
go build -tags ce -o nirulogic-ce .
./nirulogic-ce

Then open http://localhost:8081 — the editor loads straight away, no account required.

Options

FlagDefaultPurpose
-port8081HTTP port to listen on
-dbnirulogic-ce.dbSQLite database (program index)
-programs../nirulogic/programsWhere program files and their Git histories live

The ce build tag is required — it selects the Community Edition entry point.

Run as a systemd service (Linux)

Run this from the platform/ directory — $(pwd) and the default ../nirulogic/programs path are resolved relative to it.

sudo tee /etc/systemd/system/nirulogic.service <<EOF
[Unit]
Description=NiRuLogic Community Edition
After=network.target

[Service]
Type=simple
User=$USER
WorkingDirectory=$(pwd)
ExecStart=$(pwd)/nirulogic-ce
Restart=always

[Install]
WantedBy=multi-user.target
EOF

sudo systemctl daemon-reload
sudo systemctl enable --now nirulogic

AI-Assisted Programming (MCP)

NiRuLogic speaks the Model Context Protocol, so an AI assistant can read and write your ladder programs directly — building rungs, wiring blocks, running the simulator, and checking live signal values to verify its own work.

Watch it in action: Claude Code writes and commissions a PLC program autonomously via the MCP connector.

Rungs are exchanged as NiRuScript, a Python-like text form of ladder logic, so the assistant works in expressions rather than pixel coordinates:

Motor = (Start or Motor) and not Stop          # %QX0.0
Delay_done = TON(IN=Motor, PT=5000)            # %MX0.1

The editor converts between script and drawn geometry in both directions, so a program built by an assistant is a normal rung you can edit by hand afterwards.

EndpointTransportTypical client
/mcp/sseServer-Sent EventsClaude Code
/mcp/httpStreamable HTTPOpenAI Codex
/mcp/wsWebSocketCustom clients

Claude Code (~/.claude.json):

{
  "mcpServers": {
    "nirulogic": { "type": "sse", "url": "http://localhost:8081/mcp/sse" }
  }
}

OpenAI Codex (~/.codex/config.toml):

[mcp_servers.nirulogic]
url = "http://localhost:8081/mcp/http"

Visit http://localhost:8081/mcp-setup for one-click installers.

Extending NiRuLogic

Nothing about the element library is hard-coded. Each element type is a JSON file in nirulogic/element_defs/ describing its pins, its SVG symbol, and its simulation behaviour — so a new block is a new file, not a code change. Hardware targets in nirulogic/target_defs/ work the same way: address ranges, memory model, and capabilities are all declarative.

For anything bigger, the plugin system loads bundles at runtime, and the editor ships with an in-browser IDE for writing them.

Project Structure

platform/     Go server — HTTP routing, program storage, MCP relay, compile
nirulogic/    The product itself
  editor/       the ladder editor UI (HTML + JS)
  engine/       simulation engine, shared by browser and headless runtimes
  element_defs/ JSON element definitions
  target_defs/  JSON hardware target definitions
  programs/     your saved programs, each with its own Git history

Background

NiRuLogic has been a long time in the making. The idea started back in 2021 with experiments in bringing a factory cell to life in 3D, first in Unity and later with models built in Blender. The ladder editor took its own winding road — written first in C#, then rebuilt in Python, and finally rebuilt again as the browser-based editor you find in this repository. What's here is the distillation of several years and several false starts into one tool that finally does what the early prototypes were reaching for.

Community Edition

This repository is the Community Edition — the complete single-user ladder editor, simulator, and toolchain, free and open source under the AGPL.

NiRuLabs also runs a hosted service built on this same core, adding accounts and cloud-saved programs. Its generous free tier includes browser-based 3D robot cells — commission your ladder program against a virtual factory, driving a KUKA robot and a machining cell from your own logic, with no hardware required. Those hosted features are not part of this repository.

Contributing

Issues and pull requests are welcome — see CONTRIBUTING.md.

First-time contributors agree to a one-time Contributor License Agreement by signing off their commits (git commit -s). In plain terms: you stay the owner of the code you write — you can still reuse, sell, or relicense it anywhere — and you give NiRuLabs permission to include it in the project, under both the open-source AGPL and NiRuLabs' commercial license. You grant permission; you don't hand over ownership.

License

Licensed under the GNU Affero General Public License v3.0 — see LICENSE.

In short: you may use, modify, and redistribute this software freely, including commercially. If you run a modified version as a network service, the AGPL requires you to make your modified source available to its users.

Bundled third-party components (CodeMirror, sql.js) are under their own licenses — see THIRD_PARTY_LICENSES.md.

Copyright © 2025-2026 NiRuLabs


↑↓ navigate openesc close