美国干旱监测MCP服务器
 ](package.json)  
模型上下文协议(MCP)服务器,提供对美国干旱监测数据的访问,用于野火风险评估、农业规划和水资源管理。
当前状态: 该项目正处于规划和文件编制阶段。实施情况(src/ 目录)尚未创建。看 实施计划 发展路线图和 状态.md 对于当前的进展。概述
该MCP服务器与美国干旱监测数据服务集成,提供当前和历史干旱严重程度信息。服务器格式化数据,使其与野火信息模式保持一致 火灾行为 干旱条件是野火风险评估的关键因素。
什么是美国干旱监测?
美国干旱监测(USDM)是美国干旱状况的每周地图,由以下机构联合制作:
- 国家抗旱中心(NDMC)
- 美国农业部
- 美国国家海洋和大气管理局(NOAA)
干旱类别:
- D0:异常干旱(进入干旱,走出干旱)
- 第1天:中度干旱
- 第2页:严重干旱
- 第3页:极端干旱
- 第4天:异常干旱
关键指标:
- 降水量
- 土壤水分
- 溪流流量
- 地下水位
- 积雪(如适用)
- 植被健康
特性
- 按地点(纬度/经度、县、州)获取当前干旱情况
- 检索历史干旱数据和趋势
- 计算干旱严重程度得分
- 将干旱数据与野火风险评估相结合
- 格式化数据以匹配wildfire_prompt_template.json模式
- 支持GeoJSON、JSON和CSV格式
- 每周更新(USDM每周四发布新数据)
运作原理
干旱MCP服务器充当克劳德(或其他MCP客户端)和美国干旱监测数据服务之间的桥梁:
- 位置查询:你问克劳德某个特定地点的干旱情况
- 区域标识:服务器标识相关县/州或地理区域
- 数据检索:当前干旱严重程度数据来自百万美元API
- 历史分析:显示干旱进展/衰退的可选趋势分析
- 风险整合干旱严重程度转化为野火风险因素
- 回应:格式化数据返回给Claude进行分析和演示
安装
先决条件: Node.js 18.0.0或更高版本
# Clone the repository
git clone https://github.com/tyson-swetnam/drought-mcp.git
cd drought-mcp
# Install dependencies
npm install
# Configure environment variables
cp .env.example .env
# Edit .env if needed (most USDM APIs are public)配置
MCP服务器配置
添加到您的Claude Desktop配置中:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - 视窗:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"drought-mcp": {
"type": "stdio",
"command": "node",
"args": [
"/absolute/path/to/drought-mcp/src/index.js"
],
"cwd": "/absolute/path/to/drought-mcp",
"env": {
"LOG_LEVEL": "info",
"CACHE_TTL_SECONDS": "86400",
"USDM_DATA_FORMAT": "json",
"ENABLE_HISTORICAL_ANALYSIS": "true"
},
"autoApprove": [
"get_drought_current",
"get_drought_by_area",
"get_drought_historical",
"get_drought_statistics"
],
"timeout": 60
}
}
}重要提示:
- 替换
/absolute/path/to/drought-mcp带有干旱mcp目录的实际绝对路径 - 使用绝对路径
src/index.js,不是相对路径 - 这
autoApprove列表允许自动执行干旱工具,无需手动确认 - 编辑配置文件后,重新启动Claude Desktop以使更改生效
可选配置
创建一个 .env 高级配置文件:
# Optional: Caching configuration
CACHE_TTL_SECONDS=86400 # 24 hours (USDM updates weekly)
LOG_LEVEL=info
# Optional: Data source preferences
USDM_DATA_FORMAT=json # json, geojson, or csv
ENABLE_HISTORICAL_ANALYSIS=true用法
启动服务器
# Start the MCP server
npm start
# Or start with auto-reload for development
npm run dev查询示例
一旦配置了Claude Desktop,您可以问:
- “科罗拉多州博尔德县目前的干旱情况如何?”
- “让我看看加州的干旱严重程度”
- “德克萨斯州的干旱情况在过去6个月里有所改善吗?”
- “北纬40.0°、西经105.2°坐标处的干旱程度是多少?”
- “干旱严重程度如何影响我所在地区的野火风险?”
可用工具
1.get_draught_current
获取某个地点的当前干旱情况。
参数:
location(字符串,可选):位置名称(例如,“科罗拉多州博尔德县”)latitude(数字,可选):纬度(-90到90)longitude(数字,可选):经度(-180至180)state(字符串,可选):州缩写(例如“CO”)county(字符串,可选):县名format(字符串,可选):输出格式-“json”|“wildfire_schema”(默认:“wildfire \_schema“)
注: 提供其中之一 location,或 latitude/longitude,或 state/county.
请求示例:
{
"latitude": 40.0150,
"longitude": -105.2705,
"format": "wildfire_schema"
}示例响应:
{
"location": "Boulder County, Colorado",
"as_of": "2025-08-29T00:00:00Z",
"drought_conditions": {
"severity": "D2",
"severity_name": "Severe Drought",
"severity_level": 2,
"area_percent": 85,
"description": "Crop losses likely. Water shortages common. Water restrictions imposed."
},
"risk_assessment": {
"overall_risk": "High",
"notes": "Severe drought conditions significantly increase wildfire risk. Low fuel moisture and stressed vegetation create highly flammable conditions."
},
"data_sources": [
{
"name": "US Drought Monitor",
"type": "drought",
"url": "https://droughtmonitor.unl.edu/"
}
],
"notes": "Data updated weekly on Thursdays. Current data reflects week ending 2025-08-29."
}2.获取粗略区域
获取一个州或地区的干旱统计数据。
参数:
state(字符串,必填):州缩写(例如“CO”、“CA”)include_counties(布尔值,可选):包括县级细分(默认值:false)date(字符串,可选):特定日期(ISO 8601),默认为最新日期
请求示例:
{
"state": "CO",
"include_counties": true
}示例响应:
{
"state": "Colorado",
"state_code": "CO",
"as_of": "2025-08-29T00:00:00Z",
"summary": {
"area_sq_miles": 104094,
"drought_categories": {
"D0": { "percent": 35.2, "area_sq_miles": 36640 },
"D1": { "percent": 28.1, "area_sq_miles": 29250 },
"D2": { "percent": 18.5, "area_sq_miles": 19257 },
"D3": { "percent": 12.2, "area_sq_miles": 12699 },
"D4": { "percent": 0, "area_sq_miles": 0 }
},
"drought_free_percent": 6.0
},
"counties": [
{
"name": "Boulder",
"fips": "08013",
"severity": "D2",
"percent_in_drought": 85
}
]
}3.获取_粗略_历史
检索历史干旱数据和趋势。
参数:
location(字符串,可选):位置名称latitude(数字,可选):纬度longitude(数字,可选):经度state(字符串,可选):州缩写start_date(字符串,必填):开始日期(ISO 8601)end_date(字符串,必填):结束日期(ISO 8601)aggregation(字符串,可选):“周”|“月”(默认值:“每周”)
请求示例:
{
"latitude": 40.0150,
"longitude": -105.2705,
"start_date": "2025-01-01T00:00:00Z",
"end_date": "2025-08-29T00:00:00Z",
"aggregation": "monthly"
}示例响应:
{
"location": "Boulder County, Colorado",
"time_period": {
"start": "2025-01-01T00:00:00Z",
"end": "2025-08-29T00:00:00Z"
},
"trend": {
"direction": "worsening",
"severity_change": "+2 categories",
"description": "Drought conditions have intensified from D0 to D2 over the period"
},
"timeline": [
{
"date": "2025-01-01T00:00:00Z",
"severity": "D0",
"severity_level": 0
},
{
"date": "2025-02-01T00:00:00Z",
"severity": "D0",
"severity_level": 0
},
{
"date": "2025-03-01T00:00:00Z",
"severity": "D1",
"severity_level": 1
}
]
}4.获取粗略统计数据
获取统计摘要和比较。
参数:
state(字符串,可选):州缩写region(字符串,可选):地区名称(例如“西南”、“大平原”)compare_to(字符串,可选):比较期-“last_year”|“10_year_avg”|“historical_avg”
请求示例:
{
"state": "CA",
"compare_to": "last_year"
}示例响应:
{
"state": "California",
"current": {
"date": "2025-08-29T00:00:00Z",
"in_drought_percent": 72.3,
"severe_or_worse_percent": 45.1
},
"comparison": {
"date": "2024-08-29T00:00:00Z",
"in_drought_percent": 65.8,
"severe_or_worse_percent": 38.2
},
"analysis": {
"change": "+6.5% area in drought",
"trend": "worsening",
"notable": "Severe drought (D2+) increased by 6.9 percentage points"
}
}数据模式
服务器以与火灾行为兼容的格式输出干旱数据 wildfire_prompt_template.json 模式,将其扩展到干旱特定领域。
干旱严重程度综合:
干旱状况已纳入野火风险评估,具体如下:
| 干旱类别 | 严重程度 | 野火风险贡献 |
|---|---|---|
| 无 | 0 | 无(0分) |
| D0(异常干燥) | 1 | 低(+10分) |
| D1(中等) | 2 | 中等(+20分) |
| D2(严重) | 3 | 高(+30分) |
| D3(极端) | 4 | 非常高(+40分) |
| D4(特殊) | 5 | 极端(+50分) |
看 数据模式文档 获取完整的映射详细信息。
数据源
此MCP服务器连接到:
- 美国干旱监测数据服务
- 网站:https://droughtmonitor.unl.edu/ - GIS数据:https://droughtmonitor.unl.edu/DmData/GISData.aspx - 数据格式:geojson、ShapeFile、JSON、CSV - 更新频率:每周(周四)
- NDMC数据API
- API终点:https://usdmdataservices.unl.edu/api/ - 县/州统计 - 历史时间序列
- 美国国家海洋和大气管理局干旱门户网站 (补充)
- 网站:https://www.drought.gov/ - 其他干旱指标
干旱严重程度描述
D0-异常干燥
- 进入干旱:短期干旱减缓作物或牧场的种植、生长
- 走出干旱:一些持续的缺水;未完全恢复的牧场或作物
D1-中度干旱
- 农作物、牧场受到一些损害
- 溪流、水库或水井水位低;一些水资源短缺正在发展或迫在眉睫
- 要求自愿限制用水
D2-严重干旱
- 作物或牧场可能损失
- 普遍缺水
- 实施用水限制
D3-极端干旱
- 主要作物/牧场损失
- 普遍的水资源短缺或限制
- 野火危险增加
D4-异常干旱
- 异常和普遍的作物/牧场损失
- 水库、溪流和井中缺水,造成水资源紧急情况
- 极端野火危险
与火灾行为的整合
干旱数据增强了野火风险评估:
- 干旱是风险乘数:严重干旱显著增加了野火风险
- 燃油水分相关性:干旱严重程度与燃料湿度低有关
- 植被压力:长期干旱造成高度易燃的死植被
- 水的可用性:干旱影响消防供水
- 历史背景:干旱趋势有助于预测火灾季节的严重程度
看 火灾行为集成指南 详细的集成步骤。
常见用例
野火风险评估
Query: "What's the drought situation in Boulder County and how does it affect fire risk?"
Response includes:
- Current drought severity (D0-D4)
- Drought duration and trend
- Impact on fuel moisture and vegetation
- Contribution to overall wildfire risk score农业规划
Query: "Show me drought conditions across California's Central Valley"
Response includes:
- County-level drought severity
- Percent of agricultural land in drought
- Comparison to historical averages水资源管理
Query: "How have drought conditions changed in the Colorado River basin over the past year?"
Response includes:
- Multi-state drought trends
- Severity changes by region
- Comparison to previous year故障排除
未返回数据
未找到位置:
- 验证位置名称拼写
- 尝试使用州+县而不是城市名称
- 或者使用精确的经纬度坐标
日期超出范围:
- 2000年1月4日至今可用的百万美元数据
- 历史查询仅限于此范围
失效数据
USDM每周四更新一次。如果你在周三查询,你会得到上周的数据。这是正常的,也是意料之中的。
要检查数据货币:
- 看
as_of响应中的字段 - 数据应追溯到最近的星期二
缓存问题
干旱数据每周都会发生变化,因此缓存非常激进(默认为24小时):
- 要强制刷新,请重新启动服务器
- 修改
CACHE_TTL_SECONDS在.env - 等待下周四的USDM更新
发展
# Install dependencies
npm install
# Run tests
npm test
# Run tests with coverage
npm run test:coverage
# Run linter
npm run lint
# Fix linting issues
npm run lint:fix
# Run in development mode with auto-reload
npm run dev看 贡献.md 详细的开发指南。
项目结构
drought-mcp/
├── src/
│ ├── index.js # MCP server entry point
│ ├── tools/ # MCP tool implementations
│ ├── api/ # API client modules
│ ├── schemas/ # Data validation schemas
│ └── utils/ # Helper functions
├── docs/
│ ├── architecture.md # System architecture
│ ├── implementation_plan.md
│ ├── data_schema.md # Schema mapping details
│ ├── api_endpoints.md # External API documentation
│ └── fire_behavior_integration.md
├── tests/
│ ├── unit/
│ └── integration/
├── .env.example
├── package.json
├── CONTRIBUTING.md
└── README.md贡献
我们欢迎捐款!无论是bug修复、新功能、文档改进还是示例,我们都非常感谢您的帮助。
贡献方式
- 通过GitHub问题报告错误并建议功能
- 改进文档和示例
- 提交带有错误修复或增强功能的拉取请求
- 使用实际用例帮助测试MCP服务器
- 分享您的集成经验
看 贡献.md 了解详细的指导方针和开发工作流程。
许可证
Apache 2.0-有关详细信息,请参阅LICENSE文件
文档
用户文档
开发者文档
相关项目
致谢
- 数据源:美国干旱监测(NDMC、USDA、NOAA)
- 模式:基于火灾行为应用程序
wildfire_prompt_template.json - 伙伴:国家抗旱中心、国家干旱综合信息系统
支持
对于问题或疑问:
状态
该项目目前正在 规划和文件编制阶段核心实施方案正在制定中。请参阅 实施计划 时间线和里程碑。
每周数据更新
美国干旱监测机构每周四上午(通常在美国东部时间上午8:30之前)发布新数据。MCP服务器在查询时自动获取最新数据。对于时间敏感的应用程序,请在周四上午之后查询最新的干旱评估。
