
Weather MCP Server
Creating MCP (Model Context Protocol) weather-related projects involves setting up an MCP server that can fetch and provide weather data.
What is Weather MCP Server?
Weather MCP Server is a project that sets up a Model Context Protocol (MCP) server to fetch and provide weather data from the National Weather Service API.
How to use Weather MCP Server?
To use the Weather MCP Server, install the required dependencies and run the server using the provided command. Configure your MCP client with the necessary settings to communicate with the server.
Key features of Weather MCP Server?
- Fetches active weather alerts for US states.
- Provides short-term weather forecasts based on geographical coordinates.
- Utilizes the MCP framework for seamless integration.
Use cases of Weather MCP Server?
- Monitoring weather alerts for specific states.
- Obtaining weather forecasts for planning outdoor activities.
- Integrating weather data into applications for real-time updates.
FAQ from Weather MCP Server?
- What programming language is used for the Weather MCP Server?
The server is built using Python 3.7 and above.
- How do I install the required dependencies?
You can install the dependencies by running the command:
uv add mcp[cli] httpx requests
.
- Can I run the server on any operating system?
Yes, as long as you have Python and the required libraries installed, you can run the server on any OS.
Weather MCP Server
This MCP server fetches weather data from the National Weather Service API. It provides two tools:
-
get_alerts(state: str)
Returns active weather alerts for a given US state (using its two-letter code). -
get_forecast(latitude: float, longitude: float)
Returns a short-term weather forecast for a specified location.
Requirements
- Python 3.7+
- httpx
- MCP Framework mcp[cli]
so install, run:
uv add mcp[cli] httpx requests
Usage
Run the server with:
uv run weather.py
The server uses standard I/O for communication.
MCP Client Configuration
configuration snippet for your MCP client (config.json
):
{
"mcpServers": {
"weather": {
"command": "C:/path/to/your/uv",
"args": [
"--directory",
"C:/path/to/your/project",
"run",
"weather.py"
]
}
}
}