Weather Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Weather Server what's the forecast for New York City this weekend?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
weather — Enhanced MCP Weather Server
A feature-rich MCP (Model Context Protocol) server that provides comprehensive weather data using the NWS (National Weather Service) public APIs. Includes input validation, error handling, geocoding, and a unique weather comparison feature.
Quick start
Install uv (macOS / Linux):
curl -LsSf https://astral.sh/uv/install.sh | sh
# restart your terminalCreate project, venv and install deps:
uv init weather
cd weather
uv venv
source .venv/bin/activate
uv add "mcp[cli]" httpxRun the server:
uv run main.py
# or
uv run weather.pyRelated MCP server: weather-mcp
Available Tools
The server provides the following MCP tools:
1. get_alerts(state: str)
Get active weather alerts for a US state.
Input: Two-letter US state code (e.g., "CA", "NY", "TX")
Features: Validates state codes, provides detailed alert information
2. get_forecast(latitude: float, longitude: float)
Get detailed weather forecast for a location using coordinates.
Input: Latitude (-90 to 90) and Longitude (-180 to 180)
Features: 10-period forecast (5 days), includes humidity and precipitation probability
3. get_forecast_by_city(city_name: str)
Get weather forecast by city name (no coordinates needed!).
Input: City name (e.g., "San Francisco", "New York", "Chicago")
Features: Automatic geocoding, works with city names
4. get_current_conditions(latitude: float, longitude: float)
Get real-time current weather conditions.
Input: Latitude and Longitude
Features: Temperature, humidity, wind, pressure, visibility, and more
5. compare_weather(location1: str, location2: str)
Compare weather conditions between two locations side-by-side.
Input: Two locations (city names or "lat,lon" format)
Features: Side-by-side comparison, temperature difference analysis, supports both city names and coordinates
Features
✅ Input Validation: Validates state codes and coordinate ranges
✅ Better Error Handling: Specific, helpful error messages
✅ Geocoding Support: Search by city name using Open-Meteo geocoding API
✅ Current Conditions: Real-time weather observations
✅ Enhanced Forecasts: More detailed information including humidity and precipitation
✅ Weather Comparison: Unique feature to compare two locations
✅ Location Detection: Automatically detects and displays city/state names
Files
weather.py— Main MCP server implementation with all toolsmain.py— Entry point that imports and runs the server
Notes
Python 3.11+ required (see
pyproject.toml)NWS Coverage: The NWS API only covers US territories. International locations will not work.
Transport: The server uses stdio transport by default
MCP Clients: Use Claude Desktop,
mcpCLI, or another MCP client to connectGeocoding: City name search uses Open-Meteo's free geocoding API (no API key required)
Example Usage
Once connected to an MCP client, you can use the tools like:
# Get alerts for California
get_alerts("CA")
# Get forecast by city name
get_forecast_by_city("San Francisco")
# Get current conditions
get_current_conditions(37.7749, -122.4194)
# Compare weather between two cities
compare_weather("New York", "Los Angeles")License
Apache License 2.0 — see LICENSE. Replace the placeholder year/name in LICENSE if needed.
Available Tools
5 toolscompare_weatherA
Compare current weather conditions between two locations.
This unique feature allows you to compare weather at two different places side-by-side.
Args:
location1: First location (city name or "lat,lon" format, e.g., "New York" or "40.7128,-74.0060")
location2: Second location (city name or "lat,lon" format, e.g., "Los Angeles" or "34.0522,-118.2437")
Inputs: location1 (required), location2 (required). Returns: result
get_alertsB
Get weather alerts for a US state.
Args:
state: Two-letter US state code (e.g. CA, NY, TX)
Inputs: state (required). Returns: result
get_current_conditionsB
Get current weather conditions for a location.
Args:
latitude: Latitude of the location (-90 to 90)
longitude: Longitude of the location (-180 to 180)
Inputs: latitude (required), longitude (required). Returns: result
get_forecastB
Get weather forecast for a location using coordinates.
Args:
latitude: Latitude of the location (-90 to 90)
longitude: Longitude of the location (-180 to 180)
Inputs: latitude (required), longitude (required). Returns: result
get_forecast_by_cityB
Get weather forecast for a city by name.
Args:
city_name: Name of the city (e.g., "San Francisco", "New York", "Chicago")
Inputs: city_name (required). Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Most tools have distinct purposes, but there is notable overlap between get_forecast and get_forecast_by_city, which both provide forecasts but use different input formats (coordinates vs. city name). This could cause confusion for an agent deciding which to use. The other tools (compare_weather, get_alerts, get_current_conditions) are clearly distinct.
The naming follows a consistent verb_noun pattern (e.g., get_forecast, get_alerts, get_current_conditions), with all tools using snake_case. The only minor deviation is compare_weather, which uses a verb_noun format but starts with 'compare' instead of 'get', which is reasonable given its distinct function.
With 5 tools, the count is well-scoped for a weather server, covering key functions like current conditions, forecasts, alerts, and comparisons. Each tool serves a clear purpose without being overly sparse or bloated, fitting typical expectations for such a domain.
The tool set covers core weather operations effectively, including current conditions, forecasts, alerts, and comparisons. A minor gap is the lack of historical weather data or more specialized features like air quality, but agents can work around this for most common use cases without significant failures.
Maintenance
Related MCP Connectors
Get US weather forecasts, active and recent alerts, and current observations.
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.
Related MCP Servers
- AlicenseBqualityCmaintenanceProvides weather alerts and forecasts for US locations using the National Weather Service API.2ISC
- AlicenseNot gradedqualityDmaintenanceProvides US weather alerts and forecasts via the National Weather Service API.ISC
- AlicenseNot gradedqualityDmaintenanceProvides weather alerts and forecasts for US locations using the National Weather Service API.GPL 3.0
- FlicenseBqualityDmaintenanceProvides weather forecasts and active alerts from the US National Weather Service API for US locations.2-