Large Language Models (LLMs) have demonstrated exceptional reasoning capabilities, yet their practical application in water resources engineering remains limited by an inability to interact directly with local, proprietary simulation tools. This paper introduces "SWMM-MCP," a novel integration framework that bridges generative AI and EPA-SWMM using the Model Context Protocol (MCP). By deploying a specialized Python-based server leveraging swmm-api and the FastMCP framework, this system transforms the LLM from a passive text generator into an active, intelligent modeling agent capable of executing local computational tasks through natural language.
The proposed framework revolutionizes the urban drainage analysis workflow through three core capabilities. First, it enables automated model generation; the system parses raw facility data from Excel or CSV formats to algorithmically construct valid .inp files, automatically defining complex network topologies. Second, it facilitates conversational simulation and diagnosis. Engineers can instruct the AI to execute SWMM engines, interpret .rpt files to summarize stability errors, and query specific hydraulic indicators. The server exposes granular functions—such as get_node_timeseries—allowing the AI to retrieve data and generate dynamic matplotlib visualizations for variables like flow depth or velocity directly within the chat interface. Third, it enhances data interoperability, enabling users to export model components to GeoPackage for GIS integration or convert simulation outputs to Parquet for downstream machine learning workflows. This study illustrates how standardizing the AI-software interface can significantly lower the technical barrier to entry, reducing manual effort and enabling a seamless, dialogue-driven workflow for complex hydraulic modeling.
Acknowledgement: This work was supported by Electronics and Telecommunications Research Institute(ETRI) grant funded by the Korean government [25ZR1300, Development of Technology for the Urban Extreme Rainfall Response Platform]