digital-twin-mcp
This server exposes digital twin device data as MCP tools/resources/prompts, letting any MCP client query and control simulated PLC devices in a 3D factory scene.
List all devices with type and location (
list_devices)Read live device metrics, advancing one sampling cycle per call (
get_device_metrics)Fetch recent time-series history for a metric, useful for trend charts and 3D visualization (
get_metric_history)Write device parameters, supporting fault-injection tests like raising temperature to trigger alerts (
set_device_value)Check threshold alerts with warning/critical levels, for all devices or a specific one (
check_alerts)Get a full scene snapshot: device coordinates, real-time metrics, and alerts in one call for visualization/monitoring (
get_scene_snapshot)Access device profile and scene layout as MCP resources (
device://{id}/profile,scene://layout)Generate a device health report via the
device_health_reportpromptTransport options: stdio or streamable-http; architecture supports swapping the simulated PLC driver for real OPC-UA/Modbus/gateway drivers without changing the server layer
The MCP server can be used with WorkBuddy as a client to query device status, read real-time metrics, pull time-series data, and check alerts.
Planned integration for time-series data storage, enabling persistence of metric history for historical analysis.
Planned integration for time-series data storage, enabling persistence of metric history for historical analysis.
The MCP server provides 3D scene layout resources with device world coordinates, which can be directly consumed by Three.js for rendering.
The MCP server provides 3D scene layout resources with device world coordinates, which can be directly consumed by Unity for rendering.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@digital-twin-mcp check active alerts across all devices"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
digital-twin-mcp
Package the device data capabilities of digital twin scenarios into MCP tools—any MCP client (WorkBuddy, Claude Desktop, Cursor, etc.) can directly query device status, read real-time metrics, pull time-series data, and check alerts.
Architect of the Digital Pipeline · Second Building Block: Device Monitoring Pipeline First building block: https://github.com/xici001/workflow-templates (AI automation workflow templates)
What it can do
Tool | Description |
| List all devices in the scene (type / location) |
| Read real-time device metrics (simulated PLC polling) |
| Read recent time-series data for a metric (for trend charts / 3D visualization) |
| Write device parameters (simulated PLC write / fault injection testing) |
| Threshold alert check (warning / critical levels) |
Resource | Description |
| Device ledger: metadata + metric ranges and alert thresholds |
| 3D scene layout: device world coordinates (directly overlayable in Three.js / Unity) |
Prompt | Description |
| Generate a health report for the specified device |
Related MCP server: AetherEdge
Architecture
MCP 客户端(WorkBuddy / Claude Desktop / ...)
│ stdio 或 streamable-http
┌───────▼───────────────┐
│ server.py (FastMCP) │ ← 工具 / 资源 / 提示词定义
└───────┬───────────────┘
│
┌───────▼───────────────┐
│ alerts.py │ 告警规则引擎(阈值分级)
│ device_registry.py │ 设备台账 + 指标配置 + 3D 坐标
│ simulator.py │ PLC 数据驱动(BasePLCDriver 接口)
└───────────────────────┘The v0 data source is a simulated PLC driver (fixed random seed, reproducible; injection molding machine temperature is deliberately drifted close to the threshold to make alert escalation easy to demonstrate).
To connect real devices, inherit
BasePLCDriverand implementread_metrics/write_value(OPC-UA / Modbus / gateway API all work), with zero changes to the Server layer.
Quick Start
pip install -e .
# 方式一:stdio 传输(MCP 客户端默认)
python -m digital_twin_mcp.server
# 方式二:streamable-http 传输
python -m digital_twin_mcp.server --transport streamable-httpEnd-to-end test (start the server subprocess and call it via the stdio protocol):
python examples/client_test.pyIntegrate with WorkBuddy
Merge the contents of examples/workbuddy_mcp.json into the mcpServers key of C:\Users\33033\.workbuddy\mcp.json, then click "Trust" on digital-twin-mcp in the custom connector entry at the top right of the Connector Management page to enable it.
Relationship with workflow-templates
Two building blocks under the same "Digital Pipeline" brand:
workflow-templates: Package mental work (financial report analysis, etc.) into workflowsdigital-twin-mcp: Package device data capabilities (digital twin / PLC) into MCP tools
The two can be combined in the future: templates such as "Device Health Report" in workflow templates can directly call this MCP's tools to fetch real data.
Roadmap
v0.1: Simulated PLC + 5 tools + 2 resources + 1 prompt (current)
v0.2: Real OPC-UA integration, time-series data persistence (SQLite/InfluxDB), WebSocket push
v0.3: 3D scene integration (scene layout resource connected to Three.js rendering), multi-factory instances
License
MIT License
Available Tools
6 toolscheck_alertsA
检查告警:不传 device_id 时遍历全部设备,返回 warning / critical 分级告警列表。
Inputs: device_id. Returns: result
get_device_metricsA
读取设备实时指标,返回指标名 / 数值 / 单位(每次调用推进一个采样周期)。
Inputs: device_id (required). Returns: object
get_metric_historyA
读取设备某指标的最近 N 个采样值(时序数据,供趋势图 / 3D 可视化使用)。
Inputs: metric (required), device_id (required), points. Returns: object
get_scene_snapshotA
数字孪生场景快照:一次调用返回全部设备的坐标、实时指标与分级告警(专供可视化 / 监控轮询)。
Inputs: no named parameters. Returns: object
list_devicesA
列出数字孪生场景中的所有设备(含类型与所在位置)。
Inputs: no named parameters. Returns: result
set_device_valueA
写入设备参数(模拟 PLC 写值;也可用于演示故障注入,如手动抬高温度触发告警)。
Inputs: value (required), metric (required), device_id (required). Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool addresses a distinct concern: device enumeration, live metric read, historical metric retrieval, parameter write, alert checking, and a full scene snapshot. No two tools overlap in purpose, and the descriptions reinforce their boundaries.
All tool names follow the verb_noun pattern in snake_case (list_devices, get_device_metrics, get_metric_history, set_device_value, check_alerts, get_scene_snapshot). The pattern is predictable and consistent.
Six tools form a well-scoped set for a digital twin server, covering read, write, history, alerts, and snapshot use cases without bloat. The count is ideal for the domain and avoids both thin and heavy footprints.
The tool surface covers the full lifecycle of interacting with a simulated twin: listing devices, reading live metrics and history, writing values for control or fault injection, checking alerts, and obtaining a complete scene snapshot. No obvious gaps exist for the stated purpose.
Related MCP Connectors
Public MCP digital twin with synthetic systems and an agent firewall. No customer data.
Protocol-native energy infrastructure orchestration for AI data centers. Provides 46 MCP tools across 8 grid protocols (IEC-61850, DNP3, Modbus, OCPP, OpenADR, IEEE 2030.5, IEC 60870-5-104, ICCP) with 5 core API primitives: connect, dispatch, settle, comply, and intel. Enables AI agents to programmatically interact with substations, grid interfaces, and energy assets for real-time workload-grid coordination.
Governed data discovery, exact queries, decisions, simulations, and runtime utilities over MCP.
Hosted MCP endpoint with realistic fake data for prototyping agents. 12 tools, no setup.
Related MCP Servers
- AlicenseBqualityCmaintenanceUniversal 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.6MIT
- AlicenseBqualityCmaintenanceExposes a deterministic IoT edge runtime — Modbus/CAN/J1939 acquisition, local rules, alarms, and history — to AI assistants as typed, governed MCP tools. Reads are safe by default; device control stays deny-by-default, explicitly confirmed, and audited.233Apache 2.0
- AlicenseAqualityCmaintenanceExposes live industrial IoT telemetry to any MCP client, streaming simulated sensor data from a fleet of machines and detecting anomalies, with the ability to inject faults on demand.4MIT
- FlicenseNot gradedqualityDmaintenanceProvides 19 tools for discovery, data analysis, configuration, and simulation, enabling an agent to drive digital twin workflows with session persistence and knowledge graph capabilities.1-