industriagents-s7comm-mcp

v0.3.0
industriagents-s7comm-mcp Checked 2 days ago Published 1 month ago

MCP server and tooling for Siemens S7 PLCs over the S7comm protocol.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

read_values

Select one source mode and provide only its parameters. db: Read raw bytes from a Siemens data block (DB). Returns the bytes as hex in data.raw_bytes_hex. Absolute offsets need a DB with standard (non-optimized) block access on S7-1200/1500. Args: db_number: Data block number, 1-65535. start_offset: First byte to read. size: Number of bytes to read, 1-65535. db_typed: Read one typed value from a data block and decode it. data_type is BOOL, BYTE, WORD, DWORD, INT, DINT, REAL or STRING (S7 STRING with its 2-byte max/current length header; the text is returned without it). Values…

ParameterTypeDescription
source *Select the source mode described above.
bit_indexbit index for the selected operation; see its mode description.
data_typestringdata type for the selected operation; see its mode description.
db_numberintegerdb number for the selected operation; see its mode description.
namestringname for the selected operation; see its mode description.
sizesize for the selected operation; see its mode description.
start_byteintegerstart byte for the selected operation; see its mode description.
start_offsetintegerstart offset for the selected operation; see its mode description.
string_lengthstring length for the selected operation; see its mode description.
variablesarrayvariables for the selected operation; see its mode description.

write_values

Select one target mode and provide only its parameters. db: Write a typed value or raw bytes into a data block. Disabled unless S7_WRITES_ENABLED=true. With data_type (BOOL, BYTE, WORD, DWORD, INT, DINT, REAL, STRING) the value is range-checked and encoded big-endian. BOOL needs bit_index and writes only that bit; the other 7 bits of the byte are left untouched. STRING needs string_length, which must match the STRING header in the PLC. Without data_type, value is raw bytes: a hex string ("0a ff") or a list of 0-255. bit_index is only accepted with BOOL and string_length only with STRING; to…

ParameterTypeDescription
target *Select the target mode described above.
bit_indexbit index for the selected operation; see its mode description.
data_typedata type for the selected operation; see its mode description.
db_numberintegerdb number for the selected operation; see its mode description.
namestringname for the selected operation; see its mode description.
sizesize for the selected operation; see its mode description.
start_byteintegerstart byte for the selected operation; see its mode description.
start_offsetintegerstart offset for the selected operation; see its mode description.
string_lengthstring length for the selected operation; see its mode description.
valuevalue for the selected operation; see its mode description.
variablesarrayvariables for the selected operation; see its mode description.

read_plc_info

Read the CPU's identity: module type and name, serial number, order code and firmware version.

read_cpu_state

Read the CPU operating mode. data.state is the Snap7 status (S7CpuStatusRun, S7CpuStatusStop or S7CpuStatusUnknown) and data.mode the short form (RUN, STOP or UNKNOWN).

set_cpu_state

Switch the CPU to RUN (hot start) or STOP. Disabled unless both S7_WRITES_ENABLED=true and S7_SYSTEM_CMDS_ENABLED=true. Succeeds only when the PLC accepted the command and then reports the requested mode (polled for up to S7_TIMEOUT seconds). The command is sent at most once. Args: state: "RUN" or "STOP".

ParameterTypeDescription
state *stringstate for the selected operation; see its mode description.

read_system_time

Read the PLC's real-time clock as an ISO 8601 timestamp (PLC local time, no time zone).

read_szl

Read a system status list (SZL/SSL) partial list. Returns the record length, record count and each record as hex. Common IDs: 0x0011 module identification, 0x001C component identification, 0x0424 operating mode, 0x0000 list of available SZL IDs. Args: szl_id: SZL ID, 0-65535 (e.g. 17 for 0x0011). szl_index: SZL index, 0-65535 (default 0).

ParameterTypeDescription
szl_id *integerszl id for the selected operation; see its mode description.
szl_indexintegerszl index for the selected operation; see its mode description.

list_tags

List the tags defined in the TAG_MAP_FILE JSON file (empty if TAG_MAP_FILE is not set).

get_connection_status

Report the configured PLC address and whether a connection is currently open. Does not contact the PLC; the connection opens on the first tool call that needs it (use ping to test reachability). last_error holds the most recent failure, if any.