Weather MCP 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 MCP Serverget the forecast for New York City"
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 MCP Server
A Model Context Protocol (MCP) server that provides weather forecasts and alerts using the National Weather Service API.
Built following the official Model Context Protocol server development guide
Quick Start (Mac/Linux)
1. Clone and Setup
# Clone the repository to your preferred location
git clone <repository-url> ~/weather-mcp
cd ~/weather-mcp
# Check the project structure
ls -la
# You should see: main.py, weather.py, pyproject.toml, README.md, etc.2. Configure MCP Client
Add this configuration to your MCP client (e.g., Gemini CLI, Claude Desktop, etc.):
{
"mcpServers": {
"weather": {
"command": "uv",
"args": [
"--directory",
"~/weather-mcp",
"run",
"weather.py"
]
}
}
}Important: Replace ~/weather-mcp with the actual path where you cloned the repository. For example:
If you cloned to your home directory:
"/home/yourusername/weather-mcp"If you cloned to a projects folder:
"/home/yourusername/projects/weather-mcp"
3. Monitor Server Activity
The server logs all activity to help you understand what's happening:
# Navigate to your cloned repository
cd ~/weather-mcp
# Watch server logs in real-time
tail -f weather_mcp.logKeep this terminal open while using the MCP server to see real-time logs of weather requests, API calls, and any errors.
Related MCP server: Weather MCP Server
How It Works
This MCP server acts as a bridge between your AI client and the National Weather Service API:
Your AI client sends requests to the MCP server via stdio
The MCP server processes requests and makes API calls to weather.gov
Weather data is returned to your AI client in a structured format
All activity is logged to
weather_mcp.logfor debugging and monitoring
Features
Weather Forecasts: Get detailed weather forecasts for any location using latitude/longitude coordinates
Weather Alerts: Retrieve active weather alerts for any US state
Server Information: Get details about the server configuration and capabilities
Comprehensive Logging: Built-in logging to both console and file with progress reporting
Development Setup
Prerequisites
Python 3.11+ installed
uvpackage manager (install uv)
Local Development
# 1. Clone the repository (if not already done)
git clone <repository-url> ~/weather-mcp-dev
cd ~/weather-mcp-dev
# 2. Install dependencies
uv sync
# 3. Test the server locally
uv run python weather.py
# 4. In another terminal, monitor logs
tail -f weather_mcp.logMaking Changes
Edit the code: Modify
weather.pyor other files as neededTest your changes: Run
uv run python weather.pyto test locallyCheck logs: Monitor
weather_mcp.logfor any issuesUpdate your MCP client: Restart your MCP client to pick up changes
Project Structure
weather-mcp/
├── weather.py # Main MCP server implementation
├── main.py # Alternative entry point
├── pyproject.toml # Project configuration and dependencies
├── weather_mcp.log # Server logs (created when running)
├── LOGGING.md # Detailed logging documentation
└── README.md # This fileTesting Tools
Once the server is running in your MCP client, you can test these tools:
get_forecast(latitude: float, longitude: float)
Get a detailed weather forecast for a specific location.
Example:
get_forecast(40.7128, -74.0060) # New York Cityget_alerts(state: str)
Get active weather alerts for a US state (2-letter state code).
Example:
get_alerts("CA") # California alertsserver_info()
Get information about the server configuration and capabilities.
Configuration Details
The server uses the National Weather Service API with these settings:
User-Agent:
weather-app/1.0Base URL:
https://api.weather.govTimeout: 30 seconds
Authentication: None required (public API)
Troubleshooting
Common Issues
Server won't start: Check that
uvis installed and the path in your MCP config is correctNo weather data: Ensure you have internet connectivity and the weather.gov API is accessible
MCP client can't connect: Verify the stdio connection and server logs
Debugging Steps
# Check if uv is installed
uv --version
# Test the server directly
cd ~/weather-mcp
uv run python weather.py
# Check recent logs
tail -20 weather_mcp.log
# Test with verbose logging
export MCP_LOG_LEVEL=debug
uv run python weather.pyRequirements
Python 3.11+
httpx>=0.28.1
mcp[cli]>=1.13.1
Contributing
Fork the repository
Create a feature branch:
git checkout -b feature-nameMake your changes and test locally
Check logs for any issues:
tail -f weather_mcp.logCommit and push:
git commit -m "Description" && git pushSubmit a pull request
API Reference
This server uses the National Weather Service API:
Base URL: https://api.weather.gov
Documentation: https://www.weather.gov/documentation/services-web-api
Rate Limits: None specified, but please be respectful
Authentication: None required
Available Tools
3 toolsget_alertsB
Get weather alerts for a US state.
Args:
state: Two-letter US state code (e.g. CA, NY)
| Name | Required | Description | Default |
|---|---|---|---|
| state | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure. It doesn't mention return format, pagination, whether alerts are current or historical, severity levels, or any rate limits or auth requirements. For a read-type tool the lack of annotations leaves significant gaps.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Extremely concise and well-scoped. The description is two lines with an args docstring for the single parameter. Every word is functional with zero waste.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
An output schema exists, which reduces the burden for explaining return values. However, with 0% schema description coverage, 1 single param (already covered in the args), no annotations, and no behavioral details (alert types, severity, expiration, update frequency), the description is minimal. For a weather alert tool, agents would benefit from knowing what constitutes an alert return vs. a no-alert return.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The single parameter 'state' is described in the argument docstring as a two-letter US state code with examples (CA, NY), which adds meaning beyond the bare schema. However, it doesn't specify case sensitivity, whether territories are included (e.g., DC, PR), or what happens for invalid state codes. The examples help but full semantics aren't covered.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool gets weather alerts for a US state, with a specific verb ('get') and resource ('weather alerts') and a geographic scope ('US state'). It distinguishes from the sibling tool 'get_forecast' by the resource type, though it doesn't explicitly name the sibling.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage context ('for a US state') but provides no when-to-use guidance, no exclusions, and no comparison to the sibling get_forecast tool. The intent is reasonably clear but the agent doesn't know when alerts vs forecast is more appropriate.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_forecastC
Get weather forecast for a location.
Args:
latitude: Latitude of the location
longitude: Longitude of the location
| Name | Required | Description | Default |
|---|---|---|---|
| latitude | Yes | ||
| longitude | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It doesn't disclose how many days of forecast are returned, data freshness, caching behavior, rate limits, or what units (Celsius/Fahrenheit) are used. The description only restates the parameters without adding behavioral context.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is brief but under-specified rather than appropriately concise. The Args section is mostly unnecessary given the input schema repeats the same parameter names and types. The single opening sentence is useful, but the parameter documentation is redundant with the schema.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
There is an output schema present, which helps, but the description still fails to communicate what the forecast contains or how comprehensive it is. For a tool that returns weather data, the agent has no sense of forecast length, granularity, or data fields without inspecting the output schema. The description is minimally sufficient for a basic 2-param lookup tool but leaves key context undocumented.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, meaning the description must compensate. The description merely restates that latitude/longitude are coordinates of the location, which adds marginal value over the schema. It doesn't explain valid ranges (e.g., -90 to 90, -180 to 180), precision requirements, or format expectations. Minimal semantic addition.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states 'Get weather forecast for a location' with a clear verb+resource. It doesn't distinguish from its sibling tool get_alerts, and 'forecast' vs 'alerts' distinction is implied but not explicit. The purpose is clear but missing scope details (time range, units).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance on when to use this tool vs get_alerts. The description doesn't explain the distinction between getting a forecast and getting alerts, nor does it mention any special circumstances (e.g., use get_alerts for severe weather warnings). No when/when-not guidance is provided.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
server_infoB
Get information about the current Weather MCP server configuration.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It indicates a read operation ('Get information'), which suggests non-destructive behavior, but doesn't specify details like authentication needs, rate limits, or what specific server info is returned. This is a minimal but adequate disclosure for a simple tool.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, clear sentence that directly states the tool's purpose without any wasted words. It is front-loaded and efficiently communicates the essential information, making it highly concise and well-structured.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's simplicity (0 parameters, no output schema, no annotations), the description is complete enough for basic understanding. However, it lacks details on the return format or specific server configuration aspects, which could be helpful for an agent, keeping it at a minimum viable level.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The tool has 0 parameters, and the schema description coverage is 100%, so there are no parameters to document. The description doesn't need to add parameter semantics, earning a high baseline score as it avoids redundancy and is complete in this regard.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('Get information') and target ('current Weather MCP server configuration'), making the purpose unambiguous. It doesn't distinguish from sibling tools like 'get_alerts' or 'get_forecast', which would require explicit comparison, so it falls short of a perfect score.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives like 'get_alerts' or 'get_forecast'. It implies usage for server configuration info but lacks explicit when/when-not instructions or prerequisites, leaving the agent to infer context.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
3 tool updates
- First observed
get_alerts - First observed
get_forecast - First observed
server_info
TDQS
Scored across 3 tools
Each tool has a clearly distinct purpose: get_alerts retrieves alerts for a US state, get_forecast provides forecasts for geographic coordinates, and server_info returns server configuration details. There is no overlap in functionality, making tool selection straightforward for an agent.
All tool names follow a consistent verb_noun pattern with snake_case (get_alerts, get_forecast, server_info). The naming is predictable and readable, with no deviations in style or convention across the set.
With only 3 tools, the server feels thin for a weather domain, as it lacks operations like historical data, radar imagery, or air quality. While the tools cover basic alerts and forecasts, the scope is limited, potentially requiring agents to work around missing functionality.
The tool set has significant gaps for a weather server. It provides alerts and forecasts but lacks update or delete operations, historical data access, or support for multiple locations. This incompleteness may lead to agent failures when more comprehensive weather data is needed.
Maintenance
Related MCP Connectors
US weather for AI agents: active NWS alerts by state, 5-period forecasts by lat/lon. Paid 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 alerts, and current observations.
Related MCP Servers
- FlicenseBqualityDmaintenanceProvides weather forecast and alert information for US locations using the National Weather Service API. Enables users to get detailed weather forecasts by coordinates and retrieve active weather alerts by state.2-
- AlicenseNot gradedqualityDmaintenanceProvides weather forecasts and alerts for US locations using the National Weather Service API. Supports getting detailed forecasts by coordinates and active weather alerts by state code.85 npmGPL 3.0
- FlicenseBqualityCmaintenanceProvides weather forecast and alert information from the National Weather Service API, allowing users to query weather forecasts by coordinates and check weather alerts by state.2-
- FlicenseBqualityDmaintenanceProvides real-time weather forecasts and alerts for US locations using the National Weather Service API. Supports querying forecasts by coordinates and retrieving active weather alerts by state.2-