weather-mcp-pro
MCP server that exposes real-time weather, forecasts, air quality, and multi-city comparison tools via the OpenWeather API for LLM agents.
README
weather-mcp-pro
An MCP (Model Context Protocol) server that exposes real-time weather, forecast, and air-quality data as tools for LLM agents like Claude. Built on the OpenWeather API.
What is MCP?
MCP is Anthropic's open protocol for connecting LLMs to external tools and data sources through a standard client-server interface. This server exposes 4 tools that Claude (or any MCP client) can call during a conversation.
Tools
| Tool | Description |
|---|---|
get_current_weather |
Current conditions for a location |
get_weather_forecast |
1-5 day forecast |
get_air_quality |
AQI + pollutant breakdown |
compare_weather |
Side-by-side comparison across up to 5 cities |
Architecture
server.py MCP tool definitions — thin, delegates everything
weather_client.py Async API client — geocoding, caching, retries
models.py Pydantic schemas for validated, typed responses
exceptions.py Typed exceptions instead of ad-hoc error dicts
config.py Environment/settings management
The design goal: weather_client.py is fully unit-testable without an MCP
server or a live API key (see tests/), because the tool layer never touches
HTTP directly.
Notably, all API calls use httpx.AsyncClient rather than the synchronous
requests library — a common mistake in async def functions is using a
blocking HTTP client, which stalls the event loop for every other concurrent
request the server is handling.
Setup
Uses uv for dependency management.
git clone https://github.com/AsifMarwat/weather-mcp-pro.git
cd weather-mcp-pro
uv venv
uv pip install -r requirements.txt
cp .env.example .env # add your OpenWeather API key
Get a free API key at openweathermap.org/api.
Run
uv run server.py
Use with Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"weather-mcp-pro": {
"command": "uv",
"args": ["run", "--directory", "/absolute/path/to/weather-mcp-pro", "server.py"]
}
}
}
Example
"What's the weather like in Peshawar right now, and how does it compare to Lahore?"
Claude calls compare_weather(["Peshawar", "Lahore"]) and returns a natural-language
summary built from the structured response.
Tests
uv run pytest tests/ -v
License
MIT
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.