@cyanheads/usgs-water-mcp-server
Click on "Install 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., "@@cyanheads/usgs-water-mcp-servershow me current discharge at USGS site 01573150"
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.
Public Hosted Server: https://usgs-water.caseyjhand.com/mcp
Tools
Five tools for querying USGS water data, plus two for SQL analytics over the DuckDB-backed canvas dataframes that water_get_series and water_find_sites materialize:
Tool | Description |
| Static lookup of well-known USGS parameter codes with names, units, and domain. No network call. |
| Find USGS monitoring sites by bounding box, state, county, or HUC watershed. Filter by site type and parameter availability. Large match sets spill to DataCanvas. |
| Get the latest instantaneous values (~15 min real-time) for up to 100 USGS sites. |
| Get a time series of daily or instantaneous values for a site over a date range. Large ranges spill to DataCanvas. |
| Get current hydrologic conditions ranked against the full period-of-record percentile statistics. |
| List tables and columns staged on a DataCanvas by |
| Run a read-only SQL SELECT against the time-series and site tables staged by |
water_list_parameters
Static lookup of well-known USGS parameter codes — no network call, instant response.
Discover that
00060= Discharge (ft³/s),00065= Gage height (ft),00010= Temperature (°C),72019= Depth to water level (ft), and moreFilter by thematic domain:
streamflow,groundwater,temperature,meteorological,water-quality, orallUse this first — parameter codes are required by every other water tool
water_find_sites
Discover USGS monitoring sites before calling data tools — all other tools require a site number.
Geographic scoping: bounding box (
"west,south,east,north"decimal degrees), 2-letter state code, bare 5-digit FIPS county code (e.g.51013), or HUC watershed code — either a 2-digit major HUC (02) or an 8-digit minor HUC (02070008), the only two lengths NWIS acceptsSite type filtering:
ST(stream),GW(groundwater well),LK(lake/reservoir),SP(spring), and moreParameter filter: only return sites that have data for a specific parameter code — comma-separate to require several (e.g.
00060,00065)Data type filter: require sites with real-time (
iv), daily (dv), or groundwater (gw) dataReturns site number, name, coordinates, type, state/county/HUC codes, and drainage area (expanded mode only) — altitude is included in both modes when USGS records it
Bounded result set: capped at 500 sites inline, with a
truncatedflag andupstreamTotal(the full upstream count) so an oversized query never overflows the responseDataCanvas spillover: when the result is truncated and
CANVAS_PROVIDER_TYPE=duckdbis set, the full match set is staged to a DuckDB-backed canvas — the response includescanvas_idandtable_nameto retrieve every match past the 500 cap viawater_dataframe_query. Without DataCanvas, narrow the query with additional filters (county, HUC, bbox, parameter, data type) to bring the result under the cap
water_get_readings
Get the latest instantaneous (~15 min) values for one or more USGS monitoring sites.
Batch up to 100 site numbers in a single call
Accepts any parameter code discoverable via
water_list_parametersConfigurable lookback period via ISO 8601 duration (e.g.
PT2H= last 2 hours,P7D= last 7 days)Returns per-site, per-parameter records with timestamp, value, unit, and provisional/approved qualifier
Bounded by design: each series carries its 10 most recent records, with
totalValuesreporting how many the period actually held andtruncatedflagging the cap. Usewater_get_serieswhen you need the full seriesPartial batches are explicit: requested sites NWIS returns no data for are named in
missingSitesrather than dropped silentlyGroundwater depth available via
parameterCd=72019(the legacygwlevelsendpoint was decommissioned November 2025 — use the IV service instead)
water_get_series
Get a historical time series for a site and parameter over a date range.
Daily values (DV service, one value per day) or instantaneous values (IV service, ~15 min resolution)
Returns site name, parameter name, unit code, and time-ordered value records with qualifiers
DataCanvas spillover: large date ranges (>500 records) automatically spill to a DuckDB-backed canvas when
CANVAS_PROVIDER_TYPE=duckdbis set — response includescanvas_idandtable_namefor follow-up SQL viawater_dataframe_queryWithout DataCanvas, returns the most recent 500 records with a
truncatedflag andtotalRecordscountSupports chaining: pass a prior
canvas_idto append data to an existing canvas
water_get_conditions
Get current hydrologic conditions placed in full historical context.
Fetches the current IV reading and the full daily percentile table in parallel
Classifies the reading:
record-high(≥ p95),above-normal(p75–p95),normal(p25–p75),below-normal(p10–p25),low(p05–p10),record-low(< p05)Pairs each class with a
percentileLabelspelling out the threshold —record-highandrecord-lowmark percentile-of-record extremes, not verified all-time records, and the label says so where the class name does notRanks against the observation's own calendar day, so a reading near midnight is not compared against the neighboring day's percentiles
Discloses the granularity approximation in
comparisonBasis: the reading is instantaneous while the percentiles are approved daily-mean values, so the class is a "how unusual is this" ranking — not a flood-stage or drought determination, which need authoritative thresholds this tool does not fetchValidates
siteandparameterCdat the schema edge; a well-formed value NWIS still rejects surfaces as the typedinvalid_requestreason rather than an opaque upstream errorGracefully degrades when historical context is missing: returns the current reading with
historicalContext: nulland ahistoricalContextStatussaying why —no_record(new/short record),no_matching_day(no row for the date), orunavailable(stat call failed — transient and retryable, kept distinct from a sparse record)
water_dataframe_describe / water_dataframe_query
In-conversation SQL analytics over the dataframes that water_get_series and water_find_sites materialize on a DuckDB-backed canvas — time-series tables from the former, full site match sets from the latter.
Workflow:
Call
water_get_serieswith a large date range, orwater_find_siteswith a query that matches more than 500 sites — when DataCanvas is enabled, the response includescanvas_idandtable_nameCall
water_dataframe_describewith thecanvas_idto confirm the table schema — series tables carrydate_time,value,qualifiers,site_number,parameter_cd,unit_code; site tables carrysite_number,site_name,site_type,latitude,longitude,huc_cd, and the expanded fieldsCall
water_dataframe_querywith thecanvas_idand a SELECT statement to run aggregates, filter, or join
Read-only by default — only SELECT statements are permitted. Results are capped at 10,000 rows; a query matching more comes back with truncated: true. Requires CANVAS_PROVIDER_TYPE=duckdb in the server environment.
Related MCP server: nws-weather-usgs-water-mcp
Resources and prompts
Type | Name | Description |
Resource |
| Site metadata: name, coordinates, type, HUC, state, county, drainage area, and altitude |
Resource |
| Full parameter code catalog (same data as |
All resource data is also reachable via tools. Use water_find_sites for geographic site discovery.
Features
Built on @cyanheads/mcp-ts-core:
Declarative tool and resource definitions — single file per primitive, framework handles registration and validation
Unified error handling — handlers throw, framework catches, classifies, and formats
Pluggable auth:
none,jwt,oauthSwappable storage backends:
in-memory,filesystem,Supabase,Cloudflare KV/R2/D1Structured logging with optional OpenTelemetry tracing
STDIO and Streamable HTTP transports
USGS NWIS–specific:
Wraps NWIS IV (instantaneous), DV (daily), site, and stat endpoints — no API key required, fully public
Input formats checked at the edge against what NWIS actually accepts — site numbers, parameter codes, ISO 8601 periods, HUC, FIPS county, state, and bbox all carry a validated pattern that is advertised in each tool's JSON Schema, so malformed values fail with a pointed message instead of an opaque upstream 400
HTML error detection: NWIS returns 400 with an HTML body for bad inputs; the service layer extracts NWIS's own message — which names the field it rejected — and maps it to a typed failure
Multi-site batching:
water_get_readingsaccepts up to 100 site numbers in one callProvisional vs. approved data qualifiers surfaced on every reading — not hidden from callers
DataCanvas spillover:
water_get_series(long date ranges) andwater_find_sites(match sets past the 500-site cap) stage the full result as a DuckDB-backed table queryable viawater_dataframe_queryGroundwater via the IV service using parameter
72019— the legacygwlevelsendpoint was decommissioned November 2025
Agent-friendly output:
Percentile classification on every conditions response — callers get a
percentileClassstring (record-high,normal,record-low, etc.) they can act on directly without parsing numeric thresholds, plus apercentileLabelstating the threshold in plain language so therecord-*classes are not mistaken for verified all-time recordsPartial success on conditions: when percentiles are missing, the current reading still returns with
historicalContext: nulland ahistoricalContextStatusthat separates an empty stat table (no_record/no_matching_day) from a failed stat call (unavailable, transient), rather than collapsing both into an errorPartial success on batches:
water_get_readingsreturns the series it got and names the rest inmissingSites, so a silently dropped site never reads as a complete answerTruncation signals:
water_get_seriesreportstotalRecordsandtruncated,water_find_sitesreportsupstreamTotalandtruncated, andwater_get_readingsreports per-seriestotalValuesplustruncated, so callers know when a preview is incomplete.canvas_id/table_nametell them exactly how to retrieve the restStructured content and rendered text agree: every cap and count a tool applies is reported identically in
structuredContentand in the markdown, so neither class of client sees a different answer
Getting started
Public Hosted Instance
A public instance is available at https://usgs-water.caseyjhand.com/mcp — no installation required. Point any MCP client at it via Streamable HTTP:
{
"mcpServers": {
"usgs-water-mcp-server": {
"type": "streamable-http",
"url": "https://usgs-water.caseyjhand.com/mcp"
}
}
}Self-Hosted / Local
Add the following to your MCP client configuration file.
{
"mcpServers": {
"usgs-water-mcp-server": {
"type": "stdio",
"command": "bunx",
"args": ["@cyanheads/usgs-water-mcp-server@latest"],
"env": {
"MCP_TRANSPORT_TYPE": "stdio",
"MCP_LOG_LEVEL": "info"
}
}
}
}Or with npx (no Bun required):
{
"mcpServers": {
"usgs-water-mcp-server": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@cyanheads/usgs-water-mcp-server@latest"],
"env": {
"MCP_TRANSPORT_TYPE": "stdio",
"MCP_LOG_LEVEL": "info"
}
}
}
}Or with Docker:
{
"mcpServers": {
"usgs-water-mcp-server": {
"type": "stdio",
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "MCP_TRANSPORT_TYPE=stdio",
"ghcr.io/cyanheads/usgs-water-mcp-server:latest"
]
}
}
}To enable DataCanvas for SQL analytics over large result sets (time series and site match sets), add CANVAS_PROVIDER_TYPE=duckdb to the env block in any of the configs above.
For Streamable HTTP, set the transport and start the server:
MCP_TRANSPORT_TYPE=http MCP_HTTP_PORT=3010 bun run start:http
# Server listens at http://localhost:3010/mcpPrerequisites
Bun v1.3.14 or higher (or Node.js v24+).
No API key required — USGS NWIS is a free, public API.
Installation
Clone the repository:
git clone https://github.com/cyanheads/usgs-water-mcp-server.gitNavigate into the directory:
cd usgs-water-mcp-serverInstall dependencies:
bun installConfigure environment:
cp .env.example .env
# Edit .env to set any optional overridesConfiguration
Variable | Description | Default |
| Set to | — |
| Custom User-Agent string sent to USGS NWIS. USGS requests a descriptive User-Agent per their terms. |
|
| HTTP request timeout in milliseconds for NWIS calls. |
|
| Transport: |
|
| Port for HTTP server. |
|
| Auth mode: |
|
| Log level (RFC 5424). |
|
| Directory for log files (Node.js only). |
|
| Enable OpenTelemetry instrumentation (spans, metrics, completion logs). |
|
See .env.example for the full list of optional overrides.
Running the server
Local development
Build and run:
# One-time build bun run rebuild # Run the built server bun run start:stdio # or bun run start:httpRun checks and tests:
bun run devcheck # Lint, format, typecheck, security bun run test # Vitest test suite bun run lint:mcp # Validate MCP definitions against spec
Docker
docker build -t usgs-water-mcp-server .
docker run --rm -p 3010:3010 usgs-water-mcp-serverThe Dockerfile defaults to HTTP transport, stateless session mode, and logs to /var/log/usgs-water-mcp-server. OpenTelemetry peer dependencies are installed by default — build with --build-arg OTEL_ENABLED=false to omit them.
Project structure
Directory | Purpose |
|
|
| Server-specific environment variable parsing and validation with Zod. |
| Tool definitions ( |
| Resource definitions ( |
| NWIS HTTP client — IV, DV, site, and stat endpoints with HTML error detection. |
| DataCanvas accessor for DuckDB-backed spillover. |
| Unit and integration tests mirroring |
Development guide
See CLAUDE.md for development guidelines and architectural rules. The short version:
Handlers throw, framework catches — no
try/catchin tool logicUse
ctx.logfor request-scoped logging,ctx.statefor tenant-scoped storageRegister new tools and resources via the barrels in
src/mcp-server/*/definitions/index.tsWrap external API calls: validate raw → normalize to domain type → return output schema; never fabricate missing fields
Contributing
Issues and pull requests are welcome. Run checks and tests before submitting:
bun run devcheck
bun run testLicense
Apache-2.0 — see LICENSE for details.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Flicense-qualityDmaintenanceProvides access to real-time water data from the USGS Water Services API, allowing users to fetch instantaneous measurements like stream flow, gage height, temperature, and water quality parameters from thousands of monitoring stations across the US.Last updated3
- AlicenseAqualityAmaintenanceCombines National Weather Service alerts and forecasts with modern USGS water data, enabling weather and hydrology queries through MCP. No API key required, with persistent local caching.Last updated29Creative Commons Zero v1.0 Universal
- Alicense-qualityBmaintenanceEnables querying USGS water data including real-time and historical streamflow, gage height, and water temperature from USGS gauges across the United States.Last updatedMIT
- AlicenseAqualityBmaintenanceAn MCP server that exposes EPA ECHO water quality data as tools, enabling facility search, permit limits, discharge measurements, violations, and enforcement actions.Last updated6MIT
Related MCP Connectors
USGS Water MCP — wraps USGS National Water Information System (NWIS) REST services (free, no auth)
Hosted weather data MCP for discovery, validation, and OAuth-protected GribStream queries.
Hosted MCP endpoint with realistic fake data for prototyping agents. 12 tools, no setup.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/cyanheads/usgs-water-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server