MCP PLC Core

MCP PLC Core

Universal MCP server for industrial PLC communication, enabling AI agents to read sensors, alarms, status, setpoints, and write setpoints via adapters for Modbus, S7, or custom PLCs.

Category
访问服务器

README

MCP PLC Core 🏭

Universal MCP Server for industrial PLC communication — works with ANY PLC.

Connect any industrial controller to AI agents (Claude, GPT, OpenClaw) via MCP protocol. Siemens, Schneider, ABB, Mitsubishi, Omron, Allen-Bradley, WAGO, CODESYS, Arduino, ESP32, or any custom PLC — write an adapter and it just works.

Don't see your PLC? Write an adapter — takes 15 minutes. Just implement 6 methods in the PLCAdapter interface.

AI Agent (Claude, GPT, OpenClaw)
    ↓ MCP protocol (stdio)
MCP PLC Core
    ↓ your adapter (Modbus, S7, OPC UA, EtherNet/IP...)
PLC → Sensors, Alarms, Motors, Actuators

Quick Start

# Install
npm install mcp-plc-core

# Schneider / ABB / WAGO / CODESYS / Arduino
PLC_HOST=192.168.1.100 npx mcp-plc --adapter modbus

# Siemens S7-1200/1500/300/400
npm install nodes7
PLC_HOST=192.168.1.100 npx mcp-plc --adapter s7

# Mitsubishi / Omron / Allen-Bradley / anything else
npx mcp-plc --adapter ./my-custom-adapter.js

Built-in Adapters

Adapter Protocol Port PLC Types
modbus Modbus TCP 502 Schneider, ABB, WAGO, CODESYS, Arduino
s7 S7 (RFC1006) 102 Siemens S7-1200/1500/300/400

Custom Adapter — Works with ANY PLC

Implement the PLCAdapter interface for your PLC. Regardless of manufacturer, protocol, or model — if it has TCP/IP or serial connectivity, you can write an adapter.

PLCs you can write adapters for:

  • Siemens S7-200/300/400/1200/1500/1700
  • Schneider M340/M580/Modicon
  • ABB AC500/AC580
  • Mitsubishi MELSEC iQ-R/F/L
  • Omron NJ/NX/NP
  • Allen-Bradley ControlLogix/CompactLogix
  • WAGO PFC200/750
  • CODESYS-based controllers
  • Bosch Rexroth IndraMotion
  • Beckhoff TwinCAT
  • Fanuc CNC (FOCAS)
  • Haas / DMG Mori / Mazak
  • Arduino + EthernetShield
  • ESP32 + Modbus/S7 gateway
  • Any custom TCP/UDP protocol
import { PLCAdapter, SensorData, AlarmData, StatusData, SetpointData, OutputData } from "mcp-plc-core";

export class MyPLCAdapter implements PLCAdapter {
  readonly name = "My PLC";
  readonly protocol = "my-protocol";

  async connect() { /* ... */ }
  async disconnect() { /* ... */ }
  isConnected(): boolean { /* ... */ }

  async readSensors(): Promise<SensorData> {
    return {
      temperature: 25.3,
      pressure: 6.2,
      motorSpeed: 1500,
      production: 1234,
    };
  }

  async readAlarms(): Promise<AlarmData> {
    return { active: [], count: 0 };
  }

  async readStatus(): Promise<StatusData> {
    return { status: "running" };
  }

  async readSetpoints(): Promise<SetpointData> {
    return { temperature: 25, pressure: 6, speed: 1500 };
  }

  async readOutputs(): Promise<OutputData> {
    return { green: true, yellow: false, red: false };
  }

  async writeSetpoint(parameter: string, value: number): Promise<boolean> {
    // Write to your PLC...
    return true;
  }
}

Then use it:

import { startServer, MyPLCAdapter } from "mcp-plc-core";

const adapter = new MyPLCAdapter();
await startServer({
  adapter,
  limits: {
    temperature: { min: 0, max: 50 },
    pressure: { min: 0, max: 10 },
  },
});

MCP AI Integration

Claude Desktop / OpenClaw

{
  "mcpServers": {
    "plc": {
      "command": "npx",
      "args": ["mcp-plc", "--adapter", "modbus"],
      "env": {
        "PLC_HOST": "192.168.1.100",
        "PLC_PORT": "502"
      }
    }
  }
}

Siemens S7

{
  "mcpServers": {
    "plc": {
      "command": "npx",
      "args": ["mcp-plc", "--adapter", "s7"],
      "env": {
        "PLC_HOST": "192.168.1.100",
        "PLC_SLOT": "1"
      }
    }
  }
}

Tools

Tool Description Example
read_sensor Read sensor value "What's the temperature?"
get_alarms Get active alarms "Any alarms active?"
get_status Full system status "How's the line running?"
get_setpoints Current setpoints "What are the setpoints?"
write_setpoint Write setpoint (safe!) "Set temperature to 35°C"
get_all Everything at once "Give me all data"

Resources

Resource Description
plc://tags Available sensors/tags
plc://alarms Alarm definitions
plc://status Current status
plc://info PLC and adapter info

Safety

  • ✅ Read-only by default — no writes without explicit tool call
  • ✅ Safety limits — configurable min/max for setpoints
  • ✅ Audit logging — all tool calls logged
  • ✅ Adapter isolation — protocol-specific errors don't leak
  • ⚠️ Write protection — only setpoint registers, never I/O directly

Architecture

src/
├── adapter.ts          ← PLCAdapter interface (implement this)
├── server.ts           ← MCP server (generic, adapter-agnostic)
├── cli.ts              ← CLI entry point
├── index.ts            ← Package exports
└── adapters/
    ├── modbus.ts       ← Modbus TCP adapter (built-in)
    └── s7.ts           ← Siemens S7 adapter (built-in)

Writing a New Adapter

6 methods. 15 minutes. Works with any PLC.

  1. Create src/adapters/myplc.ts
  2. Implement PLCAdapter interface (6 methods)
  3. Register in cli.ts:
if (adapterName === "myplc") {
  const { MyPLCAdapter } = await import("./adapters/myplc.js");
  return new MyPLCAdapter({ host, port });
}
  1. Submit PR! 🎉

Supported Protocols (via adapters)

Protocol Status Adapter
Modbus TCP ✅ Built-in modbus
S7 (RFC1006) ✅ Built-in s7
OPC UA ✅ Via community node-opcua
EtherNet/IP ✅ Via community ethernetip
BACnet ✅ Via community bacstack
MQTT + Sparkplug B ✅ Via community mqtt
Mitsubishi MC Protocol 🔨 Community needed —
Omron FINS 🔨 Community needed —
Allen-Bradley CIP 🔨 Community needed —
Bosch Rexroth 🔨 Community needed —
Fanuc FOCAS 🔨 Community needed —
Haas NGC 🔨 Community needed —
Any custom TCP/UDP ✅ Adapter interface PLCAdapter

Don't see your protocol? Implement PLCAdapter — 6 methods, 15 minutes of work. Submit a PR and it'll be in the next release.

Environment Variables

Variable Default Description
PLC_HOST 127.0.0.1 PLC IP address
PLC_PORT varies PLC port (502 for Modbus, 102 for S7)
PLC_ADAPTER modbus Adapter to use
PLC_RACK 0 Rack number (S7 only)
PLC_SLOT 1 Slot number (S7: 1, S7-300/400: 2)

License

MIT — use it, fork it, build adapters for your PLC.


HD WebDesign — MCP for industrial automation

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选