PortDock

PortDock MCP Guide

MCP server for AI clients — reads ports, Modbus, MC and SCPI; writes only to simulators on this PC

About

PortDock MCP (portdock-mcp.exe) is a server started by an AI client (Claude Desktop, Claude Code, VS Code, Cursor or any program that uses MCP). It has no window and talks to the client over standard input/output (stdio) only.

With its tools the AI reads this PC's COM ports and network adapters, and reads Modbus, MC protocol and SCPI values from devices you name. The write tools accept only this PC's address (127.0.0.1) and are for practising with simulators running here. If a program on this PC forwards to another device (a TCP relay, gateway or tunnel), a write can reach a real device — be careful.

Install

  • Claude Desktop: download PortDock-MCP.mcpb from the release and open it to install.
  • Other clients: unzip PortDock-MCP.zip and set the MCP server command to the full path of portdock-mcp.exe (no arguments).
  • Scoop: run scoop bucket add portdock https://github.com/portdock/scoop-bucket once, then scoop install portdock/portdock-mcp and use portdock-mcp as the command.
  • Example settings and a practice walkthrough are in the guide «Using PortDock MCP from AI clients (Claude Desktop and others)».

Nine read tools

  • ports_list — COM ports (device name, USB VID:PID, serial number) and COM devices from Device Manager (present or not, problem code).
  • port_inspect — one Port Inspector report: driver, problem code, USB hub path and speed, power saving, Device Parameters (FTDI latency timer …) and Windows port defaults. Optional: plug events and COM number reservations.
  • serial_read — opens a port, listens for a set time (up to 10 s) and closes it. Sends nothing.
  • modbus_read — one Modbus read (01 coils, 02 discrete inputs, 03 holding, 04 input registers) over TCP, RTU or RTU over TCP. Broadcast (unit 0) is refused. Optional 16/32/64-bit integer and float decoding with byte order.
  • mc_read — MC protocol (SLMP) 3E binary batch read (0401). 18 device types such as D, W, R, ZR, M, X, Y, B; X, Y, B, W and ZR use hexadecimal numbers.
  • scpi_query — one query ending with «?» (LAN 5025 or RS-232). «;» chains and queries that can change instrument state (*TST?, *CAL?, CAL…, *RST, MMEM…, SYST:PRES …) are refused. READ? and MEAS…? (which start a new measurement; MEAS also reconfigures function and range) are sent only with allow_measure turned on — use FETC? to read just the last value.
  • ping — one IPv4 address, up to 10 times (interval 200 ms or more), optional TCP connect time.
  • net_adapters — adapter speed, duplex, IPv4, advanced properties (jumbo packets, energy saving …), «allow the computer to turn off this device», error counters and firewall profiles.
  • device_map_get — find and get the built-in device register maps (inverters, temperature controllers, power meters …). Also readable as resources portdock://devices/{maker}/{model}.

Two simulator writes

  • modbus_write_sim — writes coils (0F) or holding registers (10). For practising with PortDock Modbus Slave running as Modbus TCP on this PC.
  • mc_write_sim — MC 3E batch write (1401). For practising with PortDock PLC Simulator on this PC.
  • Any target other than 127.0.0.1, ::1 or localhost is refused before connecting. Names are not resolved, so a name cannot point the tools elsewhere.
  • The check is by address only. If a program on this PC forwards 127.0.0.1 to another device (PortDock TCP relay, a vendor gateway, an SSH tunnel …), written values can reach a real device — do not use the write tools then.
  • When practising with Modbus Slave, set its bind address to 127.0.0.1 (the default 0.0.0.0 lets other PCs connect).

Safeguards and log

  • Session log: every call (refusals too) is kept on this PC as JSON lines — portdock-data\mcp-log when a portable folder sits next to the exe, otherwise %LOCALAPPDATA%\dev.portdock\mcp-log. Files older than 30 days are removed. Nothing is sent anywhere.
  • Rate limits: the same target at most once per 100 ms, 120 calls per minute overall.
  • Results are cut at 64 KB. User folder paths become «~», MAC-like strings «xx-…», network names «(hidden)».
  • The server tells the client that text from devices (such as an *IDN? reply) is data, not instructions.
  • Environment: PORTDOCK_MCP_LANG=ko|en (message language, default en), PORTDOCK_MCP_LOG_DIR (log folder).

What it does not do

  • Write to any address other than this PC (Modbus or MC writes), send on a serial port, send SCPI setting commands, HTTP or remote serving, continuous polling, or anything with PLC programs (ladder).
  • It does not judge the device's real state for you. It hands the values it read to the AI; check the meaning against the device manual.