hecras-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@hecras-mcpvalidate and compute plan p01, then show me the max water level"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
hecras-mcp
An MCP server that lets Claude run HEC-RAS headless: inspect projects, execute plans and read results.
HEC-RAS is the US Army Corps of Engineers' river hydraulics software. It is a Windows desktop application with no usable programmatic API. This server wraps it in the Model Context Protocol so an AI agent (Claude Code, Claude Desktop) can drive 1D steady, 1D unsteady and 2D models end to end.
Status: 19 tools · 126 automated tests passing (113 library tests + 13 end-to-end MCP protocol tests), including a full 2D simulation and validation against USACE's official Muncie 2D model mesh.
📄 Full technical notes in Spanish: README.es.md
Why this was harder than it looks
Every item below failed silently or with a misleading error, and each one cost real debugging time.
Problem | What happens | How the server handles it |
The COM API ( | 64-bit Python gets | Skip COM entirely: drive |
Exit code is always 0, even when the engine aborts | A failed run looks like a success | The source of truth is the |
An unreadable plan file (LF instead of CRLF) | HEC-RAS silently computes a different plan | Verifies that the outputs that changed belong to the requested plan ( |
Fixed-width fields are not uniform (8 vs 16 chars) | Coordinates get truncated and the engine hangs forever | Width-aware writers, and every compute call carries a mandatory |
Windows regional format in Spanish ( | The Fortran engine only reads English months: |
|
| Wrong files picked up as projects | Requires the |
Related MCP server: ras-commander-mcp
Architecture
Layer | Mechanism |
Compute |
|
Run status |
|
Results |
|
Model files | Custom fixed-width parsers for |
2D terrain |
|
Safety | Path allow-list ( |
Tools
Group | Tools |
Discovery & inspection |
|
Compute |
|
Results |
|
Modification |
|
Arguments plan, geometry and flow are file extensions (p01, g01, f01), not full paths.
Testing: physical validation, not just "it didn't crash"
Tests run on disposable synthetic models generated in sandbox/ and never touch a real model.
Steady 1D: discharge conserved exactly (50 / 150 / 300 m³/s); uniform flow drops 1.00 m per 1000 m (= bed slope); energy line always above the water surface; normal depth of 1.726 m checked by hand against Manning's equation.
Unsteady 1D: the inflow hydrograph is reproduced (peak 320 m³/s), the flood wave rises and recedes, and the peak attenuates downstream (320 → 310.5 m³/s).
2D: 1,104 seeded points → 1,246 cells / 2,279 faces, run finishes with 0.016 % volume balance error; the max water level follows the hydrograph and never drops below the minimum terrain elevation.
Deliberate failures: paths outside the allow-list, missing projects, GIS
.prjfiles, nonexistent plans/sections, malformed discharge lists, invented variables, results requested before computing, corrupted geometry, timeouts, 2D tools on a 1D model, and the regional-date failure. Each one must fail cleanly, with an explanation.
.venv\Scripts\python.exe tests\run_tests.py # 113 library tests
.venv\Scripts\python.exe tests\test_protocol.py # 13 MCP protocol testsThe official USACE Muncie model (used to validate reading a production mesh: 5,765 cells, 11,164 faces) is not
included because of its size. Get it from USACE's
Example_Projects_7_0.zip
with tests/extract_example.ps1; if it's missing, that stage is skipped automatically.
Setup
Requirements: Windows, HEC-RAS 7.0.x, Python 3.10+.
python -m venv .venv
.venv\Scripts\pip install -r requirements.txt
claude mcp add hecras --scope user "C:\path\to\hecras-mcp\start_hecras_mcp.cmd"Configure in start_hecras_mcp.cmd:
HECRAS_MCP_ROOTS— folders the server may read and write (;-separated). Everything else is rejected.HECRAS_EXE(optional) — a specificRas.exe. Without it, the installation is detected from the Windows registry.HECRAS_VERSION(optional) — choose among several installations, e.g.6.5.
Not covered
Geometry authoring through the tools, unsteady hydrograph editing, bridges and structures, sediment transport, water quality and inundation mapping (RAS Mapper).
Built by Oscar Daniel Montero Miranda. Independent project, not affiliated with or endorsed by USACE or the Hydrologic Engineering Center. Code comments are in Spanish.
This server cannot be deployed
Maintenance
Related MCP Connectors
Garmin data in Claude: 135 tools — activities, sleep, HRV, training, workouts. Free, open source.
WHOOP recovery, strain, sleep and workouts in Claude via official WHOOP OAuth. Free, open source.
GA4, Google Ads and Search Console in Claude. Read-only OAuth, multi-account for agencies.
Run UX research from Claude — create card sort studies, list studies, pull headline stats.
Related MCP Servers
- AlicenseAqualityAmaintenanceA headless, natural-language-driven automated modelling workflow for MIKE+, enabling users to inspect models, change parameters, run simulations, and analyze results without the MIKE+ GUI.107MIT
- AlicenseNot gradedqualityFmaintenanceEnables querying HEC-RAS project information, geometry elements, plan results, and compute messages through natural language, allowing interaction with hydraulic modeling projects.12MIT
- AlicenseNot gradedqualityCmaintenanceEnables users to control CSI ETABS structural engineering software through Claude, allowing model creation, status checks, and engineering checks via COM automation.MIT
- AlicenseAqualityCmaintenanceMCP server that enables natural-language-driven, headless HEC-RAS modeling, letting agents inspect, edit, run, compare, and plot 1D/2D hydraulic models without the GUI.101MIT