MCP server providing US weather forecasts and alerts using the National Weather Service API
Weather MCP Server
A Model Context Protocol (MCP) server that provides weather information using the National Weather Service (NWS) API.
Features
- Get weather forecasts for any US location
- Check current weather conditions
- View active weather alerts by state
- Built-in caching to reduce API calls
Installation
1. Clone the repository
git clone https://github.com/YOUR_USERNAME/weather-mcp-server.git
cd weather-mcp-server
2. Create a virtual environment and install
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -e .
This installs the package and all its dependencies (mcp, httpx) automatically.
Configuration for Claude Desktop
macOS
Edit ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"weather": {
"command": "/ABSOLUTE/PATH/TO/YOUR/weather-mcp-server/venv/bin/python",
"args": ["-m", "weather.main"],
"cwd": "/ABSOLUTE/PATH/TO/YOUR/weather-mcp-server"
}
}
}
Windows
Edit %APPDATA%\Claude\claude_desktop_config.json:
{
"mcpServers": {
"weather": {
"command": "C:\\ABSOLUTE\\PATH\\TO\\YOUR\\weather-mcp-server\\venv\\Scripts\\python.exe",
"args": ["-m", "weather.main"],
"cwd": "C:\\ABSOLUTE\\PATH\\TO\\YOUR\\weather-mcp-server"
}
}
}
Important: Replace /ABSOLUTE/PATH/TO/YOUR/ with your actual path. You can get it by running pwd (macOS/Linux) or cd (Windows) in the project directory.
After configuration
- Save the config file
- Completely quit and restart Claude Desktop (Cmd+Q on macOS, not just close window)
- In Claude connectors you can see your tools.
Available Tools
- get_forecast(latitude, longitude) - Get 5-period weather forecast
- get_current_conditions(latitude, longitude) - Get current weather conditions
- get_alerts(state) - Get active weather alerts for a US state (use 2-letter code like "CA", "NY")
- get_metrics() - View server usage statistics
Usage Examples
Once configured in Claude Desktop, you can ask:
- "What's the weather forecast for New York City?"
- "Are there any weather alerts in California?"
- "What are the current conditions in Chicago?"
Development
Running tests
# Test the server manually
python -m weather.main
The server should output:
2025-12-16 14:51:11,260 INFO Starting weather MCP server
=== MCP server running ===
Press Ctrl+C to stop.
Troubleshooting
Server not appearing in Claude
- Check the config file path is correct for your OS
- Use absolute paths in the config (not relative paths or ~)
- Restart Claude Desktop completely (Quit, don't just close)
- Check logs (macOS:
~/Library/Logs/Claude/mcp*.log)
ModuleNotFoundError
Make sure you:
- Activated your virtual environment:
source venv/bin/activate - Installed the package:
pip install -e .
Connection issues
The server uses the National Weather Service API which:
- Only works for US locations
- May have occasional downtime
- Has built-in caching (60 second TTL)
License
MIT
Contributing
Pull requests are welcome! Please feel free to submit issues or improvements.