<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: CybriantOps</title>
    <description>The latest articles on DEV Community by CybriantOps (@cybriantops).</description>
    <link>https://dev.to/cybriantops</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4260008%2F3895a7af-7a51-4fa2-9849-0a89916a4070.png</url>
      <title>DEV Community: CybriantOps</title>
      <link>https://dev.to/cybriantops</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/cybriantops"/>
    <language>en</language>
    <item>
      <title>I built a Modbus simulator that Claude drives over MCP: test SCADA without a PLC</title>
      <dc:creator>CybriantOps</dc:creator>
      <pubDate>Mon, 23 Nov 2026 08:00:05 +0000</pubDate>
      <link>https://dev.to/cybriantops/i-built-a-modbus-simulator-that-claude-drives-over-mcp-test-scada-without-a-plc-214k</link>
      <guid>https://dev.to/cybriantops/i-built-a-modbus-simulator-that-claude-drives-over-mcp-test-scada-without-a-plc-214k</guid>
      <description>&lt;p&gt;&lt;em&gt;Disclosure: I work on fieldpuppet, the open-source simulator in this post. It is maintained by the team behind PLCGateway.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Here is a prompt I can now type into Claude:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Set up 50 energy meters starting at port 6000. Make meter 12 stop answering for 30 seconds, then tell me which registers my SCADA read from it.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A few seconds later there are 50 Modbus TCP devices listening on my laptop, one of them goes silent on schedule, and I get a report of what my software polled. No PLC, no meter, no cabinet.&lt;/p&gt;

&lt;p&gt;This post explains why I built it, how the MCP part works, and how to use it without any AI at all.&lt;/p&gt;

&lt;h2&gt;
  
  
  The problem: the hardware is never on your desk
&lt;/h2&gt;

&lt;p&gt;If you write software that talks Modbus TCP (a SCADA screen, a gateway, a historian, a data collector), you know this situation. The code is ready, but the PLC is in a cabinet at the customer site, the energy meter has not shipped yet, and nobody will let you unplug a pump just to see how your software handles a timeout.&lt;/p&gt;

&lt;p&gt;A register table that returns fixed numbers does not help much. Real testing needs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Many devices at once&lt;/strong&gt;, because polling 1 device and polling 200 behave very differently.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Values that move&lt;/strong&gt;, so trends, alarms and scaling can be checked.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Faults on demand&lt;/strong&gt;: slow answers, no answer, exception replies, dropped connections. These break software in the field and are the hardest to reproduce with real equipment.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A record of what your software asked for&lt;/strong&gt;, so you can see whether it polls the registers you think it does.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why MCP fits this job
&lt;/h2&gt;

&lt;p&gt;Setting up test devices is boring, repetitive work: copy a register list from a manual, pick ports, write a fault timeline. It is exactly the kind of work an assistant does well if it has the right tools.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/CybriantOps/fieldpuppet" rel="noopener noreferrer"&gt;fieldpuppet&lt;/a&gt; is a single Rust executable of about 2 MB with an MCP server built in. It exposes 22 tools, such as &lt;code&gt;create_device&lt;/code&gt;, &lt;code&gt;set_signal&lt;/code&gt;, &lt;code&gt;apply_scenario&lt;/code&gt;, &lt;code&gt;inject_fault&lt;/code&gt; and &lt;code&gt;get_traffic_log&lt;/code&gt;. Every tool carries read-only and destructive hints, so the client knows which calls change state.&lt;/p&gt;

&lt;p&gt;For Claude Code it is one line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude mcp add fieldpuppet -- /full/path/to/fieldpuppet mcp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For Claude Desktop, each release has an &lt;code&gt;.mcpb&lt;/code&gt; bundle you can install from the Extensions settings. Any MCP client that can start a local server over stdio works.&lt;/p&gt;

&lt;p&gt;Things I ask it most often:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"Here is the register list from a device manual. Build a simulated device that matches it."&lt;/li&gt;
&lt;li&gt;"Make the tank level rise from 20 % to 95 % over two minutes, then switch the high level alarm on."&lt;/li&gt;
&lt;li&gt;"Pump 2 should answer with a device busy exception for the next 30 seconds."&lt;/li&gt;
&lt;li&gt;"Which registers has my SCADA been reading from the drive in the last minute?"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A read-only web dashboard on &lt;code&gt;http://127.0.0.1:5080&lt;/code&gt; shows every device, its live values and a feed of everything the assistant changed, so you are never guessing what it did.&lt;/p&gt;

&lt;h2&gt;
  
  
  It works without AI too
&lt;/h2&gt;

&lt;p&gt;Describe the devices in YAML:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;devices&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;pump-1&lt;/span&gt;
    &lt;span class="na"&gt;template&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;pump&lt;/span&gt;
    &lt;span class="na"&gt;port&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;5020&lt;/span&gt;

  &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;dosing-skid&lt;/span&gt;
    &lt;span class="na"&gt;port&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;5021&lt;/span&gt;
    &lt;span class="na"&gt;points&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;chlorine_ppm&lt;/span&gt;
        &lt;span class="na"&gt;table&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;input&lt;/span&gt;
        &lt;span class="na"&gt;address&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
        &lt;span class="na"&gt;scale&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.01&lt;/span&gt;
        &lt;span class="na"&gt;unit&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ppm&lt;/span&gt;
        &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.8&lt;/span&gt;
        &lt;span class="na"&gt;signal&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="s"&gt;type:&lt;/span&gt; &lt;span class="s"&gt;random_walk&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;min:&lt;/span&gt; &lt;span class="mf"&gt;0.5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;max:&lt;/span&gt; &lt;span class="mf"&gt;1.2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;step:&lt;/span&gt; &lt;span class="mf"&gt;0.02&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;fieldpuppet run water-station.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Point your own software at &lt;code&gt;127.0.0.1&lt;/code&gt;, port &lt;code&gt;5020&lt;/code&gt; or &lt;code&gt;5021&lt;/code&gt;, unit id 1. The chlorine value drifts between 0.5 and 1.2 ppm like a real sensor would. Addresses are zero-based protocol addresses, so holding register 40001 is address 0.&lt;/p&gt;

&lt;h2&gt;
  
  
  Test the bad days, not only the good ones
&lt;/h2&gt;

&lt;p&gt;Four fault types are available, each with an optional time limit:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;delay&lt;/code&gt;: correct answers, but late&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;no_response&lt;/code&gt;: your client sees a timeout&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;exception&lt;/code&gt;: a Modbus exception such as device busy&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;disconnect&lt;/code&gt;: the connection closes on every request&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is how you find out whether your software reconnects, whether one dead device stalls the polling of the other 49, and whether stale values are marked as stale.&lt;/p&gt;

&lt;h2&gt;
  
  
  Limits
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Modbus TCP only. No serial RTU or ASCII yet.&lt;/li&gt;
&lt;li&gt;Devices do not model process behaviour. A pump does not stop because its run coil was cleared; a scenario or the assistant has to change the values.&lt;/li&gt;
&lt;li&gt;Simulation only. It answers requests sent to it and never connects to real equipment.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;p&gt;The code is on GitHub under MIT / Apache 2.0: &lt;a href="https://github.com/CybriantOps/fieldpuppet" rel="noopener noreferrer"&gt;CybriantOps/fieldpuppet&lt;/a&gt;. It is a new project, so bug reports and feature requests are very welcome.&lt;/p&gt;

&lt;p&gt;Which fault case has caused you the most trouble in the field?&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>ai</category>
      <category>testing</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
