
Fema Mcp Server
io.github.cyanheadsv0.3.2更新於 Oct 8, 2026
Query FEMA disaster declarations, public assistance grants, housing aid, and NFIP claims.
概覽
讓助理透過 OpenFEMA API 查詢 FEMA 災害宣告、公共援助撥款、住房援助與 NFIP 洪水保險理賠資料。
- 功能
- 以 FEMA 的 OpenFEMA 資料為基礎,提供八個工具與一個選用工具:依州、事件類型、宣告類型、日期範圍或郡搜尋災害宣告;依災害編號取得指定區域紀錄;查詢公共援助專案與住房援助的屋主及租戶明細;依州、郡或 ZIP 搜尋 NFIP 洪水保險理賠。通用 OData 工具可查詢任一 OpenFEMA 資料集,選用的 DuckDB DataCanvas 可將大型 NFIP 結果集暫存以供 SQL SELECT 分析。另有一個資源提供單一災害摘要。
- 適用情境
- 適合需要聯邦災害復原資訊的情境:某州或某郡受影響的災害宣告、公共援助資金流向、屋主與租戶住房援助數據,或洪水保險理賠模式。也適合想直接對大型 NFIP 理賠資料執行 SQL、而不必重複抓取的分析人員。
- 執行需求
- 可作為遠端 Streamable HTTP 端點使用,也可透過 npx、bunx 或 Docker 在本機執行;本機執行需要 Bun v1.4.0+ 或 Node.js v24+。不需要 API 金鑰。選用環境變數包括 CANVAS_PROVIDER_TYPE=duckdb(啟用 SQL 分析)、FEMA_ENABLE_CANVAS_DROP、MCP_TRANSPORT_TYPE、MCP_HTTP_PORT、MCP_AUTH_MODE 與 MCP_LOG_LEVEL。需要連線至 OpenFEMA API 的網路存取。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Fema Mcp Server,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Web executable,透過 Streamable HTTP。 遠端服務在工作區中設定後即可從網頁執行環境執行。
其他 MCP 客戶端
把它新增到你客戶端的 mcpServers 設定中。
{
"mcpServers": {
"fema-mcp-server": {
"type": "http",
"url": "https://fema.caseyjhand.com/mcp"
}
}
}README
@cyanheads/fema-mcp-server
Query FEMA disaster declarations, public assistance grants, housing aid, and NFIP flood insurance claims via MCP. STDIO or Streamable HTTP.
Public Hosted Server: https://fema.caseyjhand.com/mcp
Overview
Federal disaster recovery data from FEMA's OpenFEMA API — disaster declarations, public assistance grants, individual housing assistance, and NFIP flood insurance claims. Search declarations by state or incident, drill into public assistance and housing assistance by disaster number, and run SQL analytics over large NFIP result sets via DataCanvas. Runs as a stdio process, a local Streamable HTTP server, or the public hosted endpoint above.
Tools
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
All resource data is also reachable via tools. Use fema_get_disaster for the same data with full designated-area detail.
Capability reference
fema_search_disasters tool
- Filters:
state,incident_type,declaration_type(DR/EM/FM), inclusivedate_from/date_to(YYYY-MM-DD), andcounty; page withlimit(1–1000, default 50) andoffset. - Returns one summary per disaster number with
designated_area_count, program flags, and declaration totals. Typed errors:invalid_state,no_results. - 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,limit(1–1000, default 100), andoffset. - Returns applicants, damage categories, project size/status, and federal and total obligations. Typed errors:
invalid_state,missing_filter,not_found,no_results.
fema_get_housing_assistance tool
- Requires
disaster_number; optionalstate,type(owners/renters/both, defaultboth),limit(1–1000, default 100), andoffset. - Returns separate
ownersandrentersarrays with county/ZIP registrations and approved amounts, plusowners_count/renters_counttotals. Typed errors:invalid_state,not_found,no_results.
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.- Inline claims stop at 100,000 characters, with a continuation offset in
notice;cause_of_damageandoccupancy_typeretain OpenFEMA's published codes. Typed errors:invalid_state,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, with
truncated/shown/capand LIMIT/OFFSET guidance when capped. Typed errors:canvas_not_found,canvas_unavailable,invalid_query,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. - 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. - 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 - Automatic deduplication of
DisasterDeclarationsSummaries— one row per designated area collapsed to declaration-level summaries withdesignated_area_count - NFIP Claims guard:
statefilter is required to prevent unbounded 2.7M-row fetches - DataCanvas 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,no_results,not_found,missing_filter,unknown_dataset,dataset_not_served,invalid_filter,invalid_select,invalid_orderby,invalid_odata_syntax,canvas_unavailable— with recovery hints telling agents the concrete next step designated_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:
Self-Hosted / Local
Add the following to your MCP client configuration file.
Or with npx (no Bun required):
Or with Docker:
For Streamable HTTP, set the transport and start the server:
To enable DuckDB-backed SQL analytics for NFIP Claims:
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:
- Navigate into the directory:
- Install dependencies:
- Configure environment:
Configuration
All configuration is validated at startup via Zod schemas in src/config/server-config.ts. Key environment variables:
See .env.example for the full list of optional overrides.
Running the server
Local development
-
Build and run:
-
Run checks and tests:
Docker
The 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
Development guide
See CLAUDE.md for development guidelines and architectural rules. The short version:
- Handlers throw, framework catches — no
try/catchin tool logic - Use
ctx.logfor request-scoped logging,ctx.statefor tenant-scoped storage - Register new tools and resources in
src/index.ts - Wrap 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:
Data 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:
License
Apache-2.0 — see LICENSE for details.
來源:README.md,提交 8d3fc5a
工具
0版本歷史
4- v0.3.2最新Oct 4, 2026
- v0.3.1Sep 24, 2026
- v0.2.0Sep 20, 2026
- v0.1.14Sep 16, 2026

