NEW v0.11 — Remote RUN/STOP and multiple block read/write →
MITSUBISHI PLC — MELSEC

Talk to Mitsubishi PLCsin just a few lines.

McpX is a .NET library for talking to Mitsubishi (MELSEC) PLCs over the MC protocol. Read and write device memory over TCP/UDP with an intuitive, strongly-typed API — no protocol boilerplate.

NUGET
16k+
LICENSE
MIT
PLATFORM
Win · Linux · macOS
PLC
Q · iQ-R · iQ-F

// USE CASES

Adopted by

realvirtual
realvirtual

Adopted as the Mitsubishi PLC communication interface in realvirtual Professional, an industrial simulation and digital twin platform by realvirtual GmbH.

EnvisionSCADA

EnvisionSCADA

Used in EnvisionSCADA, an industrial SCADA platform by Omnicon Automation.

Using McpX? We'd love to feature you as an adoption case. Get in touch →

// WHY McpX

Simple, safe PLC communication

Easy, safe and simple. An intuitive, strongly-typed API that implements PLC communication in minimal code.

An intuitive, type-safe API

Just name a type and a count. Generic and strongly-typed, so a bool stays a bool and a short stays a short — wrong types or addresses are caught, and you communicate safely in simple code.

Safety from tests & architecture

An MSTest suite that verifies MC protocol request/response packets at the byte level (~79% coverage). An interface-driven, layered design and typed exceptions catch invalid input early.

Free, open source, any OS

MIT-licensed open source — no license fees, and commercial use is fine. Native .NET, so unlike Windows-only MX Component it runs as-is on Linux, macOS and Raspberry Pi.

How it compares to MX Component

FeatureMcpXMX Component
License costFree (MIT, OSS)Paid
Operating systemsLinux / Windows / macOSWindows only
ImplementationNative .NETWindows-component dependent
InstallAdd from NuGetInstaller / licensing
Source codeOpen (GitHub)Closed

* A general comparison based on publicly available information.

// CAPABILITIES

Everything you need for PLC communication

Focused yet complete, with an intuitive API. Because it imposes no particular design, McpX blends flexibly into all kinds of systems — monitoring, control, logging — and fits naturally as part of your own app.

01 COMBINED READ / WRITE NEW

Ranges and scattered devices, one builder

Give a point count and it is a batch access; leave it out and it is a random access. Put consecutive ranges and scattered devices in the same builder and McpX picks the right command for each. No more choosing a method per access pattern. If the target supports it, several ranges can also go out in one request with multiple block batch access.

Example.cs
short[] block = [];
int  total   = 0;
bool running = false;

// With a point count → batch access, without → random access
mcpx.Read(b => b
    .Add<short>(Prefix.D, "400", 100, v => block = v)
    .Add<int>(Prefix.D, "2000", v => total = v)
    .Add<bool>(Prefix.M, "10", v => running = v));

mcpx.Write(b => b
    .Add<short>(Prefix.D, "500", [1, 2, 3])
    .Add<bool>(Prefix.M, "20", true));
02 GX SIMULATOR3 NEW

No PLC on your desk? Use the simulator

McpXSimulator connects to GX Simulator3 from just a system No. and a CPU No. The read/write API is the same as for a real PLC, so development and testing can go ahead without hardware. When you move to the real PLC, you only swap the connection for McpX.

Example.cs
// Connect to system 1, CPU 1 (127.0.0.1:5511)
using var sim = new McpXSimulator();

// The read/write API is the same McpX you use with a real PLC
sim.Write(b => b
    .Add<short>(Prefix.D, "100", 123)
    .Add<bool>(Prefix.M, "0", true));

short d100 = sim.Read<short>(Prefix.D, "100");

// Connect to another simulator at the same time (port 5521)
using var sim2 = new McpXSimulator(systemNo: 2);

Other commands

CommandDescriptionMethods
Single read/write Read or write one device as the type you specify.Read<T>/Write<T>
Batch read/write Read or write thousands of consecutive devices in one call, split automatically past the point limit.BatchRead<T>/BatchWrite<T>
Random read/write Read or write scattered devices together, routed to bit / word / double word by type.RandomRead(build)/RandomWrite(build)
Multiple block read/write NEWRead or write several separate consecutive ranges in one request.BlockRead(build)/BlockWrite(build)
Monitoring Register devices once, then just call Read() for the latest values.MonitorRegist(build)/MonitorSession.Read()
Remote operation NEWRUN / STOP / PAUSE, latch clear and reset the CPU module from code.RemoteRun/RemoteStop/RemotePause/RemoteLatchClear/RemoteReset
String read/write Read or write device values as Shift_JIS strings.ReadString/WriteString

Every command also has an async/await ~Async variant.

NO LIMITS

Point limits and word counts, handled

The MC protocol caps how many points a single batch can carry. McpX splits packets automatically when you exceed it, and computes the word count each type needs — so you never think about protocol limits.

SECURITY

Remote password, handled for you

Pass the password to the constructor and McpX locks and unlocks the remote password automatically around your session.

// USE CASES

What you can build with McpX

Representative use cases where McpX fits.

Use cases

Equipment monitoring

Real-time monitoring dashboard

Register the devices you care about and poll their current values, surfacing status and alarms on a live web dashboard.

ASP.NETMonitoringAsync
SCADA integration

Communication layer for SCADA software

Build the PLC communication layer of a SCADA app on McpX — strongly-typed reads and writes give tag polling and control commands a stable foundation.

Comm layerSCADAType-safe
Communication gateway

PLC ↔ server over MQTT

Build a gateway that reads device values from the PLC and publishes them to a server over MQTT — lightweight delivery of floor data to the cloud via a broker.

MQTTGatewayIoT
Test automation / CI

Automated testing & CI for PLC software

Verify PLC program I/O from code: automate write-then-read-back assertions on device values and wire them into your CI pipeline. Connect to GX Simulator3 and the tests run without a physical PLC.

CIAutomated testsCross-platform

// PLATFORMS

Broad platform & protocol support

Targets modern .NET back to .NET Framework on every major OS — generic over 9 data types and 28 device kinds.

Frameworks

.NET 7.0+.NET 8.0+.NET 9.0+.NET Core 2.0+.NET Framework 4.6.1+

Operating systems

LinuxWindowsmacOS

Supported PLCs

MELSEC-QMELSEC iQ-RMELSEC iQ-FGX Simulator3

Protocols & frames

TCPUDP3E Frame4E FrameBinaryASCII

Data types

boolshortushortintuintlongulongfloatdouble

Device types

XYMLFVBDWTSTCTNSSSCSNCSCCCNSBSWSDXDYSMSDZRZR

// QUICK START

Up and running in two steps

1 · Install the package

terminal
dotnet add package McpX

2 · Read & write device memory

Program.cs
using McpXLib;
using McpXLib.Enums;

// With password, the remote password is unlocked on creation and locked on dispose
using (var mcpx = new McpX("192.168.12.88", 10000, password: "1234"))
{
    short[] block = [];
    int total = 0;

    // Read a range (with a point count) and single devices in one call
    mcpx.Read(b => b
        .Add<short>(Prefix.D, "400", 100, v => block = v)
        .Add<int>(Prefix.D, "2000", v => total = v));

    // Write arrays (batch) and single values (random) in one call
    mcpx.Write(b => b
        .Add<short>(Prefix.D, "500", [1, 2, 3])
        .Add<bool>(Prefix.M, "20", true));
}

Want to understand how the MC protocol works underneath? MC Protocol Guide →

// AI SKILLS

Available now

Boost your development with AI

The McpX AI skill is available. It teaches models like Claude the accurate McpX API, accelerating everything from implementing to reviewing PLC communication code.

View the skill

Implement from a prompt

From plain requests like “read a D register from a MELSEC PLC” or “write code to talk to a Mitsubishi PLC in C#”, it generates the implementation — connection setup, using statements, explicit types and all.

AI knows the exact API

Connection settings, device addressing (Prefix + address), read/write and exception handling — the skill supplies McpX’s accurate spec, so the AI writes correct code, not guesses.

// PROJECT HEALTH

Built to adopt with confidence

Developed and maintained in the open, with the groundwork production needs.

Actively maintained

Updated continuously with a public CHANGELOG; issues and requests are handled on GitHub.

Verified by CI

Every change is built and tested — byte-level tests validate the protocol frames.

Wide targets & AOT

From .NET Framework to the latest .NET 9, including Native AOT.

Shipping steadily since 2024 — features in minor releases, fixes in patches.

// ROADMAP

What's next

We keep adding features that make McpX easier to use in the field.

  • SHIPPED · v0.10

    GX Simulator3 support

    McpXSimulator connects to the simulator, so you can verify behavior without physical PLC hardware.

  • SHIPPED · v0.9

    Unified access interface

    Read / Write now unify random access and contiguous addresses in one builder — no more switching methods per access pattern.

  • PLANNED

    Label access

    Access global labels on iQ-R / iQ-F series controllers.

  • PLANNED

    Higher test coverage

    Continuously expand the test suite to push coverage even higher.

// GET STARTED

Jump right in

Add the package, point it at an IP, and your first read/write runs in a few lines. Free, MIT-licensed, commercial use included.

$ dotnet add package McpX