# power-agent/powermcp architecture

> Architecture diagram of the GitHub repository power-agent/powermcp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-05-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/power-agent/powermcp
- Repository: https://github.com/power-agent/powermcp

## Overview

1. **Repository role**
   - PowerMCP is a **multi-package monorepo** of Python-based **Model Context Protocol (MCP) servers** for power-system tools. Each subdirectory is a mostly independent adapter that exposes a specific simulator or analysis tool to an LLM host through MCP.

2. **Top-level architecture**
   - The repo is organized by target platform: `ANDES`, `Egret`, `LTSpice`, `OpenDSS`, `PSCAD`, `PSLF`, `PSSE`, `PowerFactory`, `PowerWorld`, `PyPSA`, `pandapower`, `surge`, plus `HOPE`.
   - Most directories contain a single MCP entrypoint script, local requirements, and a few sample cases/data files. This strongly suggests a **plugin/federated architecture** rather than one central server.

3. **Common integration pattern**
   - Each adapter follows the same boundary: **LLM host → MCP server process → simulator/runtime API or local model files**.
   - The MCP server is the orchestration layer; the underlying power tool is the execution engine. The repo’s architecture is therefore centered on **tool wrapping**, not on a shared application backend.

4. **OpenDSS subsystem**
   - `OpenDSS/` is one of the richer implementations, with a clearer internal split:
     - `opendss_mcp.py` as the server entrypoint.
     - `core/` for engine/state/server abstractions.
     - `opendss_tools/` for domain functions such as configuration, simulation, results, model handling, and interactive visualization.
     - `utils/responses.py` for consistent outputs.
   - The presence of `13Bus/` sample feeder files shows OpenDSS is designed to operate on **local circuit models** and produce simulation results/interactive views.

5. **PSCAD subsystem**
   - `PSCAD/pscad_mcp/` is structured as a more modular MCP app:
     - `core/connection_manager.py` and `core/executor.py` manage connection and execution boundaries.
     - `tools/` is split by concern: app-level operations, project operations, simulation settings, and data handling.
     - `utils/doc_manager.py` implies generated or curated documentation is part of the tool interface.
   - This looks like a **stateful desktop-app automation bridge**, likely interacting with PSCAD through an external connection layer.

6. **HOPE subsystem**
   - `HOPE/src/hope_mcp_server/` is a self-contained Python package with `core.py`, `server.py`, `chatgpt.py`, and `__main__.py`.
   - It includes tests in `HOPE/tests/`, indicating HOPE is the most “library-like” package here and may be a reusable MCP server implementation rather than a vendor wrapper.

7. **PSSE subsystem**
   - `PSSE/` is dominated by `psspy_command_json/`, a large catalog of JSON files representing PSSE `psspy` command definitions and metadata.
   - `psse_mcp.py` likely turns that command catalog into MCP tools.
   - This creates a **metadata-driven adapter**: instead of hardcoding every action, the server appears to derive tool behavior from the command JSON inventory.

8. **Other tool adapters**
   - Several directories are thin wrappers around a simulator or analysis library:
     - `PowerWorld/powerworld_mcp.py`
     - `pandapower/panda_mcp.py`
     - `PyPSA/pypsa_mcp.py`
     - `LTSpice/ltspice_mcp.py`
     - `Egret/egret_mcp.py`
     - `ANDES/andes_mcp.py`
     - `surge/surge_mcp.py`
   - These are likely independent MCP endpoints with their own local dependencies and sample cases, optimized for one tool each.

9. **Data and model assets**
   - The repo includes numerous sample cases and input artifacts: `.sav`, `.raw`, `.dss`, `.pwb`, `.pfd`, `.json`, `.m`, `.csv`, `.otg`, `.dyr`, etc.
   - These files are not just examples; they are part of the architecture because they define the **simulation inputs** consumed by the MCP tools.

10. **Testing boundary**
   - Tests are localized to specific packages, especially `HOPE/tests/` and `PSCAD/tests/`, with a few integration files like `surge/test_integration.py`.
   - This suggests validation happens **per adapter**, not through a unified cross-package test harness.

11. **Packaging and runtime**
   - The repo mixes `requirements.txt`, `pyproject.toml`, and `uv.lock`, showing a heterogeneous but Python-centric runtime strategy.
   - The root README specifies **Python 3.10+** and MCP-based integration with hosts such as Claude Desktop or Cursor.

12. **External/system boundary**
   - The key architectural boundary is between the MCP server process and the actual power software:
     - Some adapters likely invoke Python libraries directly.
     - Others likely automate desktop or COM-based tools such as PSCAD, PowerFactory, or PSSE.
   - From an architecture diagram perspective, each subproject should be drawn as an **independent MCP bridge** to a different external power-system engine, with no shared runtime backend in the repo.

13. **What to diagram**
   - A good diagram would show:
     - LLM host(s) at the top.
     - One MCP server per tool/package.
     - Per-server local code and assets.
     - Downstream simulator/library/desktop application at the bottom.
   - The repo is best understood as a **collection of adapters and examples**, not as a single monolithic application.

Main entry points: [`OpenDSS/opendss_mcp.py`](https://github.com/power-agent/powermcp/blob/main/OpenDSS/opendss_mcp.py) (OpenDSS MCP), [`PSCAD/pscad_mcp/main.py`](https://github.com/power-agent/powermcp/blob/main/PSCAD/pscad_mcp/main.py) (PSCAD MCP), [`PSSE/psse_mcp.py`](https://github.com/power-agent/powermcp/blob/main/PSSE/psse_mcp.py) (PSSE MCP), [`ANDES/andes_mcp.py`](https://github.com/power-agent/powermcp/blob/main/ANDES/andes_mcp.py) (ANDES MCP)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_host["LLM Hosts"]
  node_llm_host(("LLM host<br/>MCP client"))
end

subgraph group_adapters["Tool Adapters"]
  node_andes_server["ANDES MCP<br/>adapter<br/>[andes_mcp.py]"]
  node_egret_server["Egret MCP<br/>adapter<br/>[egret_mcp.py]"]
  node_ltspice_server["LTSpice MCP<br/>adapter<br/>[ltspice_mcp.py]"]
  node_powerworld_server["PowerWorld MCP<br/>adapter<br/>[powerworld_mcp.py]"]
  node_pypsa_server["PyPSA MCP<br/>adapter<br/>[pypsa_mcp.py]"]
  node_pandapower_server["pandapower MCP<br/>adapter<br/>[panda_mcp.py]"]
  node_surge_server["surge MCP<br/>adapter<br/>[surge_mcp.py]"]
  node_pslf_server["PSLF MCP<br/>adapter<br/>[pslf_mcp.py]"]
  node_hope_pkg["HOPE server"]
  node_opendss_entry["OpenDSS MCP<br/>adapter<br/>[opendss_mcp.py]"]
  node_opendss_core["OpenDSS core<br/>runtime core"]
  node_opendss_tools["DSS tools<br/>domain tools"]
  node_pscad_main["PSCAD MCP<br/>desktop bridge<br/>[main.py]"]
  node_pscad_core["PSCAD core<br/>session core"]
  node_pscad_tools["PSCAD tools<br/>operations layer"]
  node_psse_server["PSSE MCP<br/>metadata adapter<br/>[psse_mcp.py]"]
end

subgraph group_assets["Local Assets"]
  node_psse_catalog["psspy catalog<br/>command metadata"]
  node_sample_models["Sample cases<br/>input assets"]
end

subgraph group_engines["External Engines"]
  node_powerflow_engine[("Power tools<br/>external simulator/library")]
  node_opendss_runtime[("OpenDSS runtime<br/>external engine")]
  node_pscad_runtime[("PSCAD app<br/>external desktop app")]
  node_psse_runtime[("PSSE runtime<br/>external engine")]
end

node_llm_host -->|"MCP calls"| node_andes_server
node_llm_host -->|"MCP calls"| node_egret_server
node_llm_host -->|"MCP calls"| node_ltspice_server
node_llm_host -->|"MCP calls"| node_powerworld_server
node_llm_host -->|"MCP calls"| node_pypsa_server
node_llm_host -->|"MCP calls"| node_pandapower_server
node_llm_host -->|"MCP calls"| node_surge_server
node_llm_host -->|"MCP calls"| node_pslf_server
node_llm_host -->|"MCP calls"| node_hope_pkg
node_llm_host -->|"MCP calls"| node_opendss_entry
node_llm_host -->|"MCP calls"| node_pscad_main
node_llm_host -->|"MCP calls"| node_psse_server
node_opendss_entry -->|"uses"| node_opendss_core
node_opendss_entry -->|"exposes"| node_opendss_tools
node_opendss_entry -->|"loads"| node_sample_models
node_opendss_core -->|"drives"| node_opendss_runtime
node_opendss_tools -->|"reads"| node_sample_models
node_pscad_main -->|"uses"| node_pscad_core
node_pscad_main -->|"exposes"| node_pscad_tools
node_pscad_core -->|"controls"| node_pscad_runtime
node_pscad_tools -->|"operates"| node_pscad_runtime
node_psse_server -->|"derives tools from"| node_psse_catalog
node_psse_server -->|"executes on"| node_psse_runtime
node_andes_server -->|"wraps"| node_powerflow_engine
node_egret_server -->|"wraps"| node_powerflow_engine
node_ltspice_server -->|"wraps"| node_powerflow_engine
node_powerworld_server -->|"wraps"| node_powerflow_engine
node_pypsa_server -->|"wraps"| node_powerflow_engine
node_pandapower_server -->|"wraps"| node_powerflow_engine
node_surge_server -->|"wraps"| node_powerflow_engine
node_pslf_server -->|"wraps"| node_powerflow_engine
node_hope_pkg -->|"bridges"| node_powerflow_engine

click node_andes_server "https://github.com/power-agent/powermcp/blob/main/ANDES/andes_mcp.py"
click node_egret_server "https://github.com/power-agent/powermcp/blob/main/Egret/egret_mcp.py"
click node_ltspice_server "https://github.com/power-agent/powermcp/blob/main/LTSpice/ltspice_mcp.py"
click node_powerworld_server "https://github.com/power-agent/powermcp/blob/main/PowerWorld/powerworld_mcp.py"
click node_pypsa_server "https://github.com/power-agent/powermcp/blob/main/PyPSA/pypsa_mcp.py"
click node_pandapower_server "https://github.com/power-agent/powermcp/blob/main/pandapower/panda_mcp.py"
click node_surge_server "https://github.com/power-agent/powermcp/blob/main/surge/surge_mcp.py"
click node_pslf_server "https://github.com/power-agent/powermcp/blob/main/PSLF/pslf_mcp.py"
click node_hope_pkg "https://github.com/power-agent/powermcp/tree/main/HOPE/src/hope_mcp_server"
click node_opendss_entry "https://github.com/power-agent/powermcp/blob/main/OpenDSS/opendss_mcp.py"
click node_opendss_core "https://github.com/power-agent/powermcp/tree/main/OpenDSS/core"
click node_opendss_tools "https://github.com/power-agent/powermcp/tree/main/OpenDSS/opendss_tools"
click node_pscad_main "https://github.com/power-agent/powermcp/blob/main/PSCAD/pscad_mcp/main.py"
click node_pscad_core "https://github.com/power-agent/powermcp/tree/main/PSCAD/pscad_mcp/core"
click node_pscad_tools "https://github.com/power-agent/powermcp/tree/main/PSCAD/pscad_mcp/tools"
click node_psse_server "https://github.com/power-agent/powermcp/blob/main/PSSE/psse_mcp.py"
click node_psse_catalog "https://github.com/power-agent/powermcp/tree/main/PSSE/psspy_command_json"
click node_sample_models "https://github.com/power-agent/powermcp/tree/main/OpenDSS/13Bus"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_llm_host toneBlue
class node_andes_server,node_egret_server,node_ltspice_server,node_powerworld_server,node_pypsa_server,node_pandapower_server,node_surge_server,node_pslf_server,node_hope_pkg,node_opendss_entry,node_opendss_core,node_opendss_tools,node_pscad_main,node_pscad_core,node_pscad_tools,node_psse_server toneAmber
class node_psse_catalog,node_sample_models toneMint
class node_powerflow_engine,node_opendss_runtime,node_pscad_runtime,node_psse_runtime toneRose
```

## Components

### LLM Hosts

Model-context protocol clients that launch and talk to the adapters

- **LLM host**: MCP client · Desktop or API host that connects to the server processes

### Tool Adapters

Independent MCP server packages, one per simulator or analysis tool

- [ANDES MCP](https://github.com/power-agent/powermcp/blob/main/ANDES/andes_mcp.py): adapter · Thin MCP wrapper around ANDES · `ANDES/andes_mcp.py`
- [Egret MCP](https://github.com/power-agent/powermcp/blob/main/Egret/egret_mcp.py): adapter · Thin MCP wrapper around Egret · `Egret/egret_mcp.py`
- [LTSpice MCP](https://github.com/power-agent/powermcp/blob/main/LTSpice/ltspice_mcp.py): adapter · Thin MCP wrapper around LTSpice · `LTSpice/ltspice_mcp.py`
- [PowerWorld MCP](https://github.com/power-agent/powermcp/blob/main/PowerWorld/powerworld_mcp.py): adapter · Thin MCP wrapper around PowerWorld · `PowerWorld/powerworld_mcp.py`
- [PyPSA MCP](https://github.com/power-agent/powermcp/blob/main/PyPSA/pypsa_mcp.py): adapter · Thin MCP wrapper around PyPSA · `PyPSA/pypsa_mcp.py`
- [pandapower MCP](https://github.com/power-agent/powermcp/blob/main/pandapower/panda_mcp.py): adapter · Thin MCP wrapper around pandapower · `pandapower/panda_mcp.py`
- [surge MCP](https://github.com/power-agent/powermcp/blob/main/surge/surge_mcp.py): adapter · Thin MCP wrapper around surge · `surge/surge_mcp.py`
- [PSLF MCP](https://github.com/power-agent/powermcp/blob/main/PSLF/pslf_mcp.py): adapter · Thin MCP wrapper around PSLF · `PSLF/pslf_mcp.py`
- [HOPE server](https://github.com/power-agent/powermcp/tree/main/HOPE/src/hope_mcp_server): package · Reusable MCP server package with entrypoint and tests · `HOPE/src/hope_mcp_server`
- [OpenDSS MCP](https://github.com/power-agent/powermcp/blob/main/OpenDSS/opendss_mcp.py): adapter · Entry script for the OpenDSS MCP bridge · `OpenDSS/opendss_mcp.py`
- [OpenDSS core](https://github.com/power-agent/powermcp/tree/main/OpenDSS/core): runtime core · Engine, state, and server abstractions · `OpenDSS/core`
- [DSS tools](https://github.com/power-agent/powermcp/tree/main/OpenDSS/opendss_tools): domain tools · Configuration, simulation, results, model handling, and interactive view helpers · `OpenDSS/opendss_tools`
- [PSCAD MCP](https://github.com/power-agent/powermcp/blob/main/PSCAD/pscad_mcp/main.py): desktop bridge · MCP application for automating PSCAD workflows · `PSCAD/pscad_mcp/main.py`
- [PSCAD core](https://github.com/power-agent/powermcp/tree/main/PSCAD/pscad_mcp/core): session core · Connection and execution boundaries for the bridge · `PSCAD/pscad_mcp/core`
- [PSCAD tools](https://github.com/power-agent/powermcp/tree/main/PSCAD/pscad_mcp/tools): operations layer · App, project, simulation, and data operations exposed as tools · `PSCAD/pscad_mcp/tools`
- [PSSE MCP](https://github.com/power-agent/powermcp/blob/main/PSSE/psse_mcp.py): metadata adapter · Adapter that turns the PSSE command catalog into MCP tools · `PSSE/psse_mcp.py`

### Local Assets

Sample cases, model files, and command metadata consumed by the adapters

- [psspy catalog](https://github.com/power-agent/powermcp/tree/main/PSSE/psspy_command_json): command metadata · Large JSON inventory of PSSE command definitions and metadata · `PSSE/psspy_command_json`
- [Sample cases](https://github.com/power-agent/powermcp/tree/main/OpenDSS/13Bus): input assets · Representative feeder, case, and study files used by multiple adapters · `OpenDSS/13Bus`

### External Engines

Underlying simulators, analysis libraries, or desktop applications behind the MCP boundary

- **Power tools**: external simulator/library · Underlying engines such as ANDES, Egret, PyPSA, pandapower, LTSpice, PowerWorld, PSLF, and surge
- **OpenDSS runtime**: external engine · Circuit solver and local model runtime behind the OpenDSS bridge
- **PSCAD app**: external desktop app · External desktop application controlled through the PSCAD bridge
- **PSSE runtime**: external engine · PSSE engine invoked through the command metadata adapter

## Connections

- LLM host → ANDES MCP: MCP calls · Host launches and talks to the ANDES bridge
- LLM host → Egret MCP: MCP calls · Host launches and talks to the Egret bridge
- LLM host → LTSpice MCP: MCP calls · Host launches and talks to the LTSpice bridge
- LLM host → PowerWorld MCP: MCP calls · Host launches and talks to the PowerWorld bridge
- LLM host → PyPSA MCP: MCP calls · Host launches and talks to the PyPSA bridge
- LLM host → pandapower MCP: MCP calls · Host launches and talks to the pandapower bridge
- LLM host → surge MCP: MCP calls · Host launches and talks to the surge bridge
- LLM host → PSLF MCP: MCP calls · Host launches and talks to the PSLF bridge
- LLM host → HOPE server: MCP calls · Host launches and talks to the HOPE server package
- LLM host → OpenDSS MCP: MCP calls · Host launches and talks to the OpenDSS bridge
- LLM host → PSCAD MCP: MCP calls · Host launches and talks to the PSCAD bridge
- LLM host → PSSE MCP: MCP calls · Host launches and talks to the PSSE bridge
- OpenDSS MCP → OpenDSS core: uses · Entry script delegates server and engine orchestration to core abstractions
- OpenDSS MCP → DSS tools: exposes · Entrypoint wires in domain-specific OpenDSS tools
- OpenDSS MCP → Sample cases: loads · Uses local feeder and circuit model files
- OpenDSS core → OpenDSS runtime: drives · Core layer coordinates the OpenDSS execution engine
- DSS tools → Sample cases: reads · Simulation and visualization tools operate on local circuit assets
- PSCAD MCP → PSCAD core: uses · Main module delegates session control to core components
- PSCAD MCP → PSCAD tools: exposes · Main module registers the PSCAD tool set
- PSCAD core → PSCAD app: controls · Connection manager and executor interact with the external PSCAD app
- PSCAD tools → PSCAD app: operates · Tool layer performs app, project, simulation, and data actions
- PSSE MCP → psspy catalog: derives tools from · Server builds MCP actions from the JSON command inventory
- PSSE MCP → PSSE runtime: executes on · Adapter forwards command execution to PSSE
- ANDES MCP → Power tools: wraps · Independent adapter around the target analysis engine
- Egret MCP → Power tools: wraps · Independent adapter around the target analysis engine
- LTSpice MCP → Power tools: wraps · Independent adapter around the target analysis engine
- PowerWorld MCP → Power tools: wraps · Independent adapter around the target analysis engine
- PyPSA MCP → Power tools: wraps · Independent adapter around the target analysis engine
- pandapower MCP → Power tools: wraps · Independent adapter around the target analysis engine
- surge MCP → Power tools: wraps · Independent adapter around the target analysis engine
- PSLF MCP → Power tools: wraps · Independent adapter around the target analysis engine
- HOPE server → Power tools: bridges · Self-contained reusable server package with its own runtime boundary
