TIA Portal MCP-Server
A Visual Studio Code extension to connect to Siemens TIA Portal and interact with TIA Portal projects directly from VS Code with GitHub Copilot. Requirements
ChatThe chat allows you to interact with TIA Portal using natural language commands. You can instruct it to perform tasks such as connecting to a project, exporting PLC programs, modifying files, and importing changes back into TIA Portal. The chat works in conjunction with the Chat Examples using natural language
|
| You say | Tool | Same as |
|---|---|---|
tia connect |
TiaConnect |
OpenTiaProject |
tia pull |
TiaPull |
ExportPlcProgram |
tia pull blocks [rx] |
TiaPullBlocks |
ExportBlocks, optionally by regex |
tia pull types [rx] |
TiaPullTypes |
ExportTypes, optionally by regex |
tia pull tagtables [rx] |
TiaPullTagTables |
ExportTagTables, optionally by regex |
tia pull block <path> |
TiaPullBlock |
ExportBlock, exactly one block by its full path |
tia pull type <path> |
TiaPullType |
ExportType, exactly one PLC data type by its full path |
tia pull tagtable <path> |
TiaPullTagTable |
ExportTagTable, exactly one tag table by its path |
tia pull watchtables [rx] |
TiaPullWatchTables |
ExportWatchTables, optionally by regex |
tia pull watchtable <path> |
TiaPullWatchTable |
ExportWatchTable, exactly one watch table by its path |
tia pull forcetable <path> |
TiaPullForceTable |
ExportForceTable, the force table of the PLC |
tia push |
TiaPush |
ImportPlcProgramChanges with dryRun=false |
tia push preview |
TiaPushPreview |
ImportPlcProgramChanges with dryRun=true |
TiaConnectconnects to the running TIA Portal (or starts one), opens the.apXXproject or.alsXXsession and returns the PLC software paths to use assoftwarePath.pathtakes the preset of--project-path; passportalIdwhen several instances run. It closes the project that is open first, unless it is the one asked for.- The pull tools write the tree of
ExportPlcProgram, each object in the format of<exportPath>/tia.json, so a pull of blocks and a pull of the whole program land in the same folders.TiaPullTagTableswrites one XML file per tag table below<exportPath>/<softwarePath>/PLC tags/<groups>/,TiaPullWatchTablesone per watch table below the watch and force tables folder; both have one format only. - The optional regular expression (
regexName) selects objects by name, e.g..+HMI.TiaPullBlockswrites no types andTiaPullTypesno blocks. - The push tools are the import tools under another name and need
--allow-write.TiaPushshows the same confirmation dialog ("Yes, import") andTiaPushPreviewimports nothing. They read only the files git reports as changed, and not the tag or watch tables; there is no tool that imports tag tables. softwarePathandexportPathtake the presets from--software-pathand--export-path.
Prompts using the tia commands (see "tia porcelain commands" above; with the presets from the json config
file softwarePath and exportPath can be left out):
- 'tia connect'
- 'tia pull'
- 'tia pull blocks'
- 'tia pull blocks ".+HMI_.+"'
- 'tia pull types'
- 'tia pull tagtables'
- 'tia pull watchtables'
- 'tia pull block Group1/Subgroup/FB_Motor'
- 'tia pull type Group1/Udt_Drive'
- 'tia pull tagtable TagGroup1/Table1'
- 'tia pull watchtable WatchGroup1/WatchTable_1'
- 'tia pull forcetable ForceTable'
- 'tia push preview'
- 'tia push'
- 'save project'
MCP-Server
- Refer to tiaportal-mcp
Features
- Connect to a TIA Portal instance
- Browse and interact with TIA Portal projects
- Perform basic project operations from within VS Code
Requirements
- .net Framework 4.8 installed
- Siemens TIA Portal V20 installed and running on your machine
- Check if under
Environment Variables/User variable for user <name>the variableTiaPortalLocationis set toC:\Program Files\Siemens\Automation\Portal V20. Details on nuget.org - Siemens.Collaboration.Net.TiaPortal.Openness.Resolver - User must be in Windows User Group
Siemens TIA Openness. Details on TIA Portal Openness - Adding Users to the Siemens TIA Openness User Group
Usage
Project configuration
The extension only writes project-scoped files in the first workspace folder. User-level files (for example the VS Code user mcp.json or claude_desktop_config.json) are never touched.
| Client | File in the workspace folder | Format and key |
|---|---|---|
| GitHub Copilot | .vscode\mcp.json |
JSON, servers |
| Anthropic Claude (Claude Code) | .mcp.json |
JSON, mcpServers |
| Cursor | .cursor\mcp.json |
JSON, mcpServers |
| OpenAI Codex | .codex\config.toml |
TOML, [mcp_servers.vscode-tiaportal-mcp] |
These are the clients that run in VS Code or a VS Code fork, where this extension can be installed: GitHub Copilot, the Claude Code extension, Cursor and the Codex IDE extension. Cursor installs extensions from Open VSX, so this extension has to be installed there from the .vsix file unless it is published on Open VSX.
Notes on single clients:
- Only GitHub Copilot expands
${workspaceFolder}. For GitHub Copilot the export path is written exactly as you enter it. For Anthropic Claude, Cursor and OpenAI Codex${workspaceFolder}is replaced by the absolute path of the workspace folder, because these clients pass it to the server unchanged. Relative and absolute paths are written as entered for all clients; prefer an absolute path, since a relative one depends on the working directory the client starts the server in. - When you run the command again, the arguments of the first existing entry are offered as defaults. If that is a non-Copilot file, the export path is already absolute.
- Claude Code asks for approval the first time it sees a project-scoped server. Codex only loads
.codex\config.tomlfor trusted projects.
Add server
- After installation restart VS Code.
- Run the command
TIA Portal: Add MCP Server Configurationand tick the clients (checkboxes) you want to configure, then pressEnter. The questions are asked once and the files of all ticked clients are written. - Before the list is shown, the extension looks at the config files of all clients. Clients that already contain the server entry are ticked and marked
(already configured)(inRemoveas well), and the arguments of the first entry found are the default answers of the questions, even if you tick a different client. A file that cannot be parsed is ignored at this point and reported when you select its client. - Arguments the existing entry does not have are taken from the
argssection (project,software-path,export-path) of<export path>/tia.json, if that file exists (tia initof the server writes it). It is looked up in the export path of the existing entry, otherwise in${workspaceFolder}\Project. A value of the existing entry always wins, and a file that is missing or invalid is ignored. - Answer the prompts (press
Escto cancel, nothing is written then). Values from an existing entry, or else fromtia.json, are offered as defaults:- TIA Portal major version (
--tia-major-version) - Project or session file (
--project-path) - PLC software path (
--software-path), e.g.PC-System_1/Software PLC_1 - Export path (
--export-path), default${workspaceFolder}\Project(kept for GitHub Copilot, resolved to the absolute folder for the other clients) - Preserve path structure (
--preserve-path) - Allow write access to the project (
--allow-write), defaultNo. The flag is only written if you answerYes.
- TIA Portal major version (
- Check the written file (GitHub Copilot example below). Other servers and settings in the file are kept.
<user>: Your Windows username<version>: The version of the extension you have installed.
The Anthropic Claude and Cursor entries look the same under{ "servers": { "vscode-tiaportal-mcp": { "type": "stdio", "command": "c:\\Users\\<user>\\.vscode\\extensions\\jheilingbrunner.vscode-tiaportal-mcp-<version>\\srv\\net48\\TiaMcpServer.exe", "args": [ "--tia-major-version", "21", "--project-path", "D:\\Siemens\\Projects\\MyProject\\MyProject.ap21", "--software-path", "PC-System_1/Software PLC_1", "--export-path", "${workspaceFolder}\\Project", "--preserve-path", "--allow-write" ], "env": {} } } }"mcpServers"(Cursor has no"type"field), but with an absolute--export-pathsuch as"E:\\Work\\MyWorkspace\\Project".
- Comments and trailing commas in the JSON files, and comments in
config.toml, are allowed and are kept when the entry is added, updated or removed. If a file is not valid JSON or TOML the command stops with an error instead of overwriting it.
Use the server
- GitHub Copilot: open GitHub Copilot, switch to
Agentmode, check the tools bySelect Toolsand start to chat with TIA Portal. - Anthropic Claude: start Claude Code in the workspace folder and approve the project-scoped server
vscode-tiaportal-mcpwhen asked (check with/mcp). - Other clients: open the workspace folder in the tool; see its own MCP documentation for listing and enabling servers.
Remove server
- Run the command
TIA Portal: Remove MCP Server Configurationand tick the clients (checkboxes) to remove the mcp server entry from their config files. The files of clients that are not ticked are not touched.
tia.json: the export formats of TIA Portal
TIA Portal exports each kind of object in the format set under Options > Settings > Version control interface >
Export formats: SIMATIC SD documents (.s7dcl, .s7res), SimaticML (.xml) or a source file. Openness cannot
read that setting (the settings tree it offers has no export formats), so the server keeps the formats in a plain,
visible file at the root of the export folder:
<exportPath>/tia.json
It is one file for all PLCs below <exportPath>, because the setting is global. It is meant to be kept and committed
together with the export, so everyone who works with the folder uses the same formats.
You normally do not write it. The first time a tool needs it and it does not exist, the server creates it with the defaults TIA Portal offers for a new workspace:
{
"version control interface": {
"code blocks-LAD": "SIMATIC SD(.s7dcl, .s7res)",
"code blocks-FBD": "SIMATIC SD(.s7dcl, .s7res)",
"code blocks-SCL": "SIMATIC SD(.s7dcl, .s7res)",
"code blocks-STL": ".awl",
"data blocks": "SIMATIC SD(.s7dcl, .s7res)",
"safety data blocks (F-DBs)": "SIMATIC SD(.s7dcl, .s7res)",
"PLC data types": "SIMATIC SD(.s7dcl, .s7res)",
"F-compliant PLC data types (UDT)": "SIMATIC SD(.s7dcl, .s7res)"
}
}
Available file formats per object type; the first one listed is the default of a new file:
| Key | Available formats |
|---|---|
code blocks-LAD |
SIMATIC SD(.s7dcl, .s7res), .xml |
code blocks-FBD |
SIMATIC SD(.s7dcl, .s7res), .xml |
code blocks-SCL |
SIMATIC SD(.s7dcl, .s7res), .scl, .xml |
code blocks-STL |
.awl, .xml |
data blocks |
SIMATIC SD(.s7dcl, .s7res), .db, .xml |
safety data blocks (F-DBs) |
SIMATIC SD(.s7dcl, .s7res), .xml |
PLC data types |
SIMATIC SD(.s7dcl, .s7res), .udt, .xml |
F-compliant PLC data types (UDT) |
SIMATIC SD(.s7dcl, .s7res), .xml |
License
MIT
