cadugrillo/s7-mcp-server
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.
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)
-
Git Clone this repo: https://github.com/cadugrillo/s7-mcp-server.git
-
Navigate to the project folder:
cd s7-mcp-server
- Install dependencies:
npm install
-
Edit env variables as shown above.
-
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_ADDRESSES | required | IP addresses of available PLCs separated by comma eg. "192.168.1.10, 192.168.1.20" |
| PLC_NAMES | optional | Names of available PLCs separated by comma eg. "Machine1, Machine2" |
| MCP_SERVER_PORT | optional | If not set, it defaults to 5000 |
| TRANSPORT | optional | It can be "streamable-http" or "stdio". If not set it defaults to streamable-http |
| NODE_TLS_REJECT_UNAUTHORIZED | required | Always to set to 0 for bypassing certificate validation |
🖥️ Connecting with Claude Desktop
To use this MCP server with Claude AI (desktop version):
-
Find or create the claude_desktop_config.json file (typically in the Claude app config folder).
-
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"]
}
}
}
- 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