EPANET MCP Server

v1.0.2
io.github.Applied-Artificial-Intelligence-Eurecat/epanet-mcp-server Checked 4 days ago Published 17 days ago

MCP server for EPANET water-distribution network simulation and scenario analysis.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

load_network

Load an EPANET .inp file into a named session. Args: path: Absolute file path, relative path, or bare filename (e.g. ``"Net1.inp"``) searched in ePyT's bundled networks. network_id: Optional human-readable session identifier. Defaults to the file's base name without extension. Returns: ``network_id``, ``path``, and a network summary (node/link counts, flow units, simulation duration).

ParameterTypeDescription
path *string
network_id

unload_network

Unload a previously loaded network and free its resources. Args: network_id: The session id returned by ``load_network``.

ParameterTypeDescription
network_id *string

list_networks

Return the ids of all currently loaded networks.

list_bundled_networks

List every .inp example file bundled with ePyT (usable with load_network).

get_network_summary

Return a high-level summary of a loaded network. Includes node/link counts, flow units, simulation duration and hydraulic timestep. Args: network_id: Session id of the network to inspect.

ParameterTypeDescription
network_id *string

get_nodes

Return all nodes (junctions, tanks, reservoirs) with their attributes. Attributes include elevation, base demand, and type. Tanks also include min/max/initial water levels and diameter. Args: network_id: Session id of the network to inspect.

ParameterTypeDescription
network_id *string

get_patterns

Return all demand / operational patterns defined in the network. Args: network_id: Session id of the network to inspect.

ParameterTypeDescription
network_id *string

get_controls

Return all simple controls defined in the network. Args: network_id: Session id of the network to inspect.

ParameterTypeDescription
network_id *string

get_curves

Return all curves (pump head, efficiency, volume, valve) in the network. Args: network_id: Session id of the network to inspect.

ParameterTypeDescription
network_id *string

get_options

Return simulation options: timesteps, units, quality settings, head-loss formula, and demand model. Args: network_id: Session id of the network to inspect.

ParameterTypeDescription
network_id *string

run_hydraulic_simulation

Run a full hydraulic simulation and return time-series results. Returns pressures, demands, heads, flows, velocities, head-losses and link statuses at every reporting time step. Args: network_id: Session id of the network to simulate.

ParameterTypeDescription
network_id *string

run_quality_simulation

Run a full water-quality simulation and return time-series results. Includes node/link quality concentrations plus all hydraulic results. Configure the quality type first with ``set_quality_type``. Args: network_id: Session id of the network to simulate.

ParameterTypeDescription
network_id *string

run_full_simulation

Run both hydraulic and water-quality simulations and return combined time-series results (pressures, flows, quality, reaction rates, etc.). Args: network_id: Session id of the network to simulate.

ParameterTypeDescription
network_id *string

get_pressure_at_time

Return node pressures at (or nearest to) a specific simulation time. Args: network_id: Session id of the network. time_s: Simulation time in seconds (e.g. 3600 = 1 hour).

ParameterTypeDescription
network_id *string
time_s *integer

get_flow_at_time

Return link flows at (or nearest to) a specific simulation time. Args: network_id: Session id of the network. time_s: Simulation time in seconds.

ParameterTypeDescription
network_id *string
time_s *integer

save_network

Save the current (possibly modified) network to a new .inp file. Args: network_id: Session id of the network to save. output_path: Destination file path (should end in ``.inp``).

ParameterTypeDescription
network_id *string
output_path *string

set_node_base_demand

Set the base demand for a junction node. Args: network_id: Session id. node_id: Junction node name/ID. demand: New base demand in the network's flow units. demand_category: Demand category index (default 1).

ParameterTypeDescription
demand *number
network_id *string
node_id *string
demand_categoryinteger

set_pattern

Overwrite all multiplier values for a named demand pattern. Args: network_id: Session id. pattern_id: Name of an existing pattern. values: New list of multiplier values.

ParameterTypeDescription
network_id *string
pattern_id *string
values *array

add_pattern

Add a new demand / operational pattern to the network. Args: network_id: Session id. pattern_id: Unique name for the new pattern. values: Multiplier values for consecutive pattern time steps.

ParameterTypeDescription
network_id *string
pattern_id *string
values *array

set_pipe_diameter

Set the diameter of a pipe. Args: network_id: Session id. pipe_id: Pipe name/ID. diameter: New diameter in the network's length units (mm or inches).

ParameterTypeDescription
diameter *number
network_id *string
pipe_id *string

set_pipe_roughness

Set the roughness coefficient of a pipe. Args: network_id: Session id. pipe_id: Pipe name/ID. roughness: Hazen-Williams C factor (or Darcy-Weisbach roughness height).

ParameterTypeDescription
network_id *string
pipe_id *string
roughness *number

set_pipe_status

Open or close a pipe. Args: network_id: Session id. pipe_id: Pipe name/ID. status: ``"OPEN"`` or ``"CLOSED"``.

ParameterTypeDescription
network_id *string
pipe_id *string
status *string

set_pipe_length

Set the length of a pipe. Args: network_id: Session id. pipe_id: Pipe name/ID. length: New length in the network's length units (feet or metres).

ParameterTypeDescription
length *number
network_id *string
pipe_id *string

set_pump_status

Start or stop a pump. Args: network_id: Session id. pump_id: Pump link name/ID. status: ``"OPEN"`` (running) or ``"CLOSED"`` (stopped).

ParameterTypeDescription
network_id *string
pump_id *string
status *string

set_pump_speed

Set the relative speed setting of a pump. Args: network_id: Session id. pump_id: Pump link name/ID. speed: Speed ratio (1.0 = design speed, 0.5 = half speed).

ParameterTypeDescription
network_id *string
pump_id *string
speed *number

set_pump_head_curve

Set (replace) the head-flow curve of a pump. Args: network_id: Session id. pump_id: Pump link name/ID. flow_values: X-axis (flow) values. head_values: Y-axis (head) values.

ParameterTypeDescription
flow_values *array
head_values *array
network_id *string
pump_id *string

set_valve_setting

Set the initial setting of a valve. PRV/PSV/PBV → pressure setpoint; FCV → flow rate; TCV → loss coefficient. Args: network_id: Session id. valve_id: Valve link name/ID. setting: New setting value.

ParameterTypeDescription
network_id *string
setting *number
valve_id *string

set_valve_status

Open or close a valve. Args: network_id: Session id. valve_id: Valve link name/ID. status: ``"OPEN"`` or ``"CLOSED"``.

ParameterTypeDescription
network_id *string
status *string
valve_id *string

set_tank_parameters

Update one or more parameters of a tank node. Only provided parameters are changed; others retain their current values. Args: network_id: Session id. tank_id: Tank node name/ID. initial_level: Water level at simulation start. min_level: Minimum operating level. max_level: Maximum operating level. diameter: Tank diameter.

ParameterTypeDescription
network_id *string
tank_id *string
diameter
initial_level
max_level
min_level

set_reservoir_head

Set the total head (water-surface elevation) of a reservoir. Args: network_id: Session id. reservoir_id: Reservoir node name/ID. head: Total head value in the network's pressure-head units.

ParameterTypeDescription
head *number
network_id *string
reservoir_id *string

set_simulation_duration

Set the total simulation duration. Args: network_id: Session id. duration_s: Duration in seconds (e.g. 86400 = 24 h).

ParameterTypeDescription
duration_s *integer
network_id *string

set_hydraulic_timestep

Set the hydraulic time step. Args: network_id: Session id. timestep_s: Hydraulic time step in seconds.

ParameterTypeDescription
network_id *string
timestep_s *integer

set_pattern_timestep

Set the demand and quality-source pattern timestep in seconds.

ParameterTypeDescription
network_id *string
timestep_s *integer

set_quality_timestep

Set the water-quality simulation time step. Args: network_id: Session id. timestep_s: Quality time step in seconds.

ParameterTypeDescription
network_id *string
timestep_s *integer

set_quality_type

Set the water-quality analysis type. Args: network_id: Session id. quality_type: One of ``"NONE"``, ``"AGE"``, ``"TRACE"``, or ``"CHEM"``. tracer_node: Source node for ``TRACE`` analysis. chemical_name: Species name for ``CHEM`` analysis. units: Concentration units (e.g. ``"mg/L"``).

ParameterTypeDescription
network_id *string
quality_type *string
chemical_name
tracer_node
units

add_control

Add a new simple control rule. Example control strings:: "LINK P1 CLOSED IF NODE T1 ABOVE 20" "LINK P1 OPEN IF NODE J2 BELOW 10" "LINK Pump9 1.5 AT TIME 16:00" Args: network_id: Session id. control_string: EPANET simple-control syntax string.

ParameterTypeDescription
control_string *string
network_id *string

delete_control

Delete a simple control by its 1-based index. Args: network_id: Session id. control_index: 1-based index (use ``get_controls`` to list them).

ParameterTypeDescription
control_index *integer
network_id *string

create_demand_perturbation

Apply base-demand multipliers to a set of nodes and optionally simulate. A clone of the source network is created; the original is unchanged. Args: network_id: Source network id. node_demands: ``{node_id: multiplier}`` — e.g. ``{"J1": 2.0}`` doubles demand at J1. scenario_id: Id for the cloned scenario session (auto-generated if omitted). run_simulation: Run a full simulation after applying changes.

ParameterTypeDescription
network_id *string
node_demands *object
run_simulationboolean
scenario_id

create_leakage_event

Simulate a pipe burst by adding a leakage emitter at the pipe midpoint. A clone of the source network is created; the original is unchanged. The burst pipe is split into two halves and a midpoint junction node with an emitter is added. Args: network_id: Source network id. pipe_id: Id of the pipe that bursts. leak_fraction: Optional fraction of baseline mean pipe flow (0.0–1.0). scenario_id: Id for the cloned scenario session. run_simulation: Run a full simulation after applying changes. target_leak_flow: Optional target f…

ParameterTypeDescription
network_id *string
pipe_id *string
emitter_exponent
leak_fraction
reference_pressure
run_simulationboolean
scenario_id
target_leak_flow

create_contamination_event

Inject a contaminant at a node for a specified time window and simulate. A clone of the source network is created. Quality type is set to CHEM automatically. Args: network_id: Source network id. source_node_id: Node where the contaminant is introduced. concentration: Concentration in mg/L (or model quality units). start_time_s: Injection start time in seconds. end_time_s: Injection end time in seconds. source_type: ``"CONCEN"``, ``"MASS"``, ``"FLOWPACED"``, or ``"SETPOINT"``. scenario_id: Id for th…

ParameterTypeDescription
concentration *number
end_time_s *integer
network_id *string
source_node_id *string
start_time_s *integer
chemical_namestring
run_simulationboolean
scenario_id
source_typestring
unitsstring

create_pressure_change_scenario

Study pressure changes by modifying reservoir heads. A clone of the source network is created; the original is unchanged. Args: network_id: Source network id. reservoir_heads: ``{reservoir_id: new_head}`` — e.g. ``{"Reservoir1": 120.0}``. scenario_id: Id for the cloned scenario session. run_simulation: Run a full simulation after applying changes.

ParameterTypeDescription
network_id *string
reservoir_heads *object
run_simulationboolean
scenario_id

create_pump_control_scenario

Apply a time-based pump on/off or speed schedule and simulate. A clone of the source network is created; the original is unchanged. Each pump entry maps to a list of EPANET simple-control strings:: { "Pump9": [ "LINK Pump9 1.0 AT TIME 06:00", "LINK Pump9 CLOSED AT TIME 22:00" ] } Args: network_id: Source network id. pump_schedule: ``{pump_id: [control_string, ...]}`` schedule. scenario_id: Id for the cloned scenario session. run_simulation: Run a full simulation after ap…

ParameterTypeDescription
network_id *string
pump_schedule *object
run_simulationboolean
scenario_id

create_valve_control_scenario

Apply static valve-setting changes and simulate. A clone of the source network is created; the original is unchanged. Args: network_id: Source network id. valve_settings: ``{valve_id: new_setting}`` map. scenario_id: Id for the cloned scenario session. run_simulation: Run a full simulation after applying changes.

ParameterTypeDescription
network_id *string
valve_settings *object
run_simulationboolean
scenario_id

create_multi_failure_scenario

Simulate simultaneous pipe and/or pump failures (closure). A clone of the source network is created; the original is unchanged. Args: network_id: Source network id. failed_pipes: List of pipe ids to close. failed_pumps: List of pump ids to close. scenario_id: Id for the cloned scenario session. run_simulation: Run a full simulation after applying changes.

ParameterTypeDescription
network_id *string
failed_pipes
failed_pumps
run_simulationboolean
scenario_id