Weather MCP Server
Provides real-time weather forecasts and alerts for US locations using the National Weather Service API, allowing users to query weather alerts by state and forecasts by coordinates.
README
Weather MCP Server
A Model Context Protocol (MCP) server that provides real-time weather data and alerts for Claude for Desktop and other MCP clients. This server integrates with the US National Weather Service API to deliver accurate weather forecasts and severe weather alerts.
Table of contents
- Weather MCP Server
Introduction
Many language models like Claude lack access to real-time data such as weather forecasts and severe weather alerts. This MCP server solves that problem by providing a bridge between Claude for Desktop and the US National Weather Service API.
The server exposes two powerful tools:
- Weather Alerts: Get active severe weather alerts for any US state
- Weather Forecasts: Get detailed weather forecasts for any US location using coordinates
Built with TypeScript and the official MCP SDK, this server follows the Model Context Protocol specification and integrates seamlessly with Claude for Desktop and other MCP-compatible clients.
Features
- 🌤️ Real-time Weather Data: Access current weather forecasts and alerts
- 🚨 Severe Weather Alerts: Get active weather alerts by state
- 📍 Location-based Forecasts: Get detailed forecasts using latitude/longitude coordinates
- 🔧 MCP Compliant: Built using the official Model Context Protocol SDK
- 🚀 Zero Configuration: No API keys required - uses free NWS API
- 📦 Easy Installation: Simple npm/pnpm installation process
- 🛡️ Error Handling: Robust error handling for network issues and invalid inputs
- 🎯 TypeScript: Full TypeScript support with type safety
Installation
Prerequisites
- Node.js 18+
- pnpm (recommended) or npm
- TypeScript 5.0+
Installation Steps
-
Clone the repository:
git clone <repository-url> cd weather -
Install dependencies:
pnpm install -
Build the project:
pnpm build -
Test the server:
pnpm start
You should see: Weather MCP Server running on stdio
Quick start
After installation, the server is ready to use with Claude for Desktop:
-
Configure Claude for Desktop:
macOS: Open the configuration file:
code ~/Library/Application\ Support/Claude/claude_desktop_config.jsonWindows: Open the configuration file:
code "%APPDATA%\Claude\claude_desktop_config.json"Add this configuration to your
claude_desktop_config.json:{ "mcpServers": { "weather": { "command": "node", "args": ["/path/to/weather/build/index.js"], "env": {} } } }Note: Replace
/path/to/weather/build/index.jswith the actual absolute path to your weather server build file. -
Restart Claude for Desktop
-
Test the tools:
- Ask Claude: "What are the weather alerts in California?"
- Ask Claude: "What's the weather forecast for coordinates 40.7128, -74.0060?"
For Client Developers
If you're building your own MCP client, check out the MCP Quickstart for Client Developers to learn how to integrate with this weather server and other MCP servers.
Usage
Available Tools
get-alerts
Get weather alerts for a specific US state.
Parameters:
state(string): Two-letter state code (e.g., "CA", "NY", "TX")
Example:
{
"name": "get-alerts",
"kwargs": {
"state": "CA"
}
}
get-forecast
Get weather forecast for a specific location using coordinates.
Parameters:
latitude(number): Latitude coordinate (-90 to 90)longitude(number): Longitude coordinate (-180 to 180)
Example:
{
"name": "get-forecast",
"kwargs": {
"latitude": 40.7128,
"longitude": -74.0060
}
}
Sample Outputs
Weather Alerts:
Active alerts for CA:
Event: Severe Thunderstorm Warning
Area: Los Angeles County
Severity: Severe
Status: Actual
Headline: Severe Thunderstorm Warning issued for Los Angeles County
---
Weather Forecast:
Forecast for 40.7128, -74.0060:
Tonight:
Temperature: 45°F
Wind: 10 mph NW
Mostly clear with a low around 45°F
---
Tomorrow:
Temperature: 62°F
Wind: 15 mph SW
Sunny with a high near 62°F
---
Configuration
Claude for Desktop Configuration
The server can be configured in Claude for Desktop's configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"weather": {
"command": "node",
"args": ["/absolute/path/to/weather/build/index.js"],
"env": {}
}
}
}
Environment Variables
No environment variables are required. The server uses the free US National Weather Service API which doesn't require authentication.
API Reference
National Weather Service API
This server integrates with the US National Weather Service API:
- Base URL:
https://api.weather.gov - Authentication: None required
- Rate Limits: None specified
- Coverage: United States only
Server Endpoints
The server exposes two MCP tools that internally call the NWS API:
- Alerts Endpoint:
/alerts?area={state} - Points Endpoint:
/points/{lat},{lon} - Forecast Endpoint: Dynamically retrieved from points response
Known issues and limitations
- US Coverage Only: The National Weather Service API only covers the United States
- Coordinate Precision: Coordinates are rounded to 4 decimal places for API compatibility
- Network Dependency: Requires internet connection to access weather data
- API Reliability: Depends on the NWS API availability and response times
Getting help
If you encounter issues:
- Check the logs: The server outputs error messages to stderr
- Verify coordinates: Ensure coordinates are within valid ranges
- Test connectivity: Verify internet connection and NWS API availability
- Check configuration: Ensure Claude for Desktop configuration is correct
For bugs or feature requests, please open an issue on the project repository.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
Development Setup
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes
- Build and test:
pnpm build && pnpm start - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
Original Author and License
This example is based on the code explained in MCP Quickstart (github), whose license is CC-BY-4.0. The completed code examples are also hosted in this repo, whose license is MIT (Copyright (c) 2025 Model Context Protocol). So I've chosen the MIT license for this repo.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Model Context Protocol: For providing the excellent SDK and specification
- US National Weather Service: For providing free, reliable weather data
- Claude for Desktop: For implementing MCP client support
- TypeScript Team: For the excellent type system and tooling
- pnpm: For fast, efficient package management
Author: Mohamed Lakssir (thejokers69)
Version: 1.0.0
Last Updated: January 2025
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。