Skip to main content
Glama
OpenDSS MCP Server

OpenDSS MCP Server

OpenDSS MCP Server

Leer en español

An MCP (Model Context Protocol) server that lets an AI assistant run OpenDSS, EPRI's open-source power distribution system simulator, through py-dss-interface. Claude Desktop, Claude Code or any other MCP client can compile circuits, run power flow, check voltage and thermal violations, simulate faults, extract Thévenin impedances, run hosting capacity and quasi-static time series (QSTS) studies, and plot results — through 20 typed tools that return structured data, not free text.

The point is reliability: the model never computes a number. OpenDSS does, and the assistant reads the result as JSON or Markdown with the inputs that produced it.

Tools

Group

Tools

Compile

opendss_compile_file, opendss_compile_script

Run

opendss_run_command

Query

opendss_get_voltages, opendss_voltage_summary, opendss_get_loads, opendss_get_line_flows, opendss_get_loading, opendss_violations

Edit

opendss_edit_element, opendss_add_element, opendss_enable_elements

Faults

opendss_fault_3ph, opendss_fault_1ph, opendss_fault_sweep, opendss_thevenin_z1, opendss_thevenin_z0

Studies

opendss_hosting_capacity, opendss_run_qsts

Output

opendss_plot

Each tool takes a single params object, for example opendss_compile_file(params={"dss_path": "...", "response_format": "json"}).

What it covers:

  • Power flow: bus voltages in pu, line flows, loads, losses, convergence.

  • Violations and loading: buses outside the voltage band and elements above their rated current, with the limits you pass.

  • Short circuit: three-phase and single-line-to-ground faults at a bus or swept across buses, and positive- and zero-sequence Thévenin impedance.

  • Hosting capacity: PV added in steps until a voltage, thermal or convergence limit binds, uniform or worst-case placement.

  • QSTS: daily or yearly time series with the circuit's load shapes.

  • Editing: typed add/edit/enable of PV, storage, loads, capacitors and regulators, with the values read back from OpenDSS.

Related MCP server: opendss-mcp-server

Installation

Requires Python 3.10 or later. The OpenDSS engine ships with py-dss-interface, which works on Windows and Linux.

git clone https://github.com/jpsalamanca-co/opendss-mcp.git
cd opendss-mcp
pip install -e ".[dev]"   # [dev] adds pytest, pytest-asyncio and ruff
python -m pytest tests -q

Client configuration

Claude Desktop (claude_desktop_config.json) or Claude Code (.mcp.json):

{
  "mcpServers": {
    "opendss_mcp": {
      "command": "opendss-mcp",
      "env": { "OPENDSS_MCP_OUTPUT_DIR": "./results" }
    }
  }
}

To run it directly over stdio: opendss-mcp or python -m opendss_mcp.server.

Variable

Default

Use

OPENDSS_MCP_OUTPUT_DIR

system temp folder

where plots are saved

Example

examples/ieee13/ includes the IEEE 13-node test feeder. With Master.dss compiled:

  • it converges and has 15 buses;

  • the minimum voltage between 1 and 100 kV is 0.924 pu;

  • the nominal load is 3466 kW and 2102 kvar across 9 loads;

  • a three-phase fault at bus 671 gives 4558.6 A.

The tests check those values, including one run over stdio as an MCP client would.

Scope

A calculation tool, not an engineering service. Results depend on the model you give it — a wrong source impedance converges just as cleanly as a right one — and are reviewed and signed by whoever holds the professional responsibility.

License

MIT, see LICENSE. OpenDSS (EPRI) is distributed under BSD-3-Clause and py-dss-interface under MIT; both are installed as dependencies, not redistributed here.

Available Tools

20 tools
opendss_add_elementA

Create a new element (PVSystem, Storage, Load, Line, Capacitor, RegControl, InvControl, LoadShape...) from a properties dict and re-solve.

Typed alternative to opendss_run_command("New ..."): refuses to overwrite an existing element, verifies that OpenDSS created it and reads the properties back. Use element_class + name, not 'Class.Name' in name.

Args: params: AddElementInput with element_class, name, properties, solve.

Returns: Command executed, values read back and solve status.

Inputs: params (required). Returns: result

opendss_compile_fileB
Idempotent

Compile an OpenDSS model from a .dss file on disk and run power flow.

Loads the circuit, solves it in snapshot mode, and returns a summary with convergence status, bus/line/load counts, and total losses.

Args: params: CompileFileInput with dss_path and optional buscoords_path.

Returns: Circuit summary with convergence, counts, and losses.

Inputs: params (required). Returns: result

opendss_compile_scriptA
Idempotent

Compile an OpenDSS circuit from inline DSS commands and run power flow.

Pass the complete DSS script as a multi-line string. The server writes it to a temporary file, compiles it, and solves in snapshot mode.

Args: params: CompileScriptInput with the DSS script text.

Returns: Circuit summary with convergence, counts, and losses.

Inputs: params (required). Returns: result

opendss_edit_elementA
Idempotent

Edit properties of an existing element and re-solve.

Typed alternative to opendss_run_command("Edit ..."): checks that the element exists, builds the Edit command from the properties dict, reads the values back from OpenDSS and reports convergence. Fails on unknown properties instead of silently ignoring them.

Args: params: EditElementInput with element (Class.Name), properties, solve.

Returns: Command executed, values read back and solve status.

Inputs: params (required). Returns: result

opendss_enable_elementsA
Idempotent

Enable or disable all elements of a class, or only the named ones, and re-solve.

Typical use: disable every PVSystem to get the base case, or disable a Capacitor / RegControl to test its effect. Without names it runs BatchEdit Class..* enabled=yes|no.

Args: params: EnableElementsInput with element_class, enabled, names, solve.

Returns: Elements affected and solve status.

Inputs: params (required). Returns: result

opendss_fault_1phA
Idempotent

Run a single-phase-to-ground (1F-G) fault at a specific bus.

Applies a 1-phase fault on the specified phase with given resistance and returns fault current magnitude, 3I0, per-phase voltages (pre/post), short-circuit power, and voltage sag impact.

Use two calls with different r_fault values (e.g., 0.01 and 1.0) to extract zero-sequence Thévenin impedance Z0_th via dual-fault method.

The circuit must be compiled first with opendss_compile_file or _script.

Args: params: Fault1PhInput with bus name, phase, and fault resistance.

Returns: Fault current, 3I0, Scc_1ph, and voltage impact summary.

Inputs: params (required). Returns: result

opendss_fault_3phA
Idempotent

Run a three-phase fault at a specific bus.

Applies a 3-phase fault with specified resistance and returns fault currents (per phase), short-circuit power (Scc), and voltage sag impact (number of buses below 0.80 and 0.50 pu during the fault).

The circuit must be compiled first with opendss_compile_file or _script.

Args: params: FaultInput with bus name and fault resistance.

Returns: Fault currents, Scc, and voltage impact summary.

Inputs: params (required). Returns: result

opendss_fault_sweepA
Idempotent

Run three-phase faults at multiple buses to build a fault current curve.

Re-compiles the circuit for each bus to get clean, independent results. Useful for plotting Icc vs distance or sizing protection equipment.

Args: params: FaultSweepInput with list of buses.

Returns: Table of fault currents and Scc per bus.

Inputs: params (required). Returns: result

opendss_get_line_flowsA
Read-onlyIdempotent

Get power flow (P, Q) and max current for every line.

Useful for identifying overloaded lines and understanding power distribution across the network.

Args: params: VoltageInput (only response_format is used).

Returns: Table of line flows sorted by current (descending).

Inputs: params (required). Returns: result

opendss_get_loadingA
Read-onlyIdempotent

Get thermal loading (% of NormAmps) for every line and transformer.

Max phase current at terminal 1 against NormAmps and EmergAmps of the element. Shunt elements (capacitors) are skipped. Sorted by loading descending, so overloaded elements come first.

For transformers loading_pct is NOT the nameplate loading: NormAmps comes from normhkva, which defaults to 1.1 x kVA. Transformers also carry kva_nominal, i_nominal_a (winding 1) and loading_nominal_pct, the loading against nameplate kVA; report that one as "% of rated capacity".

Args: params: VoltageInput (only response_format is used).

Returns: Table with element, buses, i_max_a, norm_amps, emerg_amps, loading_pct (and, for transformers, kva_nominal, i_nominal_a, loading_nominal_pct).

Inputs: params (required). Returns: result

opendss_get_loadsA
Read-onlyIdempotent

Get active and reactive power for every load in the circuit.

Returns nominal and actual (solved) kW/kvar for each load element.

Args: params: VoltageInput (only response_format is used).

Returns: Table of load powers.

Inputs: params (required). Returns: result

opendss_get_voltagesA
Read-onlyIdempotent

Get voltage magnitude (pu) for all buses in the compiled circuit.

Returns per-bus voltage data including average, min, max pu values, kV base, number of phases, distance from source, and coordinates. Filter by kv_base range to focus on MV or LV buses.

Args: params: VoltageInput with kv_min/kv_max filters.

Returns: Table of bus voltages sorted by voltage (ascending).

Inputs: params (required). Returns: result

opendss_hosting_capacityA
Idempotent

Run a hosting capacity study by incrementally adding PV generation.

Tests multiple PV levels at the given load multiplier and reports, per level: Vmin/Vmax, voltage and thermal violation counts, worst loaded element, head flow (negative = reverse flow into the substation) and the binding constraint (voltage, thermal, convergence or none). Supports uniform distribution (equal PV per bus) and worst-case (all PV at the first bus given). Run it at minimum load (load_mult ~0.3): DER limits do not show at peak. The circuit is recompiled clean afterwards, so edits made with run_command/edit_element before the study are lost.

The circuit must be compiled from a file first (not from script).

Args: params: HostingCapacityInput with bus list, PV steps, transformer kVA, load_mult and limits.

Returns: Table per PV level plus hosting_capacity_kw (last level without violations) and the first binding constraint.

Inputs: params (required). Returns: result

opendss_plotA
Read-onlyIdempotent

Generate a voltage visualization plot and save it as PNG.

Supported plot types:

  • voltage_profile: Scatter plot of voltage vs distance from substation.

  • topology: Georeferenced network map colored by voltage level.

The circuit must be compiled and solved first.

Args: params: PlotInput with plot_type and kv_base filters.

Returns: Path to the generated PNG image file.

Inputs: params (required). Returns: result

opendss_run_commandB

Execute a single OpenDSS text command on the currently loaded circuit.

Useful for modifying the circuit after compilation (adding elements, changing parameters, setting modes, etc.).

Args: params: RunCommandInput with the DSS command string.

Returns: The DSS result string, or confirmation of execution.

Inputs: params (required). Returns: result

opendss_run_qstsA

Run a quasi-static time series (QSTS) simulation.

Requires LoadShapes to be defined in the circuit model. Supports daily (24h), yearly (8760h), and dutycycle modes.

The circuit must be compiled first. LoadShapes must already be defined in the DSS model for time-varying behavior.

Args: params: QSTSInput with mode, stepsize, number of steps.

Returns: Convergence status and final-state voltage summary.

Inputs: params (required). Returns: result

opendss_thevenin_z0A
Idempotent

Extract zero-sequence Thévenin impedance (Z0) at a bus.

Uses the dual-fault method with 1F-G faults: two single-phase faults with different R_fault, combined with Z1 extraction, to solve for R0_th and X0_th.

Returns both Z0 and Z1 (needed for the calculation). The circuit must be compiled first.

Args: params: TheveninZ0Input with bus name, phase, and two fault resistances.

Returns: R0_th, X0_th, Z0_th, plus Z1 data and supporting information.

Inputs: params (required). Returns: result

opendss_thevenin_z1A
Idempotent

Extract positive-sequence Thévenin impedance (Z1) at a bus.

Uses the dual-fault method: two 3-phase faults with different R_fault values to algebraically solve for R1_th and X1_th.

The circuit must be compiled first.

Args: params: TheveninZ1Input with bus name and two fault resistances.

Returns: R1_th, X1_th, Z1_th, X/R ratio, and supporting data.

Inputs: params (required). Returns: result

opendss_violationsA
Read-onlyIdempotent

Report buses outside [v_min, v_max] pu and elements above loading_max %.

Voltage limits apply per phase (bus v_min_pu / v_max_pu). Defaults are 0.95 / 1.05 pu and 100 % of NormAmps; pass the limits of the applicable standard (e.g. NTC 1340 / CREG) explicitly when they differ. Use it after every solve to verify the case before reporting results.

Args: params: ViolationsInput with limits and optional kV base filter.

Returns: Counts plus the lists of voltage and thermal violations.

Inputs: params (required). Returns: result

opendss_voltage_summaryA
Read-onlyIdempotent

Get voltage statistics: min, max, mean, std, violation counts.

Provides a quick overview of the voltage regulation status including the number of buses below 0.95 pu and above 1.05 pu.

Args: params: VoltageInput with kv_min/kv_max filters.

Returns: Voltage statistics summary.

Inputs: params (required). Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 20 tools

    Disambiguation4/5

    Most tools target clearly distinct operations (compile, query voltages/loads/flows, faults, QSTS, hosting capacity). There is deliberate overlap between opendss_run_command and the typed opendss_edit_element/opendss_add_element, and minor overlap between opendss_voltage_summary and opendss_violations, but the descriptions explicitly clarify the boundaries and when to prefer each.

    Naming Consistency4/5

    Nearly all tools share the opendss_ prefix and a verb_noun or noun_action pattern (compile_file, get_voltages, run_qsts, fault_3ph, thevenin_z1). A few noun-only names (violations, plot, hosting_capacity) and the _3ph/_1ph suffix style deviate slightly but remain readable and predictable.

    Tool Count4/5

    20 tools is on the heavier side but each maps to a genuinely distinct power-systems operation, so the count is justified rather than padded. It sits at the upper edge of comfortable scoping without obvious redundancy.

    Completeness4/5

    The surface covers the full analysis lifecycle: compile (file/script), raw command execution, element add/edit/enable, result queries (voltages, loads, flows, loading, violations), fault/Thevenin analysis, QSTS, hosting capacity, and plotting. Minor gaps like a dedicated delete_element or standalone re-solve are workable via run_command/enable_elements.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables conversational power system analysis by connecting Claude AI with EPRI's OpenDSS simulator. Allows distribution planning engineers to perform sophisticated electrical grid studies through natural language instead of complex scripting.
      MIT
    • F
      license
      C
      quality
      B
      maintenance
      MCP server that enables Claude to model and simulate electrical distribution networks (MV/LV) using OpenDSS, including power flow, short-circuit, contingency analysis, and single-line diagram generation.
      127
      -
    • F
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to drive a real, licensed PSCAD 5.x installation through its Automation Library: connecting and checking out license certificates, creating projects, placing and wiring components, setting parameters, building and running simulations, and reading back result traces. All 45 tools return structured JSON with real error details so agents can diagnose licensing, wiring, or parameter failures.
      -