RT

rickgaiser/tiamcp

API 开发

本页由 AI 翻译,技术细节请以原文为准。 查看原文

26 stars 7 forks 质量 70 趋势 32AGPL-3.0

西门子TIA门户的MCP服务器

概览

西门子TIA Portal V21+项目的MCP服务器——通过Openness API直接读写TIA Portal,设计为快速、LLM和用户友好的工作流程。 使 TiaMcp 对大型语言模型(LLM)快速且用户友好的特殊功能:- STL 可读写为文本 AWL(自动阅读/写入) - PLC 表格可转换为/从兼容 Excel 的 CSV - HMI 表可转换为/从兼容 Excel 的 CSV - 图形可转换为(领域特定语言) list_project的每条项行结尾都标注其可读取的格式,例如标签表“Tags”[csv, xml];将此类行传递给read_source_tree以读取这些格式。写入使用被编辑文件的那一格式,拒绝被编辑为两份文件的项目。 所有源代码都以文件的形式在磁盘上的源代码树中读取和写入,因此LLM只读取所需内容,并用小的差分进行编辑,而不是将整个模块通过上下文传递。

概述(AI 翻译)

西门子TIA Portal V21+项目的MCP服务器——通过Openness API直接读写TIA Portal,设计为快速、LLM和用户友好的工作流程。

使TiaMcp对大型语言模型(LLM)快速且易于阅读的特殊功能:

  • STL 可读写为文本 AWL
  • PLC 表格转换为/从兼容 Excel 的 CSV
  • HMI 表格可转换为/与 Excel 兼容的 CSV
  • HMI 报警可转换为/从兼容 Excel 的 CSV
  • GRAPH 转换为/从紧凑文本 DSL(领域特定语言)

格式参考

格式 / 语言 文件扩展名 读取 写入
SCL .s7dcl / .s7res 是的 是的
FBD .s7dcl / .s7res 是的 是的
LAD .s7dcl / .s7res 是的 是的
全局数据库(DATA_BLOCK) .s7dcl / .s7res 是的 是的
图(S7-GRAPH/SFC) .graph.il 是的 部分
实例数据库 .s7dcl + 只读 .interface.txt(已解析成员列表) 是的 仅创建
STL(整块) .awl 是的 是的
STL(嵌入混合FBD/LAD/SCL模块) .stl-networks.awl(或.stl-networks.xml退回)+ .s7dcl/.s7res 是的 仅通过.xml
UDT(PLC数据类型) .s7dcl / '。

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

TiaMcp

MCP server for Siemens TIA Portal V21+ projects — reads and writes directly to TIA Portal via the Openness API, designed for a fast, LLM- and human-friendly workflow.

Special features that make TiaMcp fast for LLM’s and human-readable friendly:

  • STL is read/written as text AWL
  • PLC tables are converted to/from Excel-compatible CSV
  • HMI tables are converted to/from Excel-compatible CSV
  • HMI alarms are converted to/from Excel-compatible CSV
  • GRAPH is converted to/from compact text DSL (Domain Specific Language)

Format reference

Format / Language File extension(s) Read Write
SCL .s7dcl / .s7res Yes Yes
FBD .s7dcl / .s7res Yes Yes
LAD .s7dcl / .s7res Yes Yes
Global DB (DATA_BLOCK) .s7dcl / .s7res Yes Yes
GRAPH (S7-GRAPH/SFC) .graph.il Yes Partial
Instance-DB .s7dcl + read-only .interface.txt (resolved member list) Yes Create-only
STL (whole-block) .awl Yes Yes
STL (embedded in mixed FBD/LAD/SCL block) .stl-networks.awl (or .stl-networks.xml fallback) + .s7dcl/.s7res Yes Through .xml only
UDT (PLC data type) .s7dcl / .s7res Yes Yes
PLC tag table .csv, Excel-compatible (synthesized) Yes Yes
HMI tag table (WinCC Unified) .csv, Excel-compatible (synthesized) Yes Yes
HMI alarms (WinCC Unified) .csv, Excel-compatible (synthesized) Yes Yes
PLC alarm text list (user list) .csv, Excel-compatible (synthesized from TIA’s Excel export) Yes Yes (existing lists)
Classic WinCC (Comfort/Advanced/RT Advanced): screens, screen templates, pop-up screens, tag tables, text lists .xml, native Openness XML Yes Yes
Raw export of any block, UDT or PLC tag table, next to or instead of the formats above .xml, SimaticML as Openness exports it Yes Yes

Each item line of list_project ends with the formats it can be read in, e.g. tag table 'Tags' [csv, xml]; pass such a line to read_source_tree to read those formats. A write uses the one format whose files were edited, and refuses an item edited in two.

All source is read and written as files in a source tree on disk, so an LLM reads only what it needs and edits with small diffs instead of passing whole blocks through its context.

Prerequisites

  • TIA Portal V21 installed, with Openness access enabled for your Windows user (Openness API group membership).
  • .NET Framework 4.8.

Building

dotnet build TiaMcp.sln

Produces src\TiaMcp.Host\bin\Debug\net48\TiaMcp.Host.exe, the MCP stdio server entry point. dotnet test TiaMcp.sln runs the unit tests (no TIA Portal needed).

Registering with Claude Code

Copy .mcp.json.example to .mcp.json and point command at wherever you extracted or built TiaMcp.Host.exe:

{
  "mcpServers": {
    "tia": {
      "command": "C:\\path\\to\\TiaMcp.Host.exe",
      "args": []
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "tia": { "command": "C:\\path\\to\\TiaMcp.Host.exe", "args": [] } } }