TIA-Portal MCP-Server
A MCP server which connects to Siemens TIA Portal.
Resources
- TIA Portal Openness API Overview
- TIA Portal Openness API Documentation
- TIA Portal Openness API for automation of engineering workflows
- TIA Portal Openness API for automation of engineering workflows - Export/Import Documentation
Features
- Connect to a TIA Portal instance
- Browse and interact with TIA Portal projects
- Perform basic project operations from within VS Code
- Read the full PLC software: program blocks, PLC data types, tags and constants, watch and force tables, external source files, and cross references
- Optionally create, rename, delete, move and import project objects (see Write mode)
Command Line Arguments
| Argument | Description |
|---|---|
--tia-major-version <n> |
TIA Portal major version to bind against. Default 21. |
--project-path <file> |
Preset for the path argument of OpenProject / OpenTiaProject. See below. |
--software-path <path> |
Preset for the softwarePath tool argument, e.g. PLC_1. See below. |
--export-path <path> |
Preset for the exportPath tool argument. See below. |
--logging <1|2|3> |
1 stderr, 2 debug output, 3 Windows event log. Omit for no logging. |
--doctor |
Print the environment report and exit without starting the MCP server. |
--keep-structure |
Flag: preset for the keepStructure argument of TiaInit (written to tia.json). |
--with-dependencies |
Flag: preset for the withDependencies argument of GetSourceBlock and GetSourceType. |
--allow-write |
Register the project-mutating tools. Omitted by default; see below. |
--preserve-path |
Deprecated name of --keep-structure, still accepted; --doctor shows when it is used. |
--force-presets |
Deprecated, no effect: every preset is binding now. --doctor shows when it is used. |
Presetting tool arguments
softwarePath and exportPath appear in many tools, path (the project file) in
OpenProject and OpenTiaProject. Set them once in the args
of the MCP server entry in your client's JSON configuration and the model no longer has to pass them:
"args": ["--project-path", "D:\\Projects\\Plant\\Plant.ap21", "--software-path", "PLC_1", "--export-path", "D:\\Export"]
Which option becomes which argument (tools and prompts alike; a test checks this for every tool and prompt):
Option Argument Used by --project-pathpathOpenProject,OpenTiaProject,TiaConnect,TiaInit--software-pathsoftwarePathevery tool and prompt with a PLC software path --export-pathexportPathevery export / pull tool, GetExportFormats,TiaPush*,TiaInit--export-pathimportPathOverwritePlcProgram,ImportHardware,PreviewImport,ImportWatchTable--keep-structurekeepStructureTiaInit--with-dependencieswithDependenciesGetSourceBlock,GetSourceType--tia-major-version,--logging,--doctorand--allow-writeconfigure the server itself and are not tool arguments;--preserve-pathand--force-presetsare deprecated.Every preset is binding. A preset argument is removed from
tools/listand from the prompt arguments, and a call that still sends it is overwritten with the preset. The model can neither forget nor change what your configuration sets, so it cannot write into another folder (for example an invented staging folder next to the export folder) or open another project.OpenProjectcan only open the--project-pathproject.importPath(OverwritePlcProgram,ImportHardware,PreviewImport,ImportWatchTable) follows--export-path: a push reads the tree a pull wrote.Without a preset nothing changes: the argument stays required and the model supplies it.
GetStatelists the binding values inPresets(and the names inForcedPresets, kept for older clients).A single
--software-pathpins every call to that PLC, so it only fits a project with one PLC. For several PLCs leave--software-pathout and the model passessoftwarePathper call.--force-presets(earlier opt-in for exactly this) is deprecated and has no effect any more; it is still accepted so existing configurations keep working, and--doctorlists it as--force-presets (deprecated, ...) = used.exportPath/importPathis the base directory shared by all PLCs. Every export and folder-based import works below<exportPath>/<softwarePath>/, e.g.D:\Export\Group1\PLC_1\Program blocks\...,...\PLC data types\...,...\PLC tags\...and...\Watch and force tables\...(the folder names of the project tree in the interface language of TIA Portal); each/insoftwarePathis a folder level. Imports that take the full path of a single file are unaffected.Prompts (slash commands) use the presets too: an argument with a preset is not listed and is filled in. In a slash command, type only the arguments that are still listed.
This fixes the arguments you can configure, it is not a sandbox: the
filePath/sourcePathof the single-file tools,newProjectPathofSaveAsProjectand the names insideblockPathare not restricted.
Write mode
The server is read-only unless it is started with --allow-write.
- Without the flag the 51 project-mutating tools are not registered at all, so they never
appear in
tools/list. A model cannot call what it cannot see, and the tool list stays small. - With the flag they are registered and annotated
destructiveHint: true, so a client can still prompt before each call. GetStateand the--doctorreport both exposeAllowWrite, so a client can tell whether the tools are missing by configuration rather than by version.- Write operations change the project in memory only. Every write response says so and names
the tool that persists it:
SaveProject, orSaveSessionwhen a multiuser local session is open.
Export tools are intentionally not gated. ExportBlock, ExportTagTable, ExportWatchTable
and friends only write files on the machine running the server; they never modify the project.
They are annotated destructiveHint: true because they can overwrite files on disk.
To enable write mode, add the argument to your client configuration, for example
"args": ["--allow-write"].
Tools
Read-only tools (71) are always available.
| Area | Tools |
|---|---|
| Portal and state | GetPortals, Connect, Disconnect, GetState, Doctor |
| Project and session | GetProject, OpenProject, SaveProject, SaveAsProject, CloseProject |
| Devices | GetProjectTree, GetDevices, GetDeviceInfo, GetDeviceItemInfo |
| PLC software | GetSoftwareInfo, GetSoftwareTree, CompilePlcSoftware, CompileCodeBlock, ExportOpcUaXml |
| Blocks | GetBlocks, GetBlockInfo, GetBlocksWithHierarchy, ExportBlock (one block), ExportBlocks (by regex); format from tia.json |
| Types | GetTypes, GetTypeInfo, ExportType (one type), ExportTypes (by regex); format from tia.json |
| Tags and constants | GetTagTables, GetTagTableInfo, GetTags, GetTagInfo, GetConstants, ExportTagTable (one table), ExportTagTables (by regex); always XML |
| Watch and force tables | GetWatchTables, GetWatchTableInfo, GetForceTables, ExportWatchTable (one table), ExportWatchTables (by regex), ExportForceTable; always XML |
| External sources | GetExternalSources, GetExternalSourceInfo |
| Read source inline | GetXmlBlock, GetXmlType, GetSourceBlock, GetSourceType, GetDocumentsBlock, GetDocumentsType |
| Cross references | GetCrossReferences |
| Libraries | GetOpenLibraries, GetReferencedLibraries |
| Multiuser | GetMarkedObjects, CheckIsUpToDate |
| Understand and read (comfort) | GetPlcSummary, ResolveObjectPath, WhereUsed, FindInCode, GetBlockInterface, PreviewImport, OpenTiaProject |
| Whole PLC program | ExportPlcProgram (format per object type from tia.json, see below), GetExportFormats |
| Git-like connect and pull | TiaInit, TiaConnect, TiaPull, TiaPullBlocks, TiaPullTypes, TiaPullTagTables, TiaPullBlock, TiaPullType, TiaPullTagTable, TiaPullWatchTables, TiaPullWatchTable, TiaPullForceTable (see "tia porcelain commands" below) |
Write tools (40) require --allow-write.
| Area | Tools |
|---|---|
| Block and type groups | CreateBlockGroup, DeleteBlockGroup, CreateTypeGroup, DeleteTypeGroup |
| Blocks and types | DeleteBlock, RenameBlock, DeleteType, RenameType, CreateFB, CreateInstanceDB |
| Copy and move | CopyBlock, MoveBlock, CopyType, MoveType |
| Tag tables | CreateTagTable, DeleteTagTable, RenameTagTable, CreateTagTableGroup, DeleteTagTableGroup |
| Tags and constants | CreateTag, UpdateTag, DeleteTag, CreateUserConstant, UpdateUserConstant, DeleteUserConstant |
| Watch tables | CreateWatchTable, RenameWatchTable, DeleteWatchTable, CreateWatchTableGroup, DeleteWatchTableGroup, ImportWatchTable |
| External sources | CreateExternalSourceFromFile, DeleteExternalSource, CreateExternalSourceGroup, DeleteExternalSourceGroup |
| Whole PLC program | OverwritePlcProgram, ImportPlcProgramChanges (sources, XML and SIMATIC SD documents, preview by default, see below) |
| Git-like push | TiaPush, TiaPushPreview (see "tia porcelain commands" below) |
| Hardware (AML) | ExportHardware, TiaPullHardware; with --allow-write also ImportHardware, TiaPushHardware |
| Multiuser | CommitChanges (commits the local session to the server and closes the session) |
GetSoftwareTree accepts a sections argument - any comma separated subset of
blocks,types,tags,watch,sources, default all - to keep the output small on a large PLC.
GetCrossReferences accepts maxDepth (1-3, default 1) for the same reason.
Paths used by these tools are root-relative: 1_Tests/FC_Block_1, not
Program blocks/1_Tests/FC_Block_1. Use GetProjectTree and GetSoftwareTree to discover them.
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. tia init sets it up (see "tia porcelain commands"). 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:
{
"args": {
...
},
"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",
"code-blocks-LAD-STL": ".xml",
"code-blocks-GRAPH": ".xml",
"data-blocks": "SIMATIC SD(.s7dcl, .s7res)",
"safety-data-blocks-F-DBs": "SIMATIC SD(.s7dcl, .s7res)",
"plc-data-types": "SIMATIC SD(.s7dcl, .s7res)",
"plc-tables": ".xml",
"f-compliant-plc-data-types-UDT": "SIMATIC SD(.s7dcl, .s7res)",
"technology-objects": ".xml"
}
}
The file can also carry an optional args section for other programs that work with the same TIA Portal project.
Its keys follow the server arguments --project-path, --software-path, --export-path and --keep-structure
("keep-structure": "true" and "with-ui": "true" are written only when checked; tia init renames an
old "preserve-path" key to "keep-structure", "with-user-interface" to "with-ui" and "project" to "project-path", and keeps their values). The server does not
read it; only tia init writes it (the automatic creation does not) and every tool keeps it as it is:
{
"args": {
"project-path": "C:\\Projects\\Plant\\Plant.ap21",
"software-path": "PLC_1",
"export-path": "C:\\Projects\\Plant\\export"
},
"version-control-interface": {
"code-blocks-LAD": "SIMATIC SD(.s7dcl, .s7res)"
}
}
All keys use hyphens instead of spaces. A file with the old spaced keys (version control interface,
code blocks-LAD, ...) is not read any more: rename the keys.
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 |
code-blocks-LAD-STL |
.xml |
code-blocks-GRAPH |
.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 |
plc-tables |
.xml |
f-compliant-plc-data-types-UDT |
SIMATIC SD(.s7dcl, .s7res), .xml |
technology-objects |
.xml |
Fixed format. code-blocks-GRAPH, plc-tables and technology-objects offer only .xml, so their export file
format is fixed. code-blocks-GRAPH is read (a missing key also exports .xml), while plc-tables and
technology-objects are listed only so the file names every object type; no tool reads them.
Check a created file. The server cannot see your TIA Portal settings, so the defaults may differ from yours. The
response of ExportPlcProgram (Notes and the message) and of GetExportFormats (Created, Hint) says when the
file was just created and asks you to compare it with the dialog above. Correct it by hand if it differs. The file
only tells the server what to write; it does not change the setting in TIA Portal. An existing file is never
overwritten.
Each key names an object type, the value is the text TIA Portal shows for it:
| Value | Written as | Fits |
|---|---|---|
SIMATIC SD(.s7dcl, .s7res) |
documents, .s7dcl and .s7res (blocks V20+, types V21+) |
every block and PLC data type except STL blocks |
.xml |
SimaticML, .xml |
every block and PLC data type |
.awl, .scl, .db, .udt |
external source, the same extension | STL, SCL, data blocks, PLC data types (not LAD, FBD) |
| Key | Controls |
|---|---|
code-blocks-LAD, -FBD, -SCL, -STL |
blocks of that language |
data-blocks |
data blocks |
plc-data-types |
PLC data types |
safety-data-blocks-F-DBs, f-compliant-plc-data-types-UDT |
listed as TIA Portal shows them; not read separately yet |
Rules:
- Keys and values are not case sensitive. Other keys are kept and shown but have no effect, so a longer file from a copy does not break anything.
- If the file has no entry for an object type that occurs in the PLC, holds a value that is not one of the formats
above, or is not valid JSON,
ExportPlcProgramfails before it writes anything and names the file and the key. - A LAD or FBD block that contains STL networks cannot be written as SIMATIC SD: TIA Portal refuses it with "Blocks with
the programming language STL cannot be exported ... to SIMATIC SD". The server tries the format of
code-blocks-LAD/code-blocks-FBDfirst and, when TIA Portal refuses it for that reason, usescode-blocks-LAD-STL(.xml; a file without the key behaves the same) and names the block inNotes. Any other value of that key makes such a block fail with a row that names the key. Other SIMATIC SD errors stay inFailed. - GRAPH blocks use
code-blocks-GRAPH; a file written before that key existed exports them as.xml, andtia initadds the key. A block of any other language without an entry is skipped and listed inSkipped. A source format for a block that has no source form (LAD as.awl) is skipped with a reason.
Who reads it: ExportPlcProgram decides the format of every object from it. GetExportFormats(exportPath) shows what
the file says and which export tool writes each object type. ExportBlock, ExportBlocks, ExportType and
ExportTypes read it too, so one tool per object kind writes every format. ExportTagTable, ExportTagTables, ExportWatchTable, ExportWatchTables and ExportForceTable do not,
because tag, watch and force tables are always XML. tia.json lists plc-tables and technology-objects (.xml) so the file names every object type, but no tool reads them: tag tables are always XML and there is no export tool for technology objects; a file without them behaves the same. The import tools do not read it.
Whole PLC program: ExportPlcProgram, OverwritePlcProgram and ImportPlcProgramChanges
These tools move all blocks and PLC data types of a PLC software in one call. ExportPlcProgram writes each
object in the format that tia.json gives for its object type; the file
is created with defaults when it is missing, so check it.
SIMATIC SD documents need a project that is prepared for that format: TIA Portal refuses an object with "needs
preparation for the format of Simatic SD" until you select it and run Tools > Prepare for Simatic SD. Openness
has no call for that step, so ExportPlcProgram cannot do it. Such an object is listed in Failures with the
message of TIA Portal, and the export goes on with the others; an export that finished with warnings is named in
Notes.
Blocks of a language that has no entry in the settings are skipped and listed in Skipped; read them with GetXmlBlock. OverwritePlcProgram and ImportPlcProgramChanges still import only sources and
XML, so the files of a SIMATIC SD folder are not imported by them.
- Layout:
<exportPath>/<softwarePath>/Program blocks/<groups>/and.../PLC data types/<groups>/, one file per object, always mirroring the project groups.ExportBlocks,ExportTypesandExportTagTableswrite slices of this tree,ExportBlock,ExportTypeandExportTagTablesingle objects of it. ExportPlcProgram(softwarePath, exportPath)only writes files.OverwritePlcProgram(softwarePath, importPath, regexName, keepOnError, dryRun)changes the project and needs--allow-write. Blocks and types of the same name in the open project are replaced by the file content. The tool description tells the agent so.- Prefer
ImportPlcProgramChangesfor edited files; useOverwritePlcProgramonly to replace the whole tree (first import, restore, a folder without git). The name and the description of the whole-tree tool say so, so an agent does not pick it for a vague "import" request. - Both tools preview by default (the parameter
dryRunistrue): nothing is imported, andPlannedlists every object withcreateoroverwrite(the action is derived from the file name). The tool descriptions and prompts tell the agent to show that list to you. Exception: for a plain import request theImportPlcProgramChangesprompt and description tell the agent to call it withdryRun=falseright away, because the dialog below is the preview and the confirmation in one; it lists every file to import. - A real run (
dryRun=false) is confirmed by you, through the server: it shows a confirmation dialog in the client (MCP elicitation) listing what would be imported and how many objects are overwritten, and imports only when you tick the "Yes, import" checkbox and submit. The agent cannot answer it for you, and submitting without the tick, declining or cancelling imports nothing. A client without elicitation support is refused with a message saying so; it can still run the preview. - Saving is not guarded by the server: the agent is told to call
SaveProject(SaveSessionin a local session) only after you say "save project", which depends on the agent following that instruction. Clients can still prompt before every call, because the tools carrydestructiveHint. - Import puts each file into the group its folder implies; the group must already exist. An
.xmlfile counts only below theProgram blocksfolder. ImportPlcProgramChanges(softwarePath, exportPath, regexName, keepOnError, dryRun)takes only the files git reports as changed since the last commit below<exportPath>/<softwarePath>/: modified, staged and new files. Deleted files cannot be imported and are listed inDeleted; files with an open merge conflict go toIgnored. It needs git onPATHand an export folder inside a git repository, and takes the--export-pathand--software-pathpresets. Suggested flow:ExportPlcProgram, commit the export as baseline, edit files,ImportPlcProgramChanges(the dialog lists the files; tick "Yes, import" and submit),SaveProject, commit.- Objects may need each other across the two formats (a LAD block calling an SCL block, an instance data block of
a LAD function block). Import therefore works in rounds: it retries what failed as long as the last round
imported something. The response reports
Rounds, and what never succeeded inFailureswith its last error. - To export only some objects use
ExportBlocks,ExportTypesorExportTagTables(optional regular expression), orExportBlock,ExportTypeorExportTagTablefor exactly one object. There are no per-format export or import tools any more; the format is the one intia.json. softwarePathandexportPathtake the presets from--software-pathand--export-pathlike every other export.
tia porcelain commands: connect, pull and push
Short tools for the chat that work like the git commands they are named after. They sit on top of the tools above:
connect attaches to TIA Portal and opens the project, pull brings TIA Portal into the export folder, push
brings the changed files of that folder into TIA Portal.
Type the command in the chat, e.g. tia pull blocks ".+HMI", or pick the tool or the prompt of the same name.
| You say | Tool | Same as |
|---|---|---|
tia init |
TiaInit |
sets up <exportPath>/tia.json |
tia connect <project> |
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 |
tia pull hardware |
TiaPullHardware |
ExportHardware (device of the PLC as Hardware/<device>.aml) |
tia push hardware |
TiaPushHardware |
ImportHardware with dryRun=false (--allow-write, confirmation dialog) |
TiaInitsets uptia.json: it opens a dialog in which you check or enter theargs(project-path,software-path,export-path,keep-structure,with-ui), starting with the values of the call or of the--project-path,--software-path,--export-pathand--keep-structurepresets (the old parameter namepreservePathstill works), and writes the file into the export path. A missing file is created with the export formats TIA Portal offers for a new workspace; an existing file is only completed (missing keys are added) and never overwritten, so a value you wrote is kept. Cancel the dialog and nothing is written. A client without dialogs uses the arguments and presets as they are. It does not touch the project and needs no--allow-write. Check the export formats against the dialog of TIA Portal afterwards.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.
Example Prompts using natural language
Example prompts using natural language with preset parameters in json config file.
{
"servers": {
"tia-mcp-server": {
"type": "stdio",
"command": "E:\\Labor\\GitHub\\tiaportal-mcp\\src\\TiaMcpServer\\bin\\Debug\\net48\\TiaMcpServer.exe",
"args": [
"--tia-major-version", "21",
"--project-path", "<path-to-project>\\<project-name>.(ap21|als21)",
"--software-path", "<software-path>",
"--export-path", "${workspaceFolder}\\export",
"--allow-write"
],
"env": {}
}
}
}
Prompts:
- 'open tia project'
- 'export all types to sources'
- 'export all blocks as sources'
- 'export blocks as sources, which match regex name pattern ".+HMI_.+"'
- 'export all tags'
- 'import modified type sources'
- 'get project tree and save output to project-tree.txt'
- 'get software tree and save output to software-tree.txt'
- 'export watch tables'
- 'export force tables'
- 'export opc ua'
- 'save project'
- 'compile project'
- 'close project'
- 'show doctor diagnostics for tia'
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 init'
- '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'
Prompts using slash commands
Every tool has a prompt of the same name that you can start as a slash command, for example
/mcp__tia-mcp-server__OpenProject D:\Siemens\Test\TestProject1_V21.ap21. The part after mcp__ is
the server name from your MCP configuration. Claude Code shows the prompt description and the
argument names, matches the typed values to the arguments by position and requires every argument
without a default. A prompt only sends text to the model, which then calls the tool.
A value with spaces goes in double quotes, for example a PC based PLC software or an export folder:
/mcp__tia-mcp-server__ExportBlocks "PC-System_1/Software PLC_1" "D:\My Export"
Claude Code itself splits the text at every space and drops the words beyond the last argument. The
server joins the pieces of a quoted value again, so the value reaches the tool unchanged; ""
passes an empty value. All typed words together must not exceed the number of arguments of the
prompt, so a prompt with few arguments (for example GetSoftwareInfo, which only has
softwarePath) cannot take a value of several words: write a normal request instead of the slash
command.
Requirements
- .net Framework 4.8 installed
- Siemens TIA Portal V21 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 V21 - User must be in Windows User Group
Siemens TIA Openness
Diagnose the environment
Run the server with --doctor to check all of the above without starting the MCP server:
> TiaMcpServer.exe --doctor
Diagnose:
├─ Connected = False
├─ Project: No project open
├─ Active Version: V21
├─ Installed TIA Portal versions:
│ └─ V21: C:\Program Files\Siemens\Automation\Portal V21
│ ├─ Engineering: OK
│ └─ Portal: OK
├─ User in 'Siemens TIA Openness' user group: True
└─ Write mode (--allow-write): disabled, read-only tools only
The report ends with the command line options and their values. The deprecated --preserve-path is listed as
--preserve-path (deprecated, use --keep-structure) = used when a configuration still passes it (otherwise not used),
so you know which configurations to update.
The same report is available to MCP clients through the Doctor tool, which additionally returns
the findings as structured content. Both are read-only: they never connect to TIA Portal, open a
project, or change user group membership.
TIA-Portal Versions
- V21 is the default version.
- Previous versions are also supported, but must use the
--tia-major-versionargument to specify the version. - SIMATIC SD documents (.s7dcl/.s7res), the format
tia.jsonselects for an object type, need TIA Portal V20 or newer for blocks (ExportBlock,ExportBlocks,ExportPlcProgram). - The same for PLC data types -
ExportType,ExportTypes- requires TIA Portal V21 or newer: Openness only addedPlcType.ExportAsDocumentsandPlcTypeComposition.ImportFromDocumentsin V21.
SIMATIC Source Documents
A source document is the readable, git-diffable form of an object: <Name>.s7dcl holds the
declaration and body as SCL/LAD/STL text, the optional <Name>.s7res holds comments and
language resources. Every other export in this server writes SimaticML XML instead, which
diffs poorly.
The file names come from TIA Portal, not from this server: an export response lists the files that were actually written, and a batch import discovers a document set by base name rather than assuming one extension. Tag tables and watch tables have no document API in Openness V21 and remain XML-only.
The export mirrors the project tree below the system folder - Program blocks for blocks, PLC data types for types - using the folder name as TIA Portal reports it
in the current interface language. OverwritePlcProgram and ImportPlcProgramChanges read
that tree back, so an export can be fed straight back in.
A PLC data type name is unique across the whole PLC, not just within its group. Importing a
name that already exists into a different group therefore fails with "an object with the name
... already exists in the plc", even with importOption: Override; point groupPath at the
group the type already lives in to replace it.