mcp-weather
🌤️ Kaushik 的天气 MCP 服务器
 服务器,使用 TypeScript 构建,将 LLM(如 Claude Desktop、Cursor 和自定义 AI 代理)连接到美国国家气象局(NWS / NOAA)的实时气象数据。
🔗 集成实时证明
🚀 已验证可与 Claude Desktop 配合使用:查看展示实时预报检索、警报和健康诊断的实时聊天会话:
👉 查看实时 Claude AI 聊天证明
Related MCP server: mcp-weather
✨ 架构亮点
🏗️ 模块化整洁架构:解耦为专用服务层(
CacheService、RateLimiterService、NwsClient、Logger、Formatter)。📡 官方气象公告:带有标准化元数据和提供方归属的结构化天气报告。
⚡ 内存缓存(5 分钟 TTL):线程安全的内存缓存,可将上游 API 流量减少高达 80%。
🛡️ 零漏洞安全层:严格的输入清理、XSS 实体转义和客户端隔离的速率限制(100 次请求/分钟)。
🔁 弹性与容错:针对 HTTP
5xx/429错误自动进行指数退避重试,并带有请求超时保护。🩺 可观测性与诊断:内置
health_check、get_metrics和clear_cache工具,并带有结构化 JSON 日志。
📁 项目结构
weather/
├── src/
│ ├── config/ # Central configuration & runtime constants
│ ├── services/ # Core business logic (Cache, RateLimiter, NwsClient, Formatter, Logger)
│ ├── tools/ # MCP Tool handlers (alerts, forecast, diagnostics)
│ ├── types/ # Strongly typed TypeScript interfaces
│ ├── utils/ # Input sanitization and security helpers
│ └── index.ts # Server bootstrap, transport initialization & graceful shutdown
├── tests/
│ ├── unit/ # Unit test suites (utils, sanitizer, cache)
│ ├── integration/ # Upstream NWS API integration & retry tests
│ ├── performance/ # Cache throughput & rate-limiting load tests
│ ├── security/ # XSS, injection prevention & boundary tests
│ └── basic.test.ts # Comprehensive test runner
├── build/ # Compiled ES module JavaScript distribution
├── package.json
└── tsconfig.json🛠️ MCP 工具
工具 | 参数 | 描述 |
|
| 检索美国坐标的实时时段预报(温度、风力、天气状况)。 |
|
| 获取活跃的恶劣天气警报、警告和气象公告。 |
| 无 | 返回运行时健康状态、运行时间、堆内存使用量、缓存大小和 API 连接状态。 |
| 无 | 输出性能诊断信息和活跃的速率限制客户端桶。 |
| 无 | 刷新内存缓存并返回已清除的条目数。 |
🚀 快速开始
1. 克隆并安装
git clone https://github.com/Kaushik2105/mcp-weather.git
cd mcp-weather
npm install2. 构建
npm run build3. 运行测试套件
npm test🔌 连接到 Claude Desktop
将此配置添加到你的 Claude Desktop 配置文件中:
Windows:
%APPDATA%\Claude\claude_desktop_config.jsonmacOS:
~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"kaushik-weather": {
"command": "node",
"args": [
"c:/Workholic/LawSikho/POCs/weather/weather/build/index.js"
]
}
}
}注意:保存配置后,请重启 Claude Desktop。
💬 给 Claude 的示例提示
"使用 Kaushik 的天气工具显示洛杉矶(纬度:34.0522,经度:-118.2437)的官方预报公告"
"佛罗里达州(FL)目前有活跃的天气警报吗?"
"对 Kaushik 的天气 MCP 服务器运行健康检查诊断。"
👨💻 作者
Kaushik Karmakar
GitHub:@Kaushik2105
集成实时证明:Claude AI 聊天
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
Related MCP Connectors
US NWS weather alerts and 5-day forecasts for AI agents. $0.01 per call.
US weather & geo for AI agents: forecasts, alerts, earthquakes, elevation, geocoding. No keys.
US weather & geo for AI agents: forecasts, alerts, earthquakes, elevation, geocoding. No keys.
Get US weather forecasts, active and recent alerts, and current observations.
Related MCP Servers
- FlicenseBqualityDmaintenanceProvides real-time US weather alerts and forecasts by integrating with the National Weather Service API. It enables AI assistants to fetch state-specific alerts and detailed local forecasts using geographic coordinates.21-
- FlicenseNot gradedqualityDmaintenanceProvides real-time weather alerts and forecasts from the National Weather Service for US locations, integrating with AI assistants via the Model Control Protocol.-
- FlicenseNot gradedqualityDmaintenanceProvides real-time weather alerts and forecasts for US locations by integrating with the National Weather Service API. Supports both server and client interactions with optional LLM summarization.-
- AlicenseNot gradedqualityDmaintenanceProvides weather forecasts and alerts for US locations via the National Weather Service API, enabling AI assistants to deliver real-time weather information.ISC