Skip to main content
Glama
xici001

digital-twin-mcp

by xici001

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_devices

List all devices in the scene (type / location)

get_device_metrics

Read real-time device metrics (simulated PLC polling)

get_metric_history

Read recent time-series data for a metric (for trend charts / 3D visualization)

set_device_value

Write device parameters (simulated PLC write / fault injection testing)

check_alerts

Threshold alert check (warning / critical levels)

Resource

Description

device://{id}/profile

Device ledger: metadata + metric ranges and alert thresholds

scene://layout

3D scene layout: device world coordinates (directly overlayable in Three.js / Unity)

Prompt

Description

device_health_report

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 BasePLCDriver and implement read_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-http

End-to-end test (start the server subprocess and call it via the stdio protocol):

python examples/client_test.py

Integrate 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 workflows

  • digital-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 tools
check_alertsA

检查告警:不传 device_id 时遍历全部设备,返回 warning / critical 分级告警列表。

ParametersJSON Schema
NameRequiredDescriptionDefault
device_idNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.6/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full disclosure burden and does meaningfully convey the all-device iteration default and the warning/critical tiering of results. It doesn't disclose whether the operation is safe/idempotent, whether the all-device scan has rate-limit or permission implications, or what happens with an invalid device_id. For a simple read-like check, it's adequate but not comprehensive.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single, front-loaded Chinese sentence delivers the verb, resource, conditional behavior, and return structure with zero fluff. Every clause earns its place, and the most decision-relevant behavior (the no-argument path) is placed at the core of the sentence.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with one optional parameter and an available output schema (which covers return structure), the description adequately covers purpose, the default no-argument path, and result tiering. The main omission is contrasting the provided-device_id case explicitly, but for this low complexity (1 param, no required fields, no nested objects), the description is nearly complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0% — the schema only defines an unadorned nullable string with a null default. The description partially compensates by clarifying the meaningful null case (scan all devices), which is genuinely useful semantics beyond the schema. However, it never explicitly states what providing a device_id does (filtering to that device, presumably) or the expected format, so parameter meaning remains only partially established.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb-resource pairing ('检查告警' / check alerts) and adds concrete behavioral scope: when device_id is omitted, it iterates all devices and returns tiered alert lists ('warning / critical 分级告警列表'). It stops short of 5 because no sibling tool in the list (list_devices, get_device_metrics, etc.) obviously overlaps with alerts, so explicit differentiation isn't tested.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description conveys usage context by clarifying the default behavior when device_id is not passed ('不传 device_id 时遍历全部设备') and identifying the two severity tiers in the response, which helps an agent understand the tool's scope. However, it provides no explicit when-to-use vs. alternatives guidance, exclusions, or performance caveats about scanning all devices. The usage guidance is implicitly conveyed rather than explicitly directed.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_device_metricsA

读取设备实时指标,返回指标名 / 数值 / 单位(每次调用推进一个采样周期)。

ParametersJSON Schema
NameRequiredDescriptionDefault
device_idYes

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A3.7/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the burden of behavioral transparency. It discloses a critical side effect: each call advances a sampling period, which is not obvious from the schema. This is valuable context beyond the basic read operation, though it doesn't detail auth or rate limits, which are less critical for a read tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, compact sentence that conveys purpose, output, and a key behavioral trait. It is front-loaded with the core function and contains no wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The output schema exists, so the description doesn't need to detail return values. The tool is simple with one parameter, but the description doesn't address edge cases like invalid device IDs or what happens if no metrics are available. It also doesn't connect to siblings for context, so completeness is adequate but not thorough.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, so the description must compensate for undocumented parameters. It mentions device_id implicitly as 'device' but doesn't add any extra meaning like format, constraints, or default values. The description adds minimal value beyond the schema, and with only one parameter, the baseline is 3.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool reads real-time device metrics and returns metric name/value/unit. It also notes that each call advances one sampling period. This distinguishes it from siblings like get_metric_history and get_scene_snapshot, though it doesn't explicitly name alternatives.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for real-time data retrieval, and the note about advancing a sampling period hints at when to use it (call repeatedly to get successive samples). However, it does not explicitly state when to prefer get_metric_history over this tool for historical data, or provide clear exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_metric_historyA

读取设备某指标的最近 N 个采样值(时序数据,供趋势图 / 3D 可视化使用)。

ParametersJSON Schema
NameRequiredDescriptionDefault
metricYes
pointsNo
device_idYes

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A3.6/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description must convey all behavioral traits. It only states the action (reading sample values) and does not disclose side effects, permissions, or error behavior, nor explicitly confirm it is read-only.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence with no redundant information, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description covers the tool's purpose, inputs, and intended use case. Output format is likely handled by the output schema (which exists). It lacks edge-case details but is adequate for a simple read operation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds meaning by indicating that '某指标' refers to the metric parameter, '设备' to device_id, and '最近 N 个采样值' to points. However, it does not explain the default value of points or any constraints, leaving some gaps given the schema lacks descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states that the tool reads recent N sample values of a device metric, specifying the verb (read), resource (metric history), and scope (device). It differentiates from siblings by mentioning time series data and visualization use cases.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description mentions a use case (trend charts / 3D visualization) but does not explicitly advise when to use this tool over alternatives like get_device_metrics. The guidance is implicit rather than explicit.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_scene_snapshotA

数字孪生场景快照:一次调用返回全部设备的坐标、实时指标与分级告警(专供可视化 / 监控轮询)。

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full behavioral disclosure burden. It discloses a key behavioral trait—a single call returns all devices' data—and specifies the content categories (coordinates, real-time metrics, graded alerts). It does not detail potential payload size or data freshness, but for a zero-parameter read-only snapshot it provides meaningful transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, well-structured sentence that front-loads the core purpose and includes the key differentiator ('one call returns all devices'). Every word contributes value; there is no redundancy or filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a zero-parameter tool with an output schema and no destructive or mutating behavior, this description is complete. It states the return contents, scope, and recommended usage context, making it sufficient for an agent to select and invoke the tool correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters and an empty input schema, so the baseline is 4. The description adds no parameter-specific details because none are needed; all behavior is encapsulated in the fixed snapshot semantics.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb-plus-resource pattern: 'returns all devices' coordinates, real-time metrics, and graded alerts in one call.' It clearly distinguishes this aggregate snapshot tool from sibling tools like get_device_metrics and check_alerts by emphasizing the scene-wide scope.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly states the intended use case: 'exclusively for visualization / monitoring polling.' This gives clear context for when to choose this tool, though it does not explicitly name sibling alternatives or state when not to use it.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_devicesA

列出数字孪生场景中的所有设备(含类型与所在位置)。

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.3/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden. It discloses that the tool lists all devices with type and location, which is a read-only behavior by implication. However, it does not explicitly state safety (read-only, no side effects), potential performance implications (e.g., large result sets), or any authentication requirements. This is adequate for a simple list operation but lacks explicit behavioral guarantees, so a 3 is appropriate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence in Chinese that is front-loaded with the action and resource. It contains zero filler words and directly states the purpose and key output fields. This is exemplary conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (no parameters, no nested objects) and the existence of an output schema, the description is fully complete. It states exactly what the tool does and what information is included. There is no ambiguity or missing context for an agent to select and invoke this tool correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters, and the schema has 100% coverage (vacuous truth). The rubric sets a baseline of 4 for zero parameters. The description adds no parameter-specific info, but none is needed. It also hints at output content (type and location), which is not parameter semantics but does enrich the tool's usage context.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb (list), resource (all devices), and scope (digital twin scene), and specifies that type and location are included. It clearly distinguishes from sibling tools like get_device_metrics or get_metric_history, which focus on metrics and history, not device enumeration.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context ('in digital twin scene') and it's obvious when to use this tool (to retrieve a device roster). It does not explicitly state when not to use it or name alternatives, but the sibling tool list makes the differentiation clear. This earns a 4 as clear context with no exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

set_device_valueA

写入设备参数(模拟 PLC 写值;也可用于演示故障注入,如手动抬高温度触发告警)。

ParametersJSON Schema
NameRequiredDescriptionDefault
valueYes
metricYes
device_idYes

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A3.5/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description must carry burden. It mentions simulation and fault injection but lacks details on side effects, persistence, or permissions needed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, concise sentence that conveys the core functionality without unnecessary words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given it's a simple setter with no output schema, the description could be complete, but it omits parameter details and behavioral implications, leaving gaps for a write operation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has no parameter descriptions and the tool description does not explain device_id, metric, or value. Parameter semantics are almost entirely missing.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it writes device parameters, simulating PLC writes, and mentions fault injection. This distinguishes it from sibling read/list tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It provides usage contexts (simulating PLC writes, fault injection demos) but does not explicitly contrast with alternatives; still clear enough for typical use.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 6 tool updatesv0.1.0
    • First observedcheck_alerts
    • First observedget_device_metrics
    • First observedget_metric_history
    • First observedget_scene_snapshot
    • First observedlist_devices
    • First observedset_device_value

TDQS

A4.1/5.0

Scored across 6 tools

Disambiguation5/5

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.

Naming Consistency5/5

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.

Tool Count5/5

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.

Completeness5/5

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.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • F
    license
    B
    quality
    B
    maintenance
    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.
    6
    -
  • A
    license
    B
    quality
    A
    maintenance
    Exposes 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.
    23
    3
    Apache 2.0
  • A
    license
    A
    quality
    B
    maintenance
    Exposes 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.
    4
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/xici001/digital-twin-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server