TiaMcp

Read, edit and write back Siemens TIA Portal V21 PLC and HMI projects as plain text files

By Rick Gaiser (individual) C# Local · stdio Developer tools

22 popularity score ★ 27

Connect your client

Local (from source)

Add in one click

Opens the app, which asks before it adds the server. Then replace each <NAME> in its settings with your value.

Or add it by command or config

FirstTerminal
git clone https://github.com/rickgaiser/TiaMcp.git
cd TiaMcp
dotnet build TiaMcp.sln
Claude CodeTerminal
claude mcp add tiamcp -- '<ABSOLUTE_PATH_TO_CLONE>/src/TiaMcp.Host/bin/Debug/net48/TiaMcp.Host.exe'
Claude Desktopclaude_desktop_config.json
{
  "mcpServers": {
    "tiamcp": {
      "command": "<ABSOLUTE_PATH_TO_CLONE>/src/TiaMcp.Host/bin/Debug/net48/TiaMcp.Host.exe",
      "args": []
    }
  }
}
Cursor~/.cursor/mcp.json
{
  "mcpServers": {
    "tiamcp": {
      "command": "<ABSOLUTE_PATH_TO_CLONE>/src/TiaMcp.Host/bin/Debug/net48/TiaMcp.Host.exe",
      "args": []
    }
  }
}
VS Code.vscode/mcp.json
{
  "servers": {
    "tiamcp": {
      "type": "stdio",
      "command": "<ABSOLUTE_PATH_TO_CLONE>/src/TiaMcp.Host/bin/Debug/net48/TiaMcp.Host.exe",
      "args": []
    }
  }
}
Codex~/.codex/config.toml
[mcp_servers.tiamcp]
command = "<ABSOLUTE_PATH_TO_CLONE>/src/TiaMcp.Host/bin/Debug/net48/TiaMcp.Host.exe"
args = []
Gemini CLITerminal
gemini mcp add --scope user tiamcp '<ABSOLUTE_PATH_TO_CLONE>/src/TiaMcp.Host/bin/Debug/net48/TiaMcp.Host.exe'

What it does

TiaMcp is a Windows MCP server that talks to a running Siemens TIA Portal V21 instance through Siemens' Openness API. It attaches to an open project, or opens one by path, and exports the project's source to a folder on disk laid out like the TIA Portal project tree. Ladder, FBD and SCL blocks keep, along with data blocks and UDTs, TIA Portal's own .s7dcl/.s7res text. Whole-block STL comes out as AWL, and S7-GRAPH blocks as a compact text format. PLC tag tables and alarm text lists become CSV files you can open in Excel, and so do WinCC Unified tag tables and alarms. This makes diffs easy to read. WinCC Unified screens, faceplates included, are written out as JSON built from the object model, because Openness has no export format for them. Anything from classic WinCC stays as native Openness XML.

The assistant edits those files with its usual file tools and then calls write_source_tree. Only changed items and new files go back, and each written item is read back so the files match what TIA Portal stored. A _manifest.json records each item's state at read time, and an item someone changed inside TIA Portal since then is refused unless force is set. Separate tools rename, create and delete project items and their folders, from blocks and UDTs to Unified screens and HMI alarms. A few helpers describe screen item types and faceplate interfaces so the assistant can edit screen JSON, and compile now covers HMI software as well as PLCs.

On master, src/TiaMcp.Mcp/TiaTools.cs registers 45 tools. On GRAPH blocks the code goes further than the README: the README calls branches and connections read-only, while the write_source_tree text says a sequence's BRANCHES/CONNECTIONS are rewritten when the file has them. INTERFACE and PREOPERATIONS stay read-only.

What it needs

Runtime.NET
Runs onWindows
Siemens TIA Portal V21Paid planA licensed, installed TIA Portal V21 with your Windows user in the Openness user group
Also
  • .NET Framework 4.8
  • .NET SDK to build TiaMcp.Host.exe

There are no published builds to download, so you build TiaMcp.Host.exe yourself with the .NET SDK (dotnet build TiaMcp.sln). Point your client's command at the built file.

Limits

  • Not covered Hardware configuration and explicit block numbering are not supported.
  • Read only STL inside a mixed FBD/LAD/SCL block can only be written through its raw .xml file.
  • Limit A new GRAPH block is made by cloning an existing one, and GRAPH blocks must compile cleanly before they can be read or written.
  • Not covered Classic WinCC alarms are out of reach, graphic lists are skipped, and classic objects cannot be renamed or deleted.
  • Read only Only existing PLC alarm text lists can be written.
  • Limit A write does not compile. Call compile afterwards. Deleting a file from the tree does not delete the item, use the delete_* tools.
  • Limit TIA Portal V21's .s7dcl import mangles some blocks silently. Reads warn about them and writes refuse them, often pointing to the .xml instead.
  • Limit Grouped WinCC Unified screen items read as loose items with positions relative to a group whose position cannot be read.
  • Size cap Screen writes are slow: a screen of a few hundred items takes about a minute.
  • Limit rename_hmi_screen does not update screen windows or scripts that refer to the screen by name.

Hardware configuration and explicit block numbering are not supported. STL inside a mixed FBD/LAD/SCL block is read-only. A new GRAPH block can only be made by cloning an existing one, and GRAPH blocks must compile cleanly before they can be read or written. Classic WinCC alarms cannot be reached, graphic lists are skipped because exporting them crashes TIA Portal V21, and classic objects cannot be renamed or deleted. Only existing PLC alarm text lists can be written. A write does not compile; call compile_plc afterwards. Deleting a file does not delete the item.

Who it suits

Suits PLC engineers on Windows with TIA Portal V21 who want an assistant to read and change program blocks, tags, HMI tables and Unified screens as text diffs instead of clicking through the editor. It writes straight into a live engineering project, so keep a saved copy or use version control before letting it write. It is no use without a licensed TIA Portal V21 on the same machine, for older TIA versions, or for hardware configuration. It is a community project, not a Siemens product.

Tools 45

7 only read, 25 change things, 13 can delete or overwrite. A ? marks an optional parameter.

tia_connect
Attach to a running TIA Portal, open a project by path, or start the portalprojectPath?: stringprocessId?: integerstartPortal?: boolean
list_tia_instances
List running TIA Portal processes and what each has open, without attaching
save_project_as changes
Save a copy of the project to a new folder and keep working on the copytargetDirectory: string
save_project changes
Save the project in place
close_project changes
Close the connected project
project_status
Show unsaved changes, author and last-save details
delete_plc_udt deletes
Delete a PLC data typeplcName: stringtypeName: string
rename_plc_udt changes
Rename a PLC data typeplcName: stringtypeName: stringnewName: string
create_plc_udt_group changes
Create a data type folderplcName: stringparentGroupPath: stringgroupName: string
delete_plc_udt_group deletes
Delete a data type folder with everything in itplcName: stringgroupPath: string
rename_plc_udt_group changes
Rename a data type folderplcName: stringgroupPath: stringnewName: string
create_plc_instance_db changes
Create an instance DB bound to an existing function blockplcName: stringgroupPath: stringdbName: stringinstanceOfFbName: string
create_plc_group changes
Create a block folderplcName: stringparentGroupPath: stringgroupName: string
delete_plc_group deletes
Delete a block folder with its blocks and subfoldersplcName: stringgroupPath: string
rename_plc_group changes
Rename a block folderplcName: stringgroupPath: stringnewName: string
delete_plc_block deletes
Delete one block by nameplcName: stringblockName: string
rename_plc_block changes
Rename a block in placeplcName: stringblockName: stringnewName: string
rename_plc_tag changes
Rename a PLC tag so block references follow itplcName: stringtagName: stringnewName: string
create_plc_tag_table changes
Create an empty PLC tag tableplcName: stringgroupPath: stringtableName: string
delete_plc_tag_table deletes
Delete a PLC tag table and its tagsplcName: stringtableName: string
rename_plc_tag_table changes
Rename a PLC tag tableplcName: stringtableName: stringnewName: string
create_plc_tag_table_group changes
Create a PLC tag table folderplcName: stringparentGroupPath: stringgroupName: string
delete_plc_tag_table_group deletes
Delete a PLC tag table folder with its contentsplcName: stringgroupPath: string
rename_plc_tag_table_group changes
Rename a PLC tag table folderplcName: stringgroupPath: stringnewName: string
rename_hmi_tag changes
Rename a WinCC Unified HMI tag in placehmiName: stringtagName: stringnewName: string
create_hmi_tag_table changes
Create an empty WinCC Unified HMI tag tablehmiName: stringgroupPath: stringtableName: string
delete_hmi_tag_table deletes
Delete a WinCC Unified HMI tag table and its tagshmiName: stringtableName: string
rename_hmi_tag_table changes
Rename a WinCC Unified HMI tag tablehmiName: stringtableName: stringnewName: string
create_hmi_tag_table_group changes
Create an HMI tag table folderhmiName: stringparentGroupPath: stringgroupName: string
delete_hmi_tag_table_group deletes
Delete an HMI tag table folder with its contentshmiName: stringgroupPath: string
rename_hmi_tag_table_group changes
Rename an HMI tag table folderhmiName: stringgroupPath: stringnewName: string
delete_hmi_alarm_class deletes
Delete a WinCC Unified alarm class no alarm still useshmiName: stringname: string
delete_hmi_alarm deletes
Delete a discrete or analog WinCC Unified alarmhmiName: stringtype: stringalarmName: string
delete_hmi_screen deletes
Delete a WinCC Unified screenhmiName: stringscreenName: string
rename_hmi_screen changes
Rename a WinCC Unified screen (screen windows and scripts keep the old name)hmiName: stringscreenName: stringnewName: string
create_hmi_screen_group changes
Create a WinCC Unified screen folderhmiName: stringparentGroupPath: stringgroupName: string
delete_hmi_screen_group deletes
Delete a screen folder with its screens and subfoldershmiName: stringgroupPath: string
rename_hmi_screen_group changes
Rename a screen folderhmiName: stringgroupPath: stringnewName: string
describe_hmi_item_type
Show the properties, events and dynamization options of a Unified screen item typetype?: string
list_library_types
List project library types with versions and their ContainedType stringsnameFilter?: string
read_faceplate_type
Show a faceplate type's interface properties and eventshmiName: stringcontainedType: string
compile changes
Compile a PLC or HMI software and report errors and warnings with their locationsoftwareName: string
list_project
List PLC and HMI software with their blocks, tables and screens, names onlyfilter?: stringdeviceName?: stringtargetDirectory?: string
read_source_tree changes
Export all or part of the project to files in a folder on disktargetDirectory: stringitems?: arraydeviceName?: stringadoptExisting?: booleanhmiTagLength?: boolean
write_source_tree deletes
Write edited or new files back into the project, with a dry-run optionsourceDirectory: stringitemList?: stringall?: booleancreateMissing?: booleanoverwriteExisting?: booleanforce?: booleandryRun?: boolean

Similar servers