Content
# TIA Portal MCP Server
An MCP (Model Context Protocol) server that enables AI assistants to analyze Siemens TIA Portal industrial automation projects. Extract, search, and analyze PLC code, control logic, alarms, and safety systems.
## Features
- **Structured Export** - Export TIA Portal projects into organized, searchable file structures
- **Control Loop Analysis** - Analyze PID controllers, trace loops, identify cascade/feedforward configurations
- **Signal Flow Graphs** - Build dependency graphs, trace signal paths, detect feedback loops
- **Timer & Sequence Analysis** - Analyze timers, trace step sequences, identify watchdogs
- **Alarm Analysis** - Trigger conditions, cause-effect matrices, flooding risk detection
- **Safety Analysis** - Trip logic, interlock conditions, SIF identification
## Requirements
- Windows (TIA Portal requirement)
- Python 3.8+
- TIA Portal V13+ with Openness enabled
- NetworkX (for Logic Graph features)
## Installation
```bash
# Clone repository
git clone https://github.com/your-org/tia-portal-mcp.git
cd tia-portal-mcp
# Set up virtual environment
python -m venv .venv
.venv\Scripts\activate # Windows
# source .venv/bin/activate # Linux/Mac
# Install dependencies
pip install -r requirements.txt
# Register TIA Portal DLLs (Windows only)
register_tia_dlls.bat
# Start server
python server_structured.py
```
## Usage
### 1. Connect to TIA Portal
```
connect_to_tia()
open_project("C:/path/to/project.ap17")
```
### 2. Create Export
```
create_structured_export("my_analysis")
```
### 3. Analyze
```
# Build signal flow graph
build_logic_graph()
# Trace signal dependencies
analyze_signal_dependencies("PUMP_1.RUN")
# Analyze PID controller
analyze_pid_controller("FIC_101")
# Check safety interlocks
trace_interlock_conditions("V-101")
```
## Available Tools (36)
| Category | Tools |
|----------|-------|
| **Export** | `create_structured_export`, `load_structured_export`, `list_structured_exports` |
| **Search** | `search_export_equipment`, `get_export_structure`, `get_search_guide` |
| **Dataflow** | `trace_signal_dataflow`, `get_project_dataflow_statistics` |
| **Control** | `analyze_pid_controller`, `trace_control_loop`, `generate_pid_tuning_report`, `find_control_loop_interactions` |
| **Timer** | `analyze_timer_logic`, `trace_sequence_logic`, `find_watchdog_timers`, `analyze_pulse_generators` |
| **Alarm** | `analyze_alarm_triggers`, `generate_alarm_matrix`, `find_alarm_flooding_risks` |
| **Safety** | `analyze_trip_logic`, `trace_interlock_conditions`, `find_safety_functions`, `generate_interlock_matrix` |
| **Logic Graph** | `build_logic_graph`, `analyze_signal_dependencies`, `trace_logic_path`, `detect_logic_cycles`, `analyze_timing_paths` |
## Export Structure
```
export_name/
├── raw/ # Raw XML by PLC
│ └── PANEL_1/
│ ├── INTERLOCKS.xml
│ └── ALARMS.xml
├── parsed/ # Processed indices
│ ├── operands/
│ ├── equipment/
│ └── cross_references/
├── search/ # Search-optimized text files
└── metadata.json
```
## Compatible Clients
- Claude Code CLI
- Codex CLI
- Claude Agent SDK
- Any MCP-compatible AI client
## Safety
All TIA Portal operations are **read-only**. The server cannot modify projects.
## Documentation
- [ROADMAP.md](ROADMAP.md) - Development status and future plans
- [MCP_TOOLS.md](MCP_TOOLS.md) - Detailed tool reference
- [TROUBLESHOOTING.md](TROUBLESHOOTING.md) - Common issues
## License
MIT License - see [LICENSE](LICENSE)