digital-twin-mcp
digital-twin-mcp
디지털 트윈 시나리오의 장치 데이터 기능을 MCP 도구로 패키징합니다. 모든 MCP 클라이언트(WorkBuddy, Claude Desktop, Cursor 등)에서 장치 상태를 직접 조회하고, 실시간 지표를 읽고, 시계열 데이터를 가져오고, 알람을 확인할 수 있습니다.
디지털 파이프라인의 설계자 · 두 번째 블록: 장치 모니터링 파이프라인 첫 번째 블록: https://github.com/xici001/workflow-templates(AI 자동화 워크플로 템플릿)
기능
도구 | 설명 |
| 씬 내 모든 장치 나열 (유형 / 위치) |
| 장치 실시간 지표 읽기 (PLC 폴링 시뮬레이션) |
| 특정 지표의 최근 시계열 데이터 읽기 (추세 그래프 / 3D 시각화용) |
| 장치 매개변수 쓰기 (PLC 값 쓰기 / 장애 주입 테스트 시뮬레이션) |
| 임계값 알람 확인 (warning / critical 등급) |
리소스 | 설명 |
| 장치 대장: 메타데이터 + 지표 범위 및 알람 임계값 |
| 3D 씬 레이아웃: 장치 월드 좌표 (Three.js / Unity 직접 오버레이) |
프롬프트 | 설명 |
| 지정된 장치의 상태 보고서 생성 |
Related MCP server: mcp-live-telemetry
아키텍처
MCP 客户端(WorkBuddy / Claude Desktop / ...)
│ stdio 或 streamable-http
┌───────▼───────────────┐
│ server.py (FastMCP) │ ← 工具 / 资源 / 提示词定义
└───────┬───────────────┘
│
┌───────▼───────────────┐
│ alerts.py │ 告警规则引擎(阈值分级)
│ device_registry.py │ 设备台账 + 指标配置 + 3D 坐标
│ simulator.py │ PLC 数据驱动(BasePLCDriver 接口)
└───────────────────────┘v0 데이터 소스는 시뮬레이션 PLC 드라이버입니다 (고정 랜덤 시드, 재현 가능; 사출기 온도가 일부러 임계값에 가깝게 상승하여 알람 에스컬레이션 데모에 용이).
실제 장치 연결 시
BasePLCDriver를 상속하여read_metrics/write_value를 구현하면 됩니다 (OPC-UA / Modbus / 게이트웨이 API 모두 가능), Server 계층은 변경 없음.
빠른 시작
pip install -e .
# 方式一:stdio 传输(MCP 客户端默认)
python -m digital_twin_mcp.server
# 方式二:streamable-http 传输
python -m digital_twin_mcp.server --transport streamable-http엔드투엔드 테스트 (server 하위 프로세스를 시작하고 stdio 프로토콜로 호출):
python examples/client_test.pyWorkBuddy 연동
examples/workbuddy_mcp.json의 내용을 C:\Users\33033\.workbuddy\mcp.json의 mcpServers에 병합한 다음, 커넥터 관리 페이지 오른쪽 위의 사용자 정의 커넥터 항목에서 digital-twin-mcp에 대해 「신뢰」를 클릭하여 활성화합니다.
workflow-templates와의 관계
같은 "디지털 파이프라인" 브랜드 아래의 두 블록:
workflow-templates: 정신 노동 (재무 보고서 분석 등)을 워크플로로 패키징digital-twin-mcp: 장치 데이터 기능 (디지털 트윈 / PLC)을 MCP 도구로 패키징
둘은 향후 결합할 수 있습니다: 워크플로 템플릿의 「장치 상태 보고서」 등의 템플릿은 이 MCP의 도구를 직접 호출하여 실제 데이터를 얻을 수 있습니다.
로드맵
v0.1: 시뮬레이션 PLC + 도구 5개 + 리소스 2개 + 프롬프트 1개 (현재)
v0.2: OPC-UA 실제 연동, 시계열 데이터 저장 (SQLite/InfluxDB), WebSocket 푸시
v0.3: 3D 씬 연동 (씬 레이아웃 리소스를 Three.js 렌더링에 연결), 다중 공장 인스턴스
라이선스
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
- AlicenseBqualityBmaintenanceExposes 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-
- AlicenseNot gradedqualityDmaintenanceEnables MCP clients to connect to OPC UA servers and read real-time industrial data or write control values through standardized MCP tools.MIT