How power-agent/powermcp works
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_mcp.py OpenDSS MCP · main.py PSCAD MCP · psse_mcp.py PSSE MCP · andes_mcp.py ANDES MCP
Components 23
LLM Hosts
Model-context protocol clients that launch and talk to the adapters
- LLM host · Desktop or API host that connects to the server processes
Tool Adapters
Independent MCP server packages, one per simulator or analysis tool
- ANDES MCP · Thin MCP wrapper around ANDES
ANDES/andes_mcp.py - Egret MCP · Thin MCP wrapper around Egret
Egret/egret_mcp.py - LTSpice MCP · Thin MCP wrapper around LTSpice
LTSpice/ltspice_mcp.py - PowerWorld MCP · Thin MCP wrapper around PowerWorld
PowerWorld/powerworld_mcp.py - PyPSA MCP · Thin MCP wrapper around PyPSA
PyPSA/pypsa_mcp.py - pandapower MCP · Thin MCP wrapper around pandapower
pandapower/panda_mcp.py - surge MCP · Thin MCP wrapper around surge
surge/surge_mcp.py - PSLF MCP · Thin MCP wrapper around PSLF
PSLF/pslf_mcp.py - HOPE server · Reusable MCP server package with entrypoint and tests
HOPE/src/hope_mcp_server - OpenDSS MCP · Entry script for the OpenDSS MCP bridge
OpenDSS/opendss_mcp.py - OpenDSS core · Engine, state, and server abstractions
OpenDSS/core - DSS tools · Configuration, simulation, results, model handling, and interactive view helpers
OpenDSS/opendss_tools - PSCAD MCP · MCP application for automating PSCAD workflows
PSCAD/pscad_mcp/main.py - PSCAD core · Connection and execution boundaries for the bridge
PSCAD/pscad_mcp/core - PSCAD tools · App, project, simulation, and data operations exposed as tools
PSCAD/pscad_mcp/tools - PSSE MCP · 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 · Large JSON inventory of PSSE command definitions and metadata
PSSE/psspy_command_json - Sample cases · 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 · Underlying engines such as ANDES, Egret, PyPSA, pandapower, LTSpice, PowerWorld, PSLF, and surge
- OpenDSS runtime · Circuit solver and local model runtime behind the OpenDSS bridge
- PSCAD app · External desktop application controlled through the PSCAD bridge
- PSSE runtime · PSSE engine invoked through the command metadata adapter
Connections 32
- 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