npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@digta/mcprotocol

v1.0.0

Published

Mitsubishi MELSEC MC (MELSEC Communication) protocol client for Ethernet PLCs. Fork of mcprotocol 0.1.2 with a TCP framing fix for ASCII 3E responses.

Readme

@digta/mcprotocol

Mitsubishi MELSEC Communication (MC) protocol client for Ethernet PLCs, written entirely in JavaScript.

This is an @digta-scoped fork of mcprotocol 0.1.2 (by Dana Moffit) with a single behavioural fix: TCP frame reassembly for ASCII 3E responses. It is a drop-in replacement — no API changes. See CHANGELOG.md for the details.

Part of Protokit.

This software is not affiliated with Mitsubishi. FX3U and MELSEC are trademarks of Mitsubishi.

⚠️ BETA CODE. Wrong values can be written to wrong locations. Test everything thoroughly before using against a live PLC.

Install

npm i @digta/mcprotocol

What's different from upstream

[email protected] treated every socket data event as exactly one complete PLC response. TCP is a byte stream, so an ASCII 3E response can be split across several events — or several responses can arrive in one — which produced Invalid Response Length / DATA LESS THAN 11 BYTES errors and connection resets when polling many registers.

This fork buffers incoming bytes per connection and slices out whole frames using the response data-length field (18 + dataLen chars) before processing. It is active only for ascii: true + frame: '3E'; every other mode uses the original code path. Full write-up in CHANGELOG.md.

Usage

var mc = require('@digta/mcprotocol');
var conn = new mc;

var variables = {
  TEST1: 'D0,5',        // 5 words starting at D0
  TEST4: 'R2000,2',     // 2 words at R2000
  TEST6: 'D6000.1,20',  // 20 bits starting at D6000.1
};

conn.initiateConnection({ port: 1281, host: '192.168.0.2', ascii: false }, connected);

function connected(err) {
  if (typeof err !== 'undefined') { console.log(err); process.exit(); }
  conn.setTranslationCB(function (tag) { return variables[tag]; });
  conn.addItems(['TEST1', 'TEST4']);
  conn.addItems('TEST6');
  conn.readAllItems(valuesReady);
}

function valuesReady(anythingBad, values) {
  if (anythingBad) { console.log('SOMETHING WENT WRONG READING VALUES'); }
  console.log(values);
  process.exit();
}

Note: to use the ASCII 3E fix, configure the connection with { ascii: true, frame: '3E' }.

API

  • initiateConnection(params, callback) — connect. params: port, host, ascii (default false), frame ('1E' default, '3E' supported), octalInputOutput (default true). callback(err).
  • dropConnection() — terminate the TCP connection.
  • setTranslationCB(translator) — map tag names to addresses. translator(tag) returns an address string, e.g. M100,20, D2000,5, DFLOAT1000, RSTR30,10, D1000.2,5.
  • addItems(items) / removeItems(items) — manage the read polling list (string or array of strings).
  • writeItems(items, values, callback) — write values to the PLC.
  • readAllItems(callback) — read the polling list; callback(anythingBad, values).

For the full address syntax and configurator setup notes, see the upstream mcprotocol documentation.

Tested against

Direct connection to FX3U-ENET / FX3U-ENET-ADP. Q-series E71 should work in theory (same frames). Serial and UDP are not supported.

Changelog

1.0.0 — fork of [email protected] with the ASCII 3E TCP frame reassembly fix. Full details in CHANGELOG.md.

License

MIT — © 2015 Dana Moffit (original), © 2026 Rifky Andigta Al-Fathir (fork modifications).