Weather-Prediction MCP Server
Provides real-time weather data, forecasts, alerts, and travel recommendations for US locations using the National Weather Service API, enabling agents to answer weather-related queries.
README
Day 3 Homework: Weather-Prediction MCP Server
A FastMCP server that exposes weather-forecast tools over the Model Context Protocol, designed to be consumed by a Databricks Agent Bricks agent.
Architecture
Agent Bricks agent --(MCP tool calls)--> weather_mcp_server.py --(HTTP)--> NWS API (free, no key)
|
+--> weather_broker.py (adapter: all HTTP/parsing logic)
MCP Tools Exposed
| Tool | Description |
|---|---|
get_current_weather(location) |
Real-time temperature, humidity, wind, conditions from nearest NWS station |
get_forecast(location, days) |
Multi-day forecast (up to 7 days) with temp, wind, precip chance, conditions |
get_weather_alerts(location) |
Active warnings, watches, and advisories for the location |
get_travel_recommendation(location, days) |
Derived recommendations with threshold logic (umbrella, jacket, heat, outdoors) |
Weather API
- API: National Weather Service (NWS) — https://www.weather.gov/documentation/services-web-api
- Auth: None required (free, public US government API)
- Coverage: United States only
- Geocoding: Nominatim/OpenStreetMap (free, no key) for resolving city names to coordinates
Files
| File | Role |
|---|---|
weather_mcp_server.py |
FastMCP server with @mcp.tool decorators (thin wrappers) |
weather_broker.py |
Adapter module — all HTTP calls, parsing, and recommendation logic |
lakebase.py |
Lakebase connection helper (same pattern as Day 2/3, for extensibility) |
app.yaml |
Databricks App configuration |
requirements.txt |
Python dependencies |
Secrets Required in Databricks
| Secret Scope | Secret Key | Value | Required For |
|---|---|---|---|
database |
lakebase-url |
Base64-encoded Postgres connection URL | Lakebase (optional, for future use) |
Note: The NWS API requires NO API key. No weather-related secrets needed.
Deploy as Databricks App
- Upload this entire folder (
day3-homework-mcpserver-weather/) to your Databricks workspace - Create a new Databricks App pointing to this folder
- The app will start via
python weather_mcp_server.py(as defined inapp.yaml) - Register the app URL as an external MCP server in Agent Bricks
Register as External MCP in Agent Bricks
- Go to your Databricks workspace → Agent Bricks
- Add a new external MCP tool connection
- Set the URL to your deployed app's endpoint (e.g.
https://<your-app-url>/mcp) - The 4 tools will be auto-discovered by the agent
Suggested Agent System Prompt
You are a weather assistant that helps users understand weather conditions
and make plans based on forecasts. You have access to real-time weather
data for US locations via the National Weather Service.
Rules:
- ALWAYS use the weather tools to get data. NEVER guess or hallucinate weather information.
- Use get_current_weather() for "what's the weather now?" questions.
- Use get_forecast() for "what will the weather be like?" questions.
- Use get_weather_alerts() when users ask about severe weather or safety.
- Use get_travel_recommendation() for planning questions ("should I bring an umbrella?", "is it a good day for hiking?").
- If a location cannot be resolved, ask the user to clarify with "City, State" format.
- Only US locations are supported. If asked about international locations, explain this limitation.
- If the API returns an error, tell the user honestly rather than making up data.
- When presenting forecasts, summarize the key points rather than dumping raw data.
Local Development
pip install -r requirements.txt
python weather_mcp_server.py
# Server starts on http://0.0.0.0:8000
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.