WeatherMCP
WeatherMCP
This project is an MCP server built as a hands-on exercise. It provides weather data and alerts from the US National Weather Service (NWS) via a simple API using the FastMCP framework.
Features
Weather Alerts: Get active weather alerts for any US state.
Forecast: Retrieve weather forecasts for a specific latitude and longitude.
Requirements
Python 3.8+
uv (for dependency management and running)
Installation
Install dependencies using uv:
uv pip install -r requirements.txtOr, if you use
pyproject.toml:uv pip install -r pyproject.toml(Optional) Create a virtual environment:
uv venv .venv source .venv/bin/activate
Running the MCP Server
To start the server using uv:
uv pip install -e . # if you want to install as editable, or just ensure dependencies are installed
uv python weather.pyThe server will start and listen for MCP requests via stdio.
Available Tools
1. get_alerts(state: str)
Description: Get active weather alerts for a US state.
Argument:
state— Two-letter US state code (e.g.,CA,NY).Returns: Formatted string of current alerts or a message if none are found.
2. get_forecast(latitude: float, longitude: float)
Description: Get weather forecast for a specific location.
Arguments:
latitude— Latitude of the location (float)longitude— Longitude of the location (float)
Returns: Formatted string with the next 5 forecast periods.
Notes
This project is for educational and hands-on purposes.
Data is sourced from the National Weather Service API.
Feel free to extend or modify the project for your own experiments!
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/pragaurav44/WeatherMCP'
If you have feedback or need assistance with the MCP directory API, please join our Discord server