Weather MCP Server
The server is based on code samples from the MCP Quickstart Resources repository on GitHub, with references to the specific repository for the original implementation.
Implements a Model Context Protocol server in Python, with specific requirements for Python 3.8 or higher, enabling weather data retrieval functionality.
Click on "Install 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 Serverwhat'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 MCP Server
A Model Context Protocol (MCP) server that provides weather information and alerts using the National Weather Service (NWS) API. This server offers tools for retrieving weather forecasts and active weather alerts for locations in the United States.
About This Project
This project is based on the Model Context Protocol (MCP) Getting Started Tutorial for server developers. The tutorial provides a comprehensive guide for building MCP servers and integrating them with clients like Claude for Desktop.
The original code sample for this weather server can be found in the MCP Quickstart Resources repository.
Related MCP server: WeatherMCP
Features
Weather Alerts: Get active weather alerts for any US state using two-letter state codes
Weather Forecasts: Retrieve detailed weather forecasts for specific coordinates
Real-time Data: Uses the official National Weather Service API for accurate, up-to-date information
Easy Integration: Simple MCP server that can be integrated with any MCP-compatible client
Installation
Prerequisites
Python 3.8 or higher
uvpackage manager (recommended) orpip
Setup
Clone the repository:
git clone https://github.com/agentventure/mcp_server_python_getting_started.git
cd mcp_server_python_getting_startedInstall dependencies using
uv:
uv syncOr using pip:
pip install -r requirements.txtUsage
Running the Server
Start the MCP server:
uv run weather.pyThe server will start and communicate via stdio, ready to handle requests from MCP clients.
Available Tools
1. Get Weather Alerts (get_alerts)
Retrieve active weather alerts for a US state.
Parameters:
state(string): Two-letter US state code (e.g., "CA", "NY", "TX")
Example:
# Get alerts for California
alerts = await get_alerts("CA")Response Format:
Event: Severe Thunderstorm Warning
Area: Northern California
Severity: Severe
Description: Severe thunderstorm warning in effect...
Instructions: Take shelter immediately...
---
Event: Flood Watch
Area: Central Valley
Severity: Moderate
Description: Flood watch in effect...
Instructions: Monitor weather conditions...2. Get Weather Forecast (get_forecast)
Get detailed weather forecast for a specific location.
Parameters:
latitude(float): Latitude coordinate of the locationlongitude(float): Longitude coordinate of the location
Example:
# Get forecast for San Francisco (37.7749, -122.4194)
forecast = await get_forecast(37.7749, -122.4194)Response Format:
Tonight:
Temperature: 55°F
Wind: 10 mph NW
Forecast: Clear skies with light winds. Low around 55.
---
Tomorrow:
Temperature: 68°F
Wind: 15 mph W
Forecast: Sunny with increasing clouds in the afternoon. High near 68.
---
Tomorrow Night:
Temperature: 52°F
Wind: 8 mph NW
Forecast: Partly cloudy with light winds. Low around 52.API Information
This server uses the National Weather Service API, which provides:
No API Key Required: Free access to weather data
Real-time Updates: Data is updated frequently throughout the day
Comprehensive Coverage: Covers all US states and territories
Reliable Service: Official government weather service
Data Sources
Alerts: Active weather alerts from the NWS
Forecasts: Detailed weather forecasts including temperature, wind, and conditions
Geographic Data: Point-based weather information for any US location
Error Handling
The server includes robust error handling for:
Network connectivity issues
Invalid coordinates or state codes
API service unavailability
Timeout conditions
When errors occur, the server returns informative error messages to help with debugging.
Development
Project Structure
weather/
├── weather.py # Main MCP server implementation
├── main.py # Entry point for running the server
├── pyproject.toml # Project configuration and dependencies
├── README.md # This file
└── .gitignore # Git ignore rulesDependencies
mcp: Model Context Protocol server frameworkhttpx: Async HTTP client for API requestsfastmcp: FastMCP server implementation
Adding New Features
To add new weather-related tools:
Create a new async function in
weather.pyDecorate it with
@mcp.tool()Add proper type hints and docstrings
Implement error handling using the existing
make_nws_requesthelper
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is open source and available under the MIT License.
Support
For issues or questions:
Review the MCP documentation at modelcontextprotocol.io
Open an issue in this repository
Note: This server is designed for educational and development purposes. For production use, consider implementing rate limiting and additional error handling based on your specific requirements.
Available Tools
2 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 |
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 mentions that alerts are for a 'US state,' implying geographic limitations, but doesn't describe other behaviors such as error handling, rate limits, authentication needs, or what the return format looks like (e.g., list of alerts, timestamps, severity). For a tool with no annotations, this 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?
The description is front-loaded with the core purpose in the first sentence, followed by a concise parameter explanation. Every sentence adds value without redundancy, and the structure is clear and efficient, making it easy for an agent to parse quickly.
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 low complexity (one parameter, no annotations, no output schema), the description is minimally adequate. It covers the basic purpose and parameter format but lacks details on behavioral traits, error handling, and output structure. Without annotations or an output schema, more context would improve completeness for reliable agent use.
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 description adds meaningful context for the single parameter 'state' by specifying it as a 'Two-letter US state code (e.g. CA, NY),' which clarifies the expected format beyond the schema's basic 'string' type. With 0% schema description coverage and only one parameter, this adequately compensates, though it doesn't cover edge cases like invalid codes.
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's purpose: 'Get weather alerts for a US state.' It specifies the verb ('Get') and resource ('weather alerts') with geographic scope ('US state'). However, it doesn't explicitly differentiate from its sibling tool 'get_forecast' beyond the resource type, which prevents 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_forecast.' It states what the tool does but offers no context about appropriate use cases, prerequisites, or exclusions. The agent must infer usage from the tool name and description alone.
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 |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full burden but offers minimal behavioral context. It doesn't disclose whether this is a read-only operation, what data format is returned, potential rate limits, authentication requirements, or error conditions. The description is functionally basic.
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 appropriately concise with two sentences and an Args section. The purpose is front-loaded, and the parameter explanations are efficiently presented. No unnecessary information is included.
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?
For a tool with no annotations, no output schema, and 2 required parameters, the description is incomplete. It doesn't explain what the forecast returns (temperature, precipitation, timeframe), error handling, data sources, or any behavioral characteristics. The basic purpose and parameter explanation are insufficient for full understanding.
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%, so the schema provides no parameter documentation. The description adds the Args section explaining that latitude and longitude represent the location coordinates, which provides basic semantic meaning. However, it doesn't specify coordinate ranges, units, or format expectations beyond what's obvious from parameter names.
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's purpose with 'Get weather forecast for a location', specifying the verb 'Get' and resource 'weather forecast'. It distinguishes from the sibling 'get_alerts' by focusing on forecasts rather than alerts, though it doesn't explicitly mention this distinction.
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 is provided on when to use this tool versus the sibling 'get_alerts' or other alternatives. The description only states what the tool does without any context about appropriate usage scenarios or exclusions.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
TDQS
The two tools have clearly distinct purposes: get_alerts retrieves alerts for US states, while get_forecast provides forecasts for geographic coordinates. There is no overlap in functionality or ambiguity about which tool to use for each task.
Both tools follow a consistent verb_noun naming pattern (get_alerts, get_forecast) with identical verb usage and snake_case formatting. The naming is perfectly predictable and uniform across the tool set.
With only two tools, this server feels under-scoped for a weather domain. While alerts and forecasts are core functions, there are obvious gaps like current conditions, historical data, or radar imagery that would make the tool set more complete and useful.
The tool set is severely incomplete for a weather server. It lacks basic operations like getting current weather conditions, historical data, or radar information. The two tools provided create dead ends for common agent workflows that require more comprehensive weather data.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
An MCP server for weather information by @kulybaba
An MCP server for weather information by @kulybaba
MCP server for weather with reasoning — umbrella advice, outdoor checks, city comparisons.
OpenWeather MCP — wraps the OpenWeatherMap API (openweathermap.org)
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceAn MCP server that provides weather information like forecasts and alerts for US locations using the National Weather Service API.5
- FlicenseBqualityDmaintenanceAn MCP server providing US National Weather Service data with tools to fetch weather alerts by state and forecasts by coordinates.2
- AlicenseBqualityDmaintenanceMCP server that integrates the National Weather Service API to fetch weather alerts for US states and forecasts for coordinates.2111MIT
- FlicenseBqualityDmaintenanceA Model Context Protocol (MCP) server that provides US weather forecasts and active alerts using the National Weather Service API.2
Appeared in Searches
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/agentventure/mcp_server_python_getting_started'
If you have feedback or need assistance with the MCP directory API, please join our Discord server