s7-mcp-server

cadugrillo/s7-mcp-server

3.2

If you are the rightful owner of s7-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

S7-MCP-SERVER is a server designed to interface with SIEMENS PLC S7-1500/1200 using their JSON-RPC 2.0 API, providing MCP tools for AI assistants and other MCP-compatible clients.

Tools
20
Resources
0
Prompts
0

S7 MCP SERVER

S7 MCP SERVER is a MCP Server that connects AI agents to Siemens industrial PLCs (specifically S7-1500 and S7-1200 models). This allows AI agents to automatically monitor and control industrial equipment by sending commands and receiving data from the machines.


🔧 Available Tools

  • User authentication (login, logout, ChangePassword-user)
  • Check PLC connectivity (ping)
  • Retrieve user permissions (Api-GetPermissions)
  • Get API version (Api-Version)
  • List available API methods (Api-Browse)
  • Retrieve structure information (Api-GetQuantityStructures)
  • Get password security policies (Api-GetPasswordPolicy)
  • Browse tags and metadata (PlcProgram-Browse)
  • Read single variables (PlcProgram-Read)
  • Write Boolean, Number, or String tags (PlcProgram-Write)
  • Read the current CPU operating mode (Plc-ReadOperatingMode)
  • Request a change of operating mode (Plc-RequestChangeOperatingMode)
  • Read the CPU system time (Plc-ReadSystemTime)
  • Set the CPU system time (Plc-SetSystemTime)
  • Read available project languages (Project-ReadLanguages)
  • Browse active alarms (Alarms-Browse)
  • Acknowledge alarms (Alarms-Acknowledge)
  • Browse diagnostic buffer entries (DiagnosticBuffer-Browse)

⚙️ Prerequisites

  • Node.js (v18.x or later recommended)
  • npm (comes bundled with Node.js)
  • Access to a running SIEMENS PLC API (Webserver)

⚙️ Configuration

This server uses environment variables for configuration.

Example env variables:

export PLC_IP_ADDRESSES="192.168.2.200, 192.168.2.201, 192.168.2.202"
export PLC_NAMES="PLC1, PLC2, PLC3" //optional
export MCP_SERVER_PORT=5000 //optional
export TRANSPORT="streamable-http" //optional
export NODE_TLS_REJECT_UNAUTHORIZED=0

🚀 Getting Started (Development)

  1. Git Clone this repo: https://github.com/cadugrillo/s7-mcp-server.git

  2. Navigate to the project folder:

cd s7-mcp-server
  1. Install dependencies:
npm install
  1. Edit env variables as shown above.

  2. Start the server

npm run dev

🐳 Docker Container

There is a Docker Container Image avaiable at https://hub.docker.com/r/cadugrillo/s7-mcp-server/tags

  • How to run
docker run -dp 5000:5000 -m 512m --memory-swap=512m \
--name s7mcp \
-e MCP_SERVER_PORT=5000 \
-e PLC_IP_ADDRESSES="192.168.2.200, 192.168.2.201, 192.168.2.202" \
-e PLC_NAMES="PLC1, PLC2, PLC3" \
-e NODE_TLS_REJECT_UNAUTHORIZED=0 \
cadugrillo/s7-mcp-server:latest

Remember to change port according to your deployment.

  • Available Environment Variables
PLC_IP_ADDRESSESrequiredIP addresses of available PLCs separated by comma eg. "192.168.1.10, 192.168.1.20"
PLC_NAMESoptionalNames of available PLCs separated by comma eg. "Machine1, Machine2"
MCP_SERVER_PORToptionalIf not set, it defaults to 5000
TRANSPORToptionalIt can be "streamable-http" or "stdio". If not set it defaults to streamable-http
NODE_TLS_REJECT_UNAUTHORIZEDrequiredAlways to set to 0 for bypassing certificate validation

🖥️ Connecting with Claude Desktop

To use this MCP server with Claude AI (desktop version):

  1. Find or create the claude_desktop_config.json file (typically in the Claude app config folder).

  2. Add or update the following if running in a container (streamable-http) (remember to change port according to your deployment):

{
  "mcpServers": {
    "S7-MCP-SERVER": {
      "command": "npx",
      "args": ["mcp-remote", "http://localhost:5000/mcp"]
    }
  }
}
  1. Or use the following if running locally (stdio):
{
  "mcpServers": {
    "S7-MCP-SERVER": {
      "command": "node",
      "args": ["path/to/your/s7McpServer.js"], //`for Windows user proper escape (eg. C:\\path\\to\\your\\s7McpServer.js)`
      "env": {
        "PLC_IP_ADDRESSES":"192.168.2.200, 192.168.2.201, 192.168.2.202",
        "PLC_NAMES":"PLC1, PLC2, PLC3",
        "TRANSPORT": "stdio",
        "NODE_TLS_REJECT_UNAUTHORIZED": "0"
      }
    }
  }
}

🪲 Reporting bugs and contributing

  • Want to report a bug or request a feature? Please open an issue