digital-twin-mcp
digital-twin-mcp
デジタルツインシナリオのデバイスデータ機能をMCPツールとしてパッケージ化——あらゆるMCPクライアント(WorkBuddy、Claude Desktop、Cursorなど)から、デバイス状態の照会、リアルタイム指標の読み取り、時系列データの取得、アラートの確認が直接行えます。
デジタルパイプラインの設計者 · 2つ目の積み木:デバイス監視パイプライン 1つ目の積み木: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 との関係
同じ「デジタルパイプライン」ブランドの2つの積み木:
workflow-templates:頭脳労働(財務分析など)をワークフローとしてパッケージ化digital-twin-mcp:デバイスデータ機能(デジタルツイン / PLC)をMCPツールとしてパッケージ化
両者は将来組み合わせ可能:ワークフローテンプレートの「デバイスヘルスレポート」などのテンプレートは、このMCPのツールを直接呼び出して実データを取得できます。
ロードマップ
v0.1:シミュレートPLC + 5ツール + 2リソース + 1プロンプト(現在)
v0.2:OPC-UA実接続、時系列データのDB保存(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