fema-mcp-server
Can be used as a swappable storage backend, supporting Cloudflare KV, R2, and D1 for persisting data.
Provides in-conversation SQL analytics over NFIP Claims data staged by fema_search_nfip using DuckDB-backed DataCanvas.
Can be used as a swappable storage backend for persistent storage of data.
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., "@fema-mcp-serverShow me hurricane disasters in Texas in 2025"
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://fema.caseyjhand.com/mcp
Overview
Federal disaster recovery data from FEMA: disaster declarations, public assistance grants, individual housing assistance, and NFIP flood insurance claims. Search declarations by state or incident, see the public and housing assistance behind any disaster, and run SQL over large flood-claim result sets.
Tools
Tool | Description |
| Search federal disaster declarations by state, incident type, declaration type, date range, and county |
| Fetch all designated-area records for a specific disaster by disaster number |
| Public assistance funded projects for a disaster or state — where federal recovery money went |
| Individual assistance housing data for a disaster — owner and renter breakdowns and inspection counts by county/ZIP, filterable by county or ZIP |
| NFIP flood insurance claims for a state, county, or ZIP, with optional DataCanvas spillover for SQL analytics |
| List columns and row counts for DataCanvas tables staged by |
| Run a SELECT query against a DataCanvas table staged by |
| Remove a staged DataCanvas table or view — opt-in, absent from |
| Generic OData query against any dataset in the OpenFEMA catalog — escape hatch for datasets the convenience tools don't cover |
fema_dataframe_drop is callable and appears in tools/list only when FEMA_ENABLE_CANVAS_DROP=true. Its definition is always included in createApp(); while disabled, the HTTP landing page displays the enable hint. The other eight tools are always advertised.
Resources
Resource | Description |
| Summary for a specific FEMA disaster declaration — title, state, incident type, programs, incident period |
All resource data is also reachable via tools. Use fema_get_disaster for the same data with full designated-area detail.
Related MCP server: @cyanheads/eia-energy-mcp-server
Capability reference
fema_search_disasters tool
Filters:
state,incident_type,declaration_type(DR/EM/FM), inclusivedate_from/date_to(YYYY-MM-DD; equal dates select one day), andcounty; page withlimit(1–1000, default 50) andoffset. A page stops at 100,000 characters of declarations;next_offsetnames where the next page starts.incident_typeandcountyare case-insensitive substring matches:stormalso matchesSnowstorm,harrismatchesHarrisandHarrison,dekalbmatchesDeKalb. Blank values are ignored.Returns one summary per disaster number with
designated_area_count, program flags, and declaration totals.countyselects declarations without narrowing those: the count and flags describe the whole declaration,total_area_rowscounts the matched area rows, andmatched_areaslists each matched area with its FIPS codes and its own flags (an area designated for PA and HM only hasia_declared: false). Typed errors:invalid_state,invalid_range(date_fromafterdate_to),no_results,request_too_long.Searches the most recent 10,000 designated-area rows. When capped, returns complete declarations, marks
truncated, reports declaration totals as lower bounds, and names the nextdate_toinnotice.
fema_get_disaster tool
Requires
disaster_numberfromfema_search_disasters.Returns all designated-area records, FIPS codes, incident period, and program flags combined across areas; a missing disaster returns
not_found.
fema_get_public_assistance tool
Requires
disaster_numberorstate; optionalcountyfilter (case-insensitive substring),limit(1–10000, default 100), andoffset. A page stops at 100,000 characters of projects;next_offsetnames where the next page starts.Returns applicants, damage categories, project size/status, and federal and total obligations. Typed errors:
invalid_state,missing_filter,not_found,no_results,request_too_long.
fema_get_housing_assistance tool
Requires
disaster_number; optionalstate,county(case-insensitive substring),zip_code(5 digits, leading zeros kept),type(owners/renters/both, defaultboth),limit(1–10000, default 100), andoffset. The filters apply to both datasets before paging, soowners_count,renters_count, andoffsetcount the filtered records. A page stops at 100,000 characters of rows, cutting owners and renters at the same count, so onenext_offsetcontinues both.Returns separate
ownersandrentersarrays with county/ZIP registrations, approved amounts, and inspection counts, plusowners_count/renters_counttotals. Owners also carry inspected damage in USD; an owner area nobody inspected reads as uninspected, not as $0 of damage. Renters carry damage-degree counts of registrations and no dollar damage. Typed errors:invalid_state,not_found,no_results,request_too_long.
fema_search_nfip tool
Requires
state; optionalcounty_code,zip_code,year_from/year_to,limit(1–10000, default 1000), andoffset. ReadsNfipClaimsv3, newest loss first with claim ID breaking ties.county_codeaccepts a full 5-digit FIPS code (e.g.,48201) or a 3-digit county code (e.g.,201); the server prefixes the latter with the state's FIPS code. A shorter county code is zero-padded to 3 digits, and a 4-digit code to 5 (1001→01001, the form a numeric01001arrives in). A 5-digit code from another state is still sent, and an empty match names the mismatch.Inline claims stop at 100,000 characters, with the continuation in
next_offsetandnotice;cause_of_damageandoccupancy_typeretain OpenFEMA's published codes. Typed errors:invalid_state,invalid_county_code(anything but 1–5 digits, or a short code for FM, MH, or PW),invalid_range(year_fromafteryear_to),no_results.With
CANVAS_PROVIDER_TYPE=duckdb, a first-page match exceeding the inline budget stages up to 50,000 rows.canvas_id,canvas_table, andstaged_countidentify the stage;truncated: truemarks its cap andtotal_countretains the full match. Inspect the stage withfema_dataframe_describe, then query it withfema_dataframe_query.
fema_dataframe_describe tool
Requires
canvas_idfromfema_search_nfip.Lists table/view names, column types, nullability, and staged row counts. Typed errors:
canvas_not_found,canvas_unavailable.
fema_dataframe_query tool
Requires
canvas_idand a single SQLquery; only SELECT statements are permitted. DDL, DML, COPY, and file-reading functions are blocked.Returns rows capped at the canvas row limit and at 100,000 characters, with
truncated/shownand OFFSET guidance when either cut the result (caponly when the row limit did). Typed errors:canvas_unavailable,canvas_not_found,missing_table,invalid_sql,non_select_statement,multi_statement,denied_function,plan_operator_not_allowed,sql_read_only,sql_execution_error(useTRY_CASTor filter incompatible values).
fema_dataframe_drop tool
Requires
canvas_idand the exacttable_namefromfema_dataframe_describe.Removes one staged table or view;
dropped: falsemeans the name did not exist. Typed errors:canvas_not_found,canvas_unavailable.Opt-in through
FEMA_ENABLE_CANVAS_DROP=true; disabled by default with an enable hint in the manifest. FEMA source data is unchanged.
fema_query_dataset tool
Requires a case-sensitive OpenFEMA
dataset; optional ODatafilter/select/orderby,limit(1–10000, default 100), andoffset. Resolves each dataset's API version from the catalog. A page stops at 100,000 characters of records;next_offsetnames where the next page starts.Returns records and
total_count; an empty page succeeds with filter or paging guidance. Typed errors:unknown_dataset,dataset_not_served,catalog_unavailable(retryable),invalid_filter,invalid_select,invalid_orderby,invalid_odata_syntax,request_too_long(URL past about 8,900 characters),filter_too_complex(filter nested more than 100 levels deep).For a list of values, use
field in ('a','b')rather than a chain oforcomparisons; OpenFEMA's nesting limit allows about 90 chained comparisons.For
NfipPolicies, usepropertyStateandreportedZipCode; always include a ZIP filter to avoid timeout.
fema://disaster/{disasterNumber} resource
Requires
disasterNumberas a string of digits.Returns title, state, incident type, declaration type/date, incident period,
programs_declared, anddesignated_area_count;not_foundcarries recovery guidance pointing tofema_search_disasters.
Features
Built on @cyanheads/mcp-ts-core: stdio and Streamable HTTP transports, pluggable auth (none / jwt / oauth), swappable storage (in-memory, filesystem, Supabase, Cloudflare KV/R2/D1), structured logging with optional OpenTelemetry tracing.
OpenFEMA-specific:
Disaster numbers are in OpenFEMA's range 1–32767; an offset past the last match returns an empty page with totals and a notice naming the last valid offset.
Canvas inputs accept the server-issued 10-character URL-safe
canvas_id([A-Za-z0-9_-]{10}); omit it on the first NFIP search.Typed OpenFEMA REST client with
%24-prefixed OData parameter encoding (an Akamai requirement), per-dataset API versions resolved from the OpenFEMA dataset catalog, and structured error classification distinguishing JSON 400 responses (by the failingfilter/select/orderbyclause) from HTML Drupal error pages and the CDN's refusal of over-long URLsCase-insensitive name filters over OpenFEMA's case-sensitive
substringof: a caller's county or incident type resolves to the exact-case spellings stored in a bundled snapshot ofDisasterDeclarationsSummariesnames, plus lower/UPPER/Title variants, in the same single request. Refresh the snapshot withbun run vocabulary:buildAutomatic deduplication of
DisasterDeclarationsSummaries— one row per designated area collapsed to declaration-level summaries withdesignated_area_count; a county search reads the returned declarations' full area rows so the count and program flags stay declaration-levelNFIP Claims guard:
statefilter is required to prevent unbounded 2.7M-row fetchesDataCanvas spillover for NFIP analytics — large NFIP result sets materialize as DuckDB tables queryable via SQL without re-fetching
No API keys required — OpenFEMA is a free, public API
Agent-friendly output:
Disaster number is the explicit join key across all datasets — every tool that touches a disaster surfaces it prominently so agents can chain calls without re-searching
Typed error contracts on every tool —
invalid_state,invalid_county_code,invalid_range,no_results,not_found,missing_filter,unknown_dataset,dataset_not_served,invalid_filter,invalid_select,invalid_orderby,invalid_odata_syntax,request_too_long,filter_too_complex,canvas_unavailable— with recovery hints telling agents the concrete next stepdesignated_area_counton search results so agents know whether to drill in withfema_get_disasterwithout having to fetch the full record first
Getting started
Public Hosted Instance
A public instance is available at https://fema.caseyjhand.com/mcp — no installation required. Point any MCP client at it via Streamable HTTP:
{
"mcpServers": {
"fema-mcp-server": {
"type": "streamable-http",
"url": "https://fema.caseyjhand.com/mcp"
}
}
}Self-Hosted / Local
Add the following to your MCP client configuration file.
{
"mcpServers": {
"fema-mcp-server": {
"type": "stdio",
"command": "bunx",
"args": ["@cyanheads/fema-mcp-server@latest"],
"env": {
"MCP_TRANSPORT_TYPE": "stdio",
"MCP_LOG_LEVEL": "info"
}
}
}
}Or with npx (no Bun required):
{
"mcpServers": {
"fema-mcp-server": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@cyanheads/fema-mcp-server@latest"],
"env": {
"MCP_TRANSPORT_TYPE": "stdio",
"MCP_LOG_LEVEL": "info"
}
}
}
}Or with Docker:
{
"mcpServers": {
"fema-mcp-server": {
"type": "stdio",
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "MCP_TRANSPORT_TYPE=stdio",
"ghcr.io/cyanheads/fema-mcp-server:latest"
]
}
}
}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/mcpTo enable DuckDB-backed SQL analytics for NFIP Claims:
{
"mcpServers": {
"fema-mcp-server": {
"type": "stdio",
"command": "bunx",
"args": ["@cyanheads/fema-mcp-server@latest"],
"env": {
"MCP_TRANSPORT_TYPE": "stdio",
"CANVAS_PROVIDER_TYPE": "duckdb"
}
}
}
}Prerequisites
Bun v1.4.0 or higher (or Node.js v24+).
No API keys required — OpenFEMA is a free, public API.
Optional: set
CANVAS_PROVIDER_TYPE=duckdbto enable SQL analytics over large NFIP Claims result sets.
Installation
Clone the repository:
git clone https://github.com/cyanheads/fema-mcp-server.gitNavigate into the directory:
cd fema-mcp-serverInstall dependencies:
bun installConfigure environment:
cp .env.example .env
# edit .env — no required vars, but CANVAS_PROVIDER_TYPE=duckdb enables SQL analyticsConfiguration
All configuration is validated at startup via Zod schemas in src/config/server-config.ts. Key environment variables:
Variable | Description | Default |
| Override the OpenFEMA API root. Each dataset's version is appended per request; a trailing |
|
| Total budget in milliseconds for one upstream exchange, including response body, retries, and backoff. NFIP county queries can be slow. |
|
| Set to | — |
| Enable the destructive |
|
| Transport: |
|
| Session mode: |
|
| HTTP server port. |
|
| Auth mode: |
|
| Log level ( |
|
| Log failed-call arguments and results, redacted by key name. Secrets in free-form values are retained. |
|
| Per-payload UTF-8 byte cap for failed-call logging. |
|
| OTLP base URL; traces append | — |
| Override the traces endpoint; used as-is. | — |
| Override the metrics endpoint; used as-is. | — |
| Opt into log export at this URL; the base endpoint alone never enables it. | — |
| Directory for log files (Node.js only). |
|
| Enable OpenTelemetry instrumentation. |
|
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 fema-mcp-server .
docker run --rm -e MCP_TRANSPORT_TYPE=stdio fema-mcp-serverThe Dockerfile defaults to HTTP transport, stateless session mode, and logs to /var/log/fema-mcp-server. OpenTelemetry peer dependencies are installed by default — build with --build-arg OTEL_ENABLED=false to omit them. Production dependencies are cross-installed for the target architecture in a native build stage, with release-age and Socket checks; the Debian runtime excludes unused musl bindings.
Project structure
Directory | Purpose |
|
|
| Server-specific environment variable parsing and validation with Zod. |
| Tool definitions ( |
| Resource definitions ( |
| OpenFEMA REST API client — OData param builder, response parser, error classifier, retry wrapper — plus the case-insensitive name matcher and its bundled name vocabulary. |
| DataCanvas integration — DuckDB spillover for large NFIP result sets. |
| 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 in
src/index.tsWrap external API calls: validate raw → normalize to domain type → return output schema; never fabricate missing fields
Contributing
Issues are welcome. Run checks and tests before submitting:
bun run devcheck
bun run testData source
Data is provided by the OpenFEMA API, a free public API maintained by the Federal Emergency Management Agency. Usage is subject to OpenFEMA Terms and Conditions.
This product uses the Federal Emergency Management Agency's OpenFEMA API, but is not endorsed by FEMA. The Federal Government or FEMA cannot vouch for the data or analyses derived from these data after the data have been retrieved from the Agency's website(s).
When citing OpenFEMA datasets in research or publications, use the format FEMA specifies:
Federal Emergency Management Agency (FEMA), OpenFEMA Dataset: <name>. Retrieved from <URL> on <date>.License
Apache-2.0 — see LICENSE for details.
This server cannot be deployed
Maintenance
Related MCP Connectors
Query SEC EDGAR filings, XBRL financials, and company data via MCP. STDIO or Streamable HTTP.
OpenFEMA MCP — US Federal Emergency Management Agency open data.
Query FDA data on drugs, food, devices, and recalls via openFDA. STDIO or Streamable HTTP.
Federal disaster declarations, emergencies, and assistance data
Related MCP Servers
- AlicenseNot gradedqualityAmaintenanceAccess FEC campaign finance data through MCP. Query data about candidates, money trails, and election filings. STDIO & Streamable HTTP.147 npm2Apache 2.0
- AlicenseNot gradedqualityAmaintenanceBrowse and query the U.S. Energy Information Administration API v2 — electricity, petroleum, natural gas, coal, forecasts, and more via MCP. STDIO or Streamable HTTP.249 npm2Apache 2.0
- AlicenseNot gradedqualityAmaintenanceExposes the FBI Crime Data Explorer API — crime estimates, agency offense rates, and LEOKA officer safety data via MCP. Supports STDIO or Streamable HTTP transport.85 npm1Apache 2.0
- AlicenseNot gradedqualityAmaintenanceQuery US Treasury national debt, interest rates, exchange rates, and fiscal datasets via MCP with STDIO or Streamable HTTP.76 npm2Apache 2.0