weather-mcp-server
Provides current weather, forecasts, trend predictions, and personalized recommendations for any location using the Open-Meteo API.
README
Weather MCP Server
A Model Context Protocol (MCP) server that provides weather data and predictions using the Open-Meteo API.
Features
- Current Weather - Get real-time weather conditions for any location
- Weather Forecast - 7-day detailed forecast with temperatures, precipitation, and wind
- Weather Predictions - Analyze trends and provide natural language predictions
- Smart Recommendations - Personalized advice based on weather conditions
Architecture
The project follows a clean separation of concerns:
weather_broker.py- Adapter module that handles all HTTP/API interactions with Open-Meteoweather_mcp_server.py- FastMCP server that exposes weather capabilities as MCP toolsapp.yaml- Databricks App configuration for deployment- Clean data flow: API → Broker → Dictionaries → MCP Tools → Formatted responses
Installation
pip install -r requirements.txt
Usage
Running the Server
Local Development
python weather_mcp_server.py
Databricks App Deployment
# Deploy as a Databricks App
databricks apps deploy weather-mcp-server \
--source-code-path /Workspace/Users/<your-email>/weather-mcp-agent
# Check app status
databricks apps get weather-mcp-server
Available Tools
1. get_current_weather(location: str)
Get current weather conditions for a location.
get_current_weather("San Francisco")
2. get_forecast(location: str, days: int = 7)
Get weather forecast for up to 16 days.
get_forecast("London, UK", days=5)
3. predict_weather_trend(location: str)
Analyze weather trends and provide predictions.
predict_weather_trend("Tokyo")
4. get_weather_recommendation(location: str)
Get personalized recommendations based on current and upcoming weather.
get_weather_recommendation("New York")
Data Source
Weather data is provided by Open-Meteo, a free weather API that requires no authentication.
Example Outputs
Current Weather
Current weather in San Francisco, United States:
Condition: Partly cloudy
Temperature: 18°C (feels like 17°C)
Humidity: 65%
Wind: 15 km/h from 270°
Precipitation: 0 mm
Weather Prediction
Weather Analysis for London, United Kingdom:
Current Conditions: Overcast at 12°C
7-Day Outlook:
The weather is cooling down over the next week, with temperatures averaging 10.5°C.
You can expect frequent rain, with total precipitation around 45.2 mm.
Recommendations
Weather Recommendations for Tokyo, Japan:
🧥 It's quite cold. A jacket and warm clothing recommended.
☔ High chance of rain in the next few days. Keep an umbrella handy!
✨ Great conditions for outdoor activities!
Prediction & Recommendation Thresholds
The server uses the following thresholds for weather recommendations:
Temperature Recommendations
- Cold (< 10°C): Jacket and warm clothing recommended
- Cool (10-15°C): Light jacket suggested
- Comfortable (15-25°C): No special clothing needed
- Warm (> 25°C): Light, breathable clothing suggested
Precipitation Recommendations
- High chance (> 60% probability): Umbrella strongly recommended
- Moderate chance (30-60% probability): Consider bringing umbrella
- Low chance (< 30% probability): Umbrella not needed
Wind Conditions
- Strong wind (> 30 km/h): Outdoor activity warnings
- Moderate wind (15-30 km/h): Normal conditions
- Light wind (< 15 km/h): Ideal outdoor conditions
Technical Details
- Uses FastMCP for MCP server implementation
- HTTP requests handled via httpx with 30-second timeout
- Geocoding resolves location names to coordinates
- WMO weather codes interpreted to human-readable conditions
- Temperature in Celsius, wind speed in km/h
- Supports any location worldwide
- Request middleware with context tracking (host, port, user identity)
- Deployable as a Databricks App
Error Handling
The server gracefully handles:
- Invalid location names
- API connection issues
- Invalid parameter ranges
- Missing data
Project Structure
weather-mcp-agent/
├── weather_mcp_server.py # Main FastMCP server
├── weather_broker.py # Weather API adapter
├── app.yaml # Databricks App configuration
├── requirements.txt # Python dependencies
├── setup_secrets.py # Secret management helper
├── DEPLOYMENT_FIX.md # Deployment troubleshooting
└── README.md # This file
Configuration
Environment Variables
DATABRICKS_APP_PORT- Server port (default: 8000)DATABRICKS_APP_HOST- Server host (default: 0.0.0.0)
Secrets Management
Use setup_secrets.py to securely store credentials (lakebase url) in Databricks Secrets instead of hardcoding them in your configuration files.
Dependencies
fastmcp>=0.2.0- FastMCP server frameworkhttpx>=0.27.0- HTTP client for API requeststyping_extensions>=4.12.0- Type hints support
Development Notes
- The server runs on host
0.0.0.0and port8000by default - FastMCP uses stdio transport for Model Context Protocol communication
- All weather data comes from the free Open-Meteo API (no API key required)
- Request middleware captures context using Python's
contextvarsfor thread-safe operation
Transcript of agent interactions
Query 1: Recommendation Logic
- Prompt: "Should I bring a jacket to Austin this weekend?"
- Tool Called:
predict_umbrella_needed(location="Austin, TX", target_date_offset=1) - Response: "Based on the weather forecast, it's unlikely that you'll need a jacket in Austin this weekend. The temperatures are expected to be quite warm, ranging from 25.6°C to 40.1°C, with minimal chances of precipitation. You may want to consider packing light, breathable clothing and sunscreen instead."
Query 2: Forecast
- Prompt: "What does the weather forecast look like for Austin, TX?"
- Tool Called:
get_forecast(location="Austin, TX", days=3) - Response: "The weather forecast for Austin, TX from August 10th to August 12th is as follows:\n August 10th: Overcast with temperatures ranging from 26.5°C to 37.3°C and an 8% chance of precipitation.\n August 11th: Overcast with temperatures ranging from 26.1°C to 38.5°C and a 6% chance of precipitation.\n August 12th: Overcast with temperatures ranging from 25.6°C to 40.1°C and a 0% chance of precipitation.\n It's expected to be quite warm and dry, with minimal chances of rain during this period."
Query 3: Current Weather
- Prompt: "What is the current weather in NYC?"
- Tool Called:
get_current_weather(location="New York City") - Response: "The current weather in NYC is a clear sky with a temperature of 23.8°C (feeling like 26.1°C), humidity at 77%, and a wind speed of 8.9 km/h from the northwest. There is no precipitation at the moment. Please note that this information was last updated on August 10th, 2026, at 3:45 AM, so it's recommended to check for updates for the most current weather conditions."
Query 4: Ask to clarify ambiguous location
- Prompt: "can you share the current weather for sjkdfshjdff?"
- Response: "I couldn't find any information on a location called "sjkdfshjdff". It's possible that it's a misspelling or a non-existent location. If you could provide a valid city or location name, I'd be happy to try and help you with the current weather."
Troubleshooting
If you encounter deployment issues, see DEPLOYMENT_FIX.md for common problems and solutions.
License
MIT License
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.
Neon Database
MCP server for interacting with Neon Management API and databases
E2B
Using MCP to run code via e2b.
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.