dsh-tia-mcp-plugin: Integrating Siemens TIA Portal into DeepSeek Harness

Introduction

To modify PLC projects using models, the conventional approach is to manually start the Openness engine in the host process and manually assemble the MCP tool layer. The problem is that TIA Portal V16 and V20/V21 Openness assemblies are incompatible; a single exe cannot cross versions, and manual solutions often require maintaining a separate set of processes and naming for each version. The plugin introduced below, leiyiqi070630-arch/dsh-tia-mcp-plugin, consolidates this into a bundle: one plugin simultaneously hosts two Openness MCP engines for V21 and V16. The model side directly receives mcp__tia-portal__* / mcp__tia-portal-v16__* tools, capable of creating projects, adding hardware, generating PLC/HMI, compiling diagnostics, reading back for verification, and saving.

First, clarify the positioning: this is an unofficial project, unrelated to Siemens AG. Siemens, TIA Portal, SIMATIC, STEP 7, and WinCC are all trademarks of Siemens AG.

What problem does this plugin solve

In one sentence: Connect Siemens TIA Portal into DeepSeek Harness (dsh) to give the model side access to TIA Portal’s Openness capabilities. Maintainer leiyiqi070630-arch, categorized under workflows, repository code is MIT. It is a community plugin in the dsh “everything is a plugin” ecosystem; the accompanying directory page is an independent site with no official affiliation to DeepSeek / Fudan.

Why two engines

V16 and V20/V21 Openness assemblies are incompatible: V16 is a monolithic Siemens.Engineering.dll, while V20+ is split into Siemens.Engineering.Base/Step7/..., with different IL layer bindings; a single exe cannot cross versions. Therefore, the plugin consists of two independent processes and two serverNames, ensuring tool names naturally do not conflict.

V21 Engine V16 Engine
Source TIA Portal Openness MCP (MIT, delivered zip) 2phenix/tia-mcp-v16 + local patch
Number of Tools 240 (67 listed by default, the rest handled via FindTools/CallTool) 24
Tool Names mcp__tia-portal__* mcp__tia-portal-v16__*
Connection Method ConnectIsolated (standalone headless instance) / Connect (blocked by dsh guard) connect_isolated (new via local patch) / or attach an already running V16
HMI Unified + Classic Only Classic (Basic/Comfort/Advanced)
Context Cost ~61 KB schema ~9.5 KB schema

Installation

Prerequisites: Windows, DeepSeek Harness (with plugin_manager), the target TIA Portal version installed, and the Openness user group authorized.

# 1) V21 Engine: Extract from your own delivery zip (verify sha256 in MANIFEST)
pwsh -File .\scripts\bootstrap-v21.ps1 -ZipPath 'C:\path\to\TIA_MCP_..._v2.7.8.1_20261102.zip'

# 2) V16 Engine: Clone upstream -> Patch -> Local compile (requires .NET SDK 8+ and TIA V16)
pwsh -File .\scripts\build-v16.ps1

# 3) Expand config (replace __PLUGIN_DIR__ with local absolute path)
pwsh -File .\scripts\install.ps1

Then execute the bundle installation in a dsh session:

plugin_manager action=install_bundle target=<absolute path to this repository>

Replace an installed version: first remove_bundle, then install_bundle (new modules require a dsh restart to load). If you only want one engine, simply delete the corresponding insert line in cordis.patch.yml.

Installation in China (GitHub Mirrors)

Direct connection to github.com often times out. The public mirrors provided in the README are tested working as of 2026-11-05 (via git ls-remote round-trip):

Mirror Usage Prefix Measured Latency
gh-proxy.com https://gh-proxy.com/ + original GitHub URL 0.9 s
ghfast.top https://ghfast.top/ + original GitHub URL 1.5 s
gitclone.com https://gitclone.com/github.com/<owner>/<repo>.git 2.5 s
ghproxy.net https://ghproxy.net/ + original GitHub URL 7.9 s

The README notes that kkgithub.com is not currently accessible. If you don’t want to manually pick a mirror, you can use the repository’s built-in auto-install script. It will sequentially probe the official site and the four mirrors above, clone the first one that works, and then automatically run install.ps1:

pwsh -File .\scripts\quick-install.ps1 -V21Zip 'D:\downloads\TIA_MCP_..._v2.7.8.1_20261102.zip'

You can also make all GitHub addresses automatically route through a mirror. After configuring this once, git clone https://github.com/... will be rewritten automatically:

git config --global url."https://ghfast.top/https://github.com/".insteadOf "https://github.com/"

Downloading Release attachments can also use the mirror prefix:

curl.exe -L -o dsh-tia-mcp-plugin.zip https://ghfast.top/https://github.com/leiyiqi070630-arch/dsh-tia-mcp-plugin/releases/download/v2.7.8-5/dsh-tia-mcp-plugin-2.7.8-5.zip

Mirrors are third-party services responsible only for moving code. If unsure, verify the commit: compare git -C "$env:USERPROFILE\dsh-tia-mcp-plugin" log -1 --format=%H with the commit shown on the repository page. For more troubleshooting (SSL handshake failures, revocation checks, proxies), see the repository’s docs/CN-MIRRORS.md.

Configuration Essentials

In cordis.patch.yml (generated from a template by install.ps1), there are only three places that need to be changed per machine:

command: '__PLUGIN_DIR__\runtime\v21\TiaMcpServer.exe'   # Engine location
args: [--tia-major-version, '21']                        # Required when installing multiple versions
env:  { TiaPortalLocation: 'C:\Program Files\Siemens\Automation\Portal V21' }
env:  { TIA_OPENNESS_DIR:  'C:\Program Files\Siemens\Automation\Portal V16\PublicAPI\V16' }

V16 Write Protection (Built-in by plugin, Host-side)

The V16 engine defaults to attaching to the project you have open in the UI, and its tool names don’t contain Connect, so dsh’s tia-collision-guard cannot control it. Therefore, the plugin registers its own guard, blocking only 10 write-related tools (set_attribute, import_*, compile, compile_hmi, save_project).

Allowing write operations requires passing four checks:

  1. In the engine state file %LOCALAPPDATA%\tia-mcp-v16\state.json, mode=isolated
  2. The pid process inside is still alive
  3. State is not expired (maxStateAgeMinutes, default 480)
  4. The exe in the state equals this plugin’s engine (prevents mis-trusting an isolated state written by another host)

If any check fails, it is rejected, and two paths are provided: first connect_isolated (with a project copy), or explicitly setting TIA_V16_ALLOW_WRITE=1. Read-only tools are always allowed. The guard’s own status is written to %LOCALAPPDATA%\tia-mcp-v16\guard-status.json, where you can confirm it is loaded without triggering a rejection.

mcp__tia-portal__Bootstrap / mcp__tia-portal-v16__tia_status     # Check environment and instance ownership first
.connect_isolated(project copy path)                                # Start a standalone headless instance, don't touch open windows
Read-only verification → Write → compile → save_project → disconnect  # Complete a batch of tasks in one connection

Isolation is not free: starting a headless V16 instance takes about 50 seconds in practice. The README warns against connecting and doing one thing at a time within a single block.

How Large Objects are Handled (V16)

The original V16 engine truncated all export_* results to 60,000 characters. HMI screens are often 190 KB, making exports useless. The patch adds two things: export_* accepts an optional outPath, writing to a file and returning {file, bytes, preview} without truncation; import_* accepts an optional file, reading disk XML directly, choosing between xml and file. Thus, a 200 KB screen XML does not need to traverse the dialogue context.

Verification Status

Details can be found in the repository’s docs/VERIFICATION.md. The summary is as follows:

  • Verified (tested locally, all on isolated instances + project copies): V21 full chain (create project -> add CPU -> variable table -> S7DCL LAD -> compile 0 errors 0 warnings -> XML readback); V16 full chain (isolate open copy -> import_scl -> compile -> export_block_xml -> save_project -> reopen to confirm disk write); V16 HMI round-trip (export 193 KB screen to disk -> backfill -> compile_hmi 0 errors -> confirm disk write); Write protection guard 13 unit test paths.
  • Not Verified: HMI compilation prerequisites on real projects (runtime system password / start screen), download to physical PLC or PLCSIM, online write values, V16 set_attribute normal path, crash pre-check for HMI imports with symbolic links. The README explicitly states: Compilation passing ≠ Runtime verification, Blank project passing ≠ Field verification.

Training Materials and Repository Self-Check

vendor/tia-openness-mcp/ is the Chinese training camp included in the V21 engine delivery package (Lessons 00–13 + exercises and reference answers + 16 offline verification proofs), as well as docs/, 手册/ (manuals), templates/, manifest/tools-list.json (full tool signatures) and self-check scripts (Check-S7DCL.ps1, Check-LadReadback.ps1, audit/*.ps1). The engine’s built-in GetTrainingLesson(path=...) reads the same content; this is an offline copy, allowing machines without the engine to browse syntax, templates, and the forbidden list.

Key points of repository structure:

cordis.patch.yml.template   bundle patch template (three lines: V21 / V16 / write protection guard)
index.js                    host-side V16 write protection guard
patches/v16-local.patch     patch for upstream 2phenix/tia-mcp-v16 (does not redistribute source code)
scripts/                    bootstrap-v21 / build-v16 / install / validate.mjs (repo self-check)
MANIFEST.json               expected engine SHA256 and file versions

Use the following command for local self-check (CI also runs the same script, zero dependencies):

node scripts/validate.mjs

Applicable Scenarios and Notes

Suitable for developers already using dsh on Windows who need the model to participate in TIA Portal project setup or batch modifications, and are willing to operate on isolated instances and project copies.

A few points to note: the plugin runs with the current dsh process permissions; check the source code and license before installing. This repository’s code is MIT; see THIRD_PARTY_NOTICES.md for third-party engines (V21 engine is MIT; V16 upstream has no LICENSE, so only patches are released and source code is not redistributed); the repository does not contain engine binaries, which must be prepared manually following the three steps above.

Conclusion

The value of this plugin lies in encapsulating the long-term pain point of “TIA Portal version incompatibility” into a fixed structure of one plugin + two engines, and adding a host-side write protection layer to address the V16 attach risk. Directory page: https://www.skillhub.cn/plugins/leiyiqi070630-arch/dsh-tia-mcp-plugin; Repository: https://github.com/leiyiqi070630-arch/dsh-tia-mcp-plugin.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye