Skip to content

Commit f081537

Browse files
committed
release: v1.0.0 — headless 默认 + ScaffoldProject 一键建工程 + 可靠性强化
性能: - 默认 headless 启动(WithoutUserInterface),冷启动 ~200-340s → ~10-28s;--with-ui 切回 GUI - 新增 scripts/prewarm_tia.py 常驻 headless,后续会话 Connect ~1s 新工具: - ScaffoldProject(L1): 单 JSON spec 一次调用建完整工程(PLC+HMI+块+编译+画面+保存),支持 dryRun 离线校验 - 现成 spec 模板 scaffold_spec_start_stop / scaffold_spec_motor;SKILL.md §0.5 黄金路径 可靠性: - HMI 软件路径自动探测(不再写死 HMI_RT_1) - ConnectPortal attach 30s 超时,跳过挂死/孤儿实例 - ImportFromDocuments/ImportBlock 导入后回读校验(Meta.verified) 工具收敛 184→180: 下线 4 个 Export*ToTemp 变体 + 易混 Export/Import 工具补消歧描述 版本: AssemblyVersion 1.0.0(双 csproj)、manifest/README/CHANGELOG 同步
1 parent 7aabe92 commit f081537

19 files changed

Lines changed: 1072 additions & 41 deletions

CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,29 @@
11
# Change Log
22

3+
## [1.0.0] - 2026-06-02
4+
5+
首个 1.0 大版本,聚焦「快、好用、不出错」。
6+
7+
### 性能 — 启动从分钟级降到秒级
8+
9+
- **默认 headless 启动**:连接 TIA 时默认 `WithoutUserInterface`,冷启动从约 200–340s 降到约 10–28s(实测全量回归 21/21 通过,含 WinCC Unified HMI)。需要可视化检查时加 CLI `--with-ui` 启动完整 GUI。
10+
- **常驻实例(可选)**:附带 `scripts/prewarm_tia.py`,保活一个 headless TIA 后,后续会话的 `Connect` 直接 attach,约 0.8–1s(实测并发 attach 可行)。
11+
12+
### 新工具 — 一次调用生成完整工程
13+
14+
- **`ScaffoldProject`**(L1):单个 JSON spec 一步生成完整工程——自动连接 → 建项目 → 加 PLC(+可选 Unified HMI)硬件 → UDT/全局 DB/PLC 标签表 → 导入 SCL 外部源与 LAD(S7DCL)→ 编译 → HMI 连接/画面/变量 → 保存,返回逐步报告。把约 20 步的 runbook 收成一次调用。支持 `dryRun=true` 离线校验 spec(块 JSON 形状/SCL·LAD 文件/designJson)不连 TIA。
15+
- **现成 spec 模板**`templates/project-blueprints/scaffold_spec_start_stop.json`(启停控制)、`scaffold_spec_motor.json`(电机控制),均用已验证构建块拼装、编译 0 错。SKILL.md 新增 §0.5 黄金路径。
16+
17+
### 可靠性
18+
19+
- **HMI 软件路径自动解析**:ScaffoldProject 不再写死 `HMI_RT_1`,按设备命名探测真实运行时路径。
20+
- **连接更稳**`ConnectPortal` 给 attach 加 30s 上限,挂死/孤儿 TIA 实例从约 200s 卡死改为快速跳过并启动新实例。
21+
- **导入回读校验**`ImportFromDocuments``ImportBlock` 导入后回读确认块已存在,返回 `Meta.verified`,便于自我纠错。
22+
23+
### 工具收敛
24+
25+
- 工具数 184 → **180**:下线 4 个 `Export*ToTemp` 便捷变体(改用基础导出工具 + 自选目录);为易混的 Export/Import 工具补充「何时用本工具 vs 替代」消歧描述(XML ↔ SCL、单个 ↔ 批量 ↔ 整程序)。
26+
327
## [0.0.40] - 2026-06-02
428

529
### 示例库质量 — SCL/UDT/DB 全面补注释并丰富逻辑

README.en.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# TIA Portal MCP Server (v0.0.39 · V20 + V21 · S7DCL)
1+
# TIA Portal MCP Server (v1.0.0 · V20 + V21 · S7DCL)
22

33
**English** · [中文](README.md)
44

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# TIA Portal MCP 完整交付包(**v0.0.39** / V20+V21 + S7DCL)
1+
# TIA Portal MCP 完整交付包(**v1.0.0** / V20+V21 + S7DCL)
22

33
[English](README.en.md) · **中文**
44

@@ -11,6 +11,14 @@
1111
**Windows + TIA Portal V20 或 V21** 下,通过 **MCP(stdio 或 HTTP)** 驱动博途:建项目、加硬件、生成 PLC(Tag/UDT/DB/SCL/LAD)、生成 **WinCC Unified** 画面与事件、编译诊断、保存。
1212
包内含 **已编译运行时**、Skill、静态工具清单、能力矩阵、PLC/HMI 模板、**一键可读的项目蓝图**与手册。**不要求**另行克隆源码仓库。
1313

14+
## v1.0.0 新功能(快、好用、不出错)
15+
16+
- **默认 headless 启动,连接快 ~10×**:连 TIA 默认无界面(`WithoutUserInterface`),冷启动从约 200–340s 降到约 10–28s。要肉眼看博途时,启动 exe 加 `--with-ui`(或生成完直接打开 `.ap21`)。
17+
- **`ScaffoldProject` —— 一句话生成完整工程**:传一个 JSON `spec`,一次调用完成「建项目 → 加 PLC/HMI 硬件 → UDT/DB/标签表 → SCL/LAD 块 → 编译 → HMI 连接/画面/变量 → 保存」,返回逐步报告。把约 20 步的 runbook 收成一次调用。`dryRun=true` 可离线校验 spec 再真跑。现成模板见 `templates/project-blueprints/scaffold_spec_start_stop.json`(启停)、`scaffold_spec_motor.json`(电机)。
18+
- **常驻实例,会话秒连(可选)**:开一个终端跑 `python scripts/prewarm_tia.py` 挂着,之后每个会话 `Connect` 约 0.8–1s。
19+
- **更不易出错**:HMI 软件路径自动探测(不再写死 `HMI_RT_1`);连接对挂死/孤儿 TIA 实例加超时跳过;单块导入(`ImportFromDocuments`/`ImportBlock`)导入后回读确认并返回 `Meta.verified`
20+
- 工具收敛至 **180**(下线 4 个 `Export*ToTemp` 变体,并为易混的 Export/Import 工具补消歧描述)。
21+
1422
**本次更新(相对 20260512 包)**
1523

1624
- **稳定生成硬门槛(v0.0.39)**:基于 v0.0.38,`PlcBuildAndImport` 会返回 `CapabilityDecision` / `CapabilityWarnings` / `RecommendedNextActions``ApplyUnifiedHmiScreenDesignJson(strict=true)` 默认遇到 HMI 属性写入失败即报错;`EnsureUnifiedHmiTag(requireVerifiedBinding=true)` 默认要求读回 `SymbolicVerified``AbsoluteVerified`,避免“生成成功但变量未真实链接”的公开版体验问题。

docs/tool-capability-matrix.md

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
本文件由源码中的 `[McpServerTool]` 静态抽取生成,运行时仍以 `tools/list` 为准。
44

5-
- 生成时间:2026-05-31 20:40:09
6-
- 工具数量:183
5+
- 生成时间:2026-06-02 18:38:25
6+
- 工具数量:180
77

88
## L0
99

@@ -69,7 +69,7 @@
6969
| ImportPlcTagTable | [L1][PLC-Software]Import one PLC tag table XML file into PLC software (best-effort) |
7070
| CompileSoftware | [L1][PLC-Software] Compile all blocks in the PLC software. Requires: Connect + OpenProject. Returns basic success/failure. For structured error/warning details use CompileAndDiagnosePlc instead. Must compile before ExportBlock if any blocks are inconsistent. After adding new blocks via import, always compile to catch type/interface mismatches. |
7171
| GetSoftwareTree | [L1][PLC-Software] Get the full PLC block/type/external-source hierarchy as ASCII tree. Requires: Connect + OpenProject. softwarePath from GetProjectTree (e.g. 'PLC_1'). ALWAYS call before ExportBlock/ImportBlock to get exact group paths (e.g. 'Program blocks/FBs/FB_Motor'). Returns OB/FB/FC/GlobalDB/UDT/ExternalSource blocks with group hierarchy. |
72-
| ImportBlock | [L1][PLC-Software] Import a single XML block file into PLC software. Requires: Connect + OpenProject. importPath must be an absolute path to a .xml file. After import, call CompileAndDiagnosePlc to verify. For multiple files use ImportBlocksFromDirectory; for JSON-built blocks use PlcBuildAndImport. |
72+
| ImportBlock | [L1][PLC-Software] Import a single SimaticML XML block file into PLC software. Requires: Connect + OpenProject. importPath must be an absolute path to a .xml file. After import it reads back to confirm the block is present (Meta.verified); call CompileAndDiagnosePlc for full consistency. Pick the right tool: SCL/.s7dcl text → ImportFromDocuments; multiple XML files ImportBlocksFromDirectory; a full exported program (UDTs+tags+blocks) → ImportPlcProgramFromDirectory; JSON-built blocks PlcBuildAndImport. |
7373
| CompileAndDiagnosePlc | [L1][PLC-Software] PREFERRED compile tool. Compiles PLC and returns structured errors/warnings by recursively walking CompilerResult.Messages (V20/V21 PublicAPI). Leaf diagnostics include Path + Description; optional Line/Column via GetAttribute when exposed. Requires: Connect + OpenProject. |
7474
| ImportType | [L1][PLC-Software]Import a type from file into the plc software |
7575

@@ -90,6 +90,7 @@
9090
| OpenProject | [L1][Project] Open a local TIA Portal project (.apXX) or multi-user session (.alsXX) file, where XX is the TIA version number (e.g. .ap21, .als21). Requires: Connect. Closes any currently open project first. After success, call GetProjectTree to explore its structure. |
9191
| AttachToOpenProject | [L1][Project]Attach MCP to an already-open TIA Portal project by name (avoids disposed project handles). |
9292
| CreateProject | [L1][Project] Create a new empty TIA Portal project. Requires: Connect. After creation, call AddDevice to add PLCs/HMIs, then GetProjectTree to verify. The project is automatically opened after creation — no separate OpenProject call needed. |
93+
| ScaffoldProject | [L1][Project] One-shot project generator: from a single JSON spec it creates the project, adds PLC (and optional Unified HMI) hardware, builds UDTs/global DBs/PLC tag tables, imports SCL external sources and LAD S7DCL documents, compiles, sets up the HMI connection/screens/tags, and saves — collapsing the ~20-step runbook into one call. Auto-connects if needed. Critical-step failures (connect/createProject/PLC device) abort; per-element failures are collected and reported. Spec keys: projectName(required); directoryPath?(default %TEMP%); plcName?(PLC_1); plcFamily?(S7-1500); plcMlfb?; hmiName?(omit to skip all HMI); hmiFamily?(WinCCUnifiedPC); hmiSoftwarePath?(HMI_RT_1); connectionName?(HMI_Connection_1); udt?/globalDb?/tagTable? = arrays of the same json objects PlcBuildAndImport accepts; sclSourceFiles? = array of .scl file paths; ladDocs? = array of {importPath,name}; hmiScreens? = array of {screenName,width,height,designJson(object)}; hmiTags? = array of {tagTableName?,tagName,hmiDataType?,plcTag?,address?}; compile?(true); save?(true). Returns a per-step report with compile error/warning counts. Pass dryRun=true to validate the spec offline (PLC block JSON shapes, SCL/LAD file paths, designJson) WITHOUT connecting to TIA or creating anything. |
9394
| SaveProject | [L1][Project] Save the currently open project or session to disk. Requires: Connect + OpenProject. Call after any significant change (device add, block import, HMI edit). Compile first if there are pending changes to ensure consistency. |
9495
| CloseProject | [L1][Project] Close the currently open project or multi-user session. Requires: Connect + OpenProject. Any unsaved changes are lost — call SaveProject first. After closing, the connection remains active but no project is open. |
9596
| GetProjectTree | [L1][Project] Get the full project device/software tree as ASCII art. Requires: Connect + OpenProject. ALWAYS call this first after opening a project to discover the exact softwarePath (e.g. 'PLC_1') and device paths needed by all other PLC/HMI/hardware tools. Returns device names, software nodes, and HMI nodes. |
@@ -267,23 +268,19 @@
267268
| GetBlockInfo | [L2][PLC-Software] Get detailed info for one block (attributes, language, number, modification time). Requires: Connect + OpenProject. blockPath must be fully qualified: 'Group/Subgroup/BlockName' — get it from GetSoftwareTree or GetBlocksWithHierarchy. Returns: IsConsistent (false = must compile before export). |
268269
| GetBlocks | [L2][PLC-Software] Get a flat list of all blocks in PLC software. Requires: Connect + OpenProject. Use GetBlocksWithHierarchy instead when you need group/folder paths for ExportBlock. Returns: block name, number, type (OB/FC/FB/GlobalDB/InstanceDB), programming language. |
269270
| GetBlocksWithHierarchy | [L2][PLC-Software]Get a list of all blocks with their group hierarchy from the plc software. |
270-
| ExportBlock | [L2][PLC-Software] Export one block to an XML file. Requires: Connect + OpenProject + block must be consistent (compile first if IsConsistent=false). blockPath must be fully qualified 'Group/Subgroup/Name' from GetSoftwareTree — bare names return InvalidParams with suggestions. For batch export use ExportBlocks. |
271-
| ExportBlockToTemp | [L2][PLC-Software]Export one block to a temporary directory and return written file paths |
272-
| ImportBlocksFromDirectory | [L2][PLC-Software]Batch import PLC block .xml files from a directory into a block group (V21 recommended path) |
271+
| ExportBlock | [L2][PLC-Software] Export one block to an XML file. Requires: Connect + OpenProject + block must be consistent (compile first if IsConsistent=false). blockPath must be fully qualified 'Group/Subgroup/Name' from GetSoftwareTree — bare names return InvalidParams with suggestions. Pick the right tool: batch → ExportBlocks; readable SCL/.s7dcl text → ExportAsDocuments. |
272+
| ImportBlocksFromDirectory | [L2][PLC-Software] Batch import PLC block .xml (SimaticML) files from a directory into a block group. Pick the right tool: SCL/.s7dcl text → ImportBlocksFromDocuments; a full mixed program with UDTs+tag tables+blocks auto-ordered → ImportPlcProgramFromDirectory; a single XML file → ImportBlock. |
273273
| ImportPlcProgramFromDirectory | [L2][PLC-Software] HIGH-LEVEL batch import tool. Recursively scans a directory for PLC XML files, auto-classifies them as UDT/TagTable/Block, imports in correct dependency order (UDTs first, then tag tables, then blocks), and optionally compiles. Requires: Connect + OpenProject. Best for importing a full exported PLC program or a set of generated XML blocks. |
274274
| RepairAndReimportBlock | [L2][PLC-Software]Try import a block XML; if compile fails, return diagnostics and best-effort suggestions (no destructive actions). |
275-
| ExportBlocks | [L2][PLC-Software]Export all blocks from the plc software to path |
276-
| ExportBlocksToTemp | [L2][PLC-Software]Export blocks to a temporary directory and return written file paths |
275+
| ExportBlocks | [L2][PLC-Software] Export all (or regexName-filtered) blocks to a directory as SimaticML XML. Pick the right tool: readable SCL/.s7dcl text → ExportBlocksAsDocuments; a single block → ExportBlock. |
277276
| GetTypeInfo | [L2][PLC-Software]Get a type info from the plc software |
278277
| GetTypes | [L2][PLC-Software]Get a list of types from the plc software |
279278
| ExportType | [L2][PLC-Software]Export a type from the plc software |
280-
| ExportTypeToTemp | [L2][PLC-Software]Export one type to a temporary directory and return written file paths |
281279
| SeedProjectFromReference | [L2][PLC-Software]Seed PLC blocks/types and HMI screens/tagtables from a reference directory (manifest.json + {{PLACEHOLDER}} replace) |
282280
| ExportTypes | [L2][PLC-Software]Export types from the plc software to path |
283-
| ExportTypesToTemp | [L2][PLC-Software]Export types to a temporary directory and return written file paths |
284281
| ExportAsDocuments | [L2][PLC-Software] PREFERRED on V21+ for exporting one block. Exports a single program block to SIMATIC SD textual / SCL document format (.s7dcl + .s7res) — far more readable/diff-friendly than SimaticML XML (ExportBlock). Requires TIA Portal V20 or newer. |
285282
| ExportBlocksAsDocuments | [L2][PLC-Software] PREFERRED on V21+ for batch export. Exports multiple program blocks to SIMATIC SD textual / SCL document format (.s7dcl + .s7res) — far more readable/diff-friendly than SimaticML XML. Requires TIA Portal V20 or newer. |
286-
| ImportFromDocuments | [L2][PLC-Software] PREFERRED on V21+ for importing one block. Imports a single program block from SIMATIC SD textual / SCL documents (.s7dcl + .s7res) into PLC software. Requires TIA Portal V20 or newer. |
283+
| ImportFromDocuments | [L2][PLC-Software] PREFERRED on V21+ for importing one block. Imports a single program block from SIMATIC SD textual / SCL documents (.s7dcl + .s7res) into PLC software. Requires TIA Portal V20 or newer. After import it reads back to confirm the block is present (Meta.verified). |
287284
| ImportBlocksFromDocuments | [L2][PLC-Software] PREFERRED on V21+ for batch import. Imports multiple program blocks from SIMATIC SD textual / SCL documents (.s7dcl + .s7res) into PLC software. Requires TIA Portal V20 or newer. |
288285

289286
### PLC-TechnologyObjects

manifest/package-manifest.json

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"schemaVersion": "2026-05-25",
3-
"bundleVersion": "0.0.40",
3+
"bundleVersion": "1.0.0",
44
"packageName": "TIA_MCP_交付包_20260525_V20S7DCL_184330",
55
"packageType": "tia-portal-mcp-complete-offline-delivery-bundle",
66
"generatedAt": "2026-05-31T20:30:00+08:00",
@@ -51,14 +51,20 @@
5151
"bundleValidationScript": "scripts/Validate-Bundle.ps1"
5252
},
5353
"capabilities": {
54-
"mcpToolCount": 183,
54+
"mcpToolCount": 180,
5555
"mcpToolLayers": {
5656
"L0": 6,
57-
"L1": 29,
58-
"L2": 152
57+
"L1": 30,
58+
"L2": 144
5959
},
60+
"newToolsThisRelease": [
61+
"ScaffoldProject"
62+
],
6063
"removedToolsThisRelease": [
61-
"SetForceTableEntry"
64+
"ExportBlockToTemp",
65+
"ExportBlocksToTemp",
66+
"ExportTypeToTemp",
67+
"ExportTypesToTemp"
6268
],
6369
"hmiTemplateJsonCount": 8,
6470
"plcTemplateJsonCount": 9,

0 commit comments

Comments
 (0)