weather-mcp-server
README.md
Weather Prediction MCP Server + Agent
A weather-focused Model Context Protocol (MCP) server built with FastMCP and integrated with a Databricks Agent Bricks agent.
The project exposes weather tools that allow an AI agent to retrieve current weather, obtain forecasts, and make simple weather-based recommendations.
Project Overview
This project follows the Day 3 MCP architecture demonstrated in the classroom reference project.
Instead of a financial trading MCP server, this project provides weather capabilities using the free National Weather Service (NWS) API.
Project Structure
weather-mcp-server/
│
├── mcp_server/
│ ├── weather_mcp_server.py
│ └── weather_adapter.py
│
├── agent/
│ ├── system_prompt.txt
│ └── tool_list.md
│
├── requirements.txt
├── app.yaml
└── README.md
Weather API
This project uses the National Weather Service (NWS) API.
NWS was selected because:
* It is free.
* It does not require an API key.
* It provides official U.S. weather information.
* It provides current observations and forecasts.
* It is suitable for demonstrating an MCP weather assistant without requiring paid services or credentials.
API base URL:
https://api.weather.gov
The NWS API is U.S.-focused, so this implementation supports U.S. locations.
MCP Server
The MCP server is implemented using FastMCP.
The server uses the streamable HTTP transport required by the Day 3 MCP pattern.
The MCP tool functions are intentionally thin. HTTP requests and weather-data parsing are implemented separately in weather_adapter.py.
Server file
mcp_server/weather_mcp_server.py
Adapter file
mcp_server/weather_adapter.py
The adapter is responsible for:
* Resolving locations.
* Calling the NWS API.
* Handling HTTP errors.
* Parsing NWS responses.
* Normalizing weather data.
* Applying recommendation rules.
MCP Tools
The server exposes three required weather tools.
1. get_current_weather
Returns current weather conditions for a U.S. location.
Input
location: string
Example:
Chicago, IL
Provides
* Temperature
* Conditions
* Humidity
* Wind speed
* Wind direction
* Observation time
* Location information
* Data source
Example natural-language question:
What's the weather in Chicago right now?
2. get_forecast
Returns a multi-day forecast.
Inputs
location: string
days: integer
The number of days must be between 1 and 7.
Provides
* Forecast date/time
* Temperature
* Conditions
* Precipitation probability
* Wind speed
* Wind direction
* Data source
Example natural-language question:
What's the forecast for Chicago for the next three days?
3. get_weather_recommendation
Provides a simple weather-based recommendation using forecast data.
Inputs
location: string
date: string
The date uses:
YYYY-MM-DD
Recommendation logic
The tool applies deterministic rules to forecast information.
Precipitation probability >= 40%
→ Recommend an umbrella.
Temperature < 55°F
→ Recommend a jacket.
Temperature > 80°F
→ Recommend light clothing and hydration.
If none of the thresholds are reached, the tool reports that no special weather gear is strongly recommended.
Example natural-language question:
Should I bring an umbrella to Chicago tomorrow?
This tool demonstrates derived reasoning rather than simply returning raw API data.
Agent Configuration
The Databricks Agent Bricks agent uses the Weather MCP server as an external MCP tool.
The agent configuration is documented in:
agent/system_prompt.txt
agent/tool_list.md
Agent responsibilities
The agent is instructed to:
* Use MCP tools for weather information.
* Never invent weather information.
* Use get_current_weather for current conditions.
* Use get_forecast for future weather.
* Use get_weather_recommendation for practical weather decisions.
* Ask for clarification when a location is ambiguous.
* Report API failures instead of guessing.
* Ground responses in MCP tool results.
Dependencies
The application uses the following Python packages:
databricks-sdk>=0.30.0
fastmcp>=3.2.0
python-dotenv>=1.0.1
requests>=2.31.0
Databricks App Configuration
The MCP server is deployed as a Databricks App.
App name:
mcp-weather-server
The application is started using:
python mcp_server/weather_mcp_server.py
The application configuration is defined in:
app.yaml
The MCP server uses streamable HTTP transport.
Local Setup
Clone the repository and install dependencies:
pip install -r requirements.txt
Start the MCP server:
python mcp_server/weather_mcp_server.py
The server can then be connected to an MCP-compatible client.
Databricks Deployment
1. Create the Databricks App
Create a new Databricks App using the MCP Server starter.
Configuration:
App name: mcp-weather-server
Compute: Medium
2. Connect the GitHub repository
Connect the Databricks workspace to this repository and deploy the application source.
3. Deploy the MCP server
The application uses:
app.yaml
requirements.txt
mcp_server/weather_mcp_server.py
4. Register the MCP server
Register the deployed Databricks App as an external MCP server in Databricks Agent Bricks.
5. Configure the agent
Use the system prompt from:
agent/system_prompt.txt
and make the three Weather MCP tools available to the agent.
Agent System Prompt
The agent is designed to follow these principles:
1. Use tools for weather facts.
2. Never hallucinate weather information.
3. Select the appropriate tool based on the user's request.
4. Ask for clarification when the location or date is ambiguous.
5. Report API failures clearly.
6. Explain recommendations using the returned weather data.
The complete system prompt is stored in:
agent/system_prompt.txt
Error Handling
The MCP server handles common failure cases including:
* Invalid or unknown locations.
* Weather API request failures.
* Invalid API responses.
* Missing forecast data.
* Invalid dates.
* Unsupported forecast ranges.
Errors are returned as clean responses instead of exposing Python stack traces to the agent.
The agent is instructed to report these failures rather than inventing a response.
Demonstration
The final submission will demonstrate the Agent Bricks agent answering at least three different natural-language weather questions.
Demonstration 1 — Current Weather
Question:
What's the weather in Chicago right now?
Expected behavior:
Agent
↓
get_current_weather
↓
NWS
↓
Current weather result
↓
Agent response

Demonstration 2 — Forecast
Question:
What's the forecast for Chicago for the next three days?
Expected behavior:
Agent
↓
get_forecast
↓
NWS
↓
Multi-day forecast
↓
Agent response


Demonstration 3 — Recommendation
Question:
Should I bring an umbrella to Chicago tomorrow?
Expected behavior:
Agent
↓
get_weather_recommendation
↓
Forecast data
↓
Recommendation rules
↓
Agent response


Submission
The submission includes:
* Weather MCP server source code.
* Weather API adapter.
* Agent system prompt.
* MCP tool documentation.
* requirements.txt.
* app.yaml.
* README.
* Agent demonstration screenshots.
* Databricks App URL or screenshots showing the deployed application and agent.
GitHub repository:
https://github.com/bhavikamange03/weather-mcp-server
GitHub branch:
main
Databricks MCP App:
https://mcp-weather-server-7474647450398536.aws.databricksapps.com/mcp
Limitations
* The implementation uses U.S.-focused National Weather Service data.
* Location resolution depends on the external geocoding service.
* Weather forecasts can change as new observations and forecasts are published.
* The recommendation logic is intentionally simple and rule-based for this assignment.
* The recommendation tool is not intended for emergency or safety-critical weather decisions.
Future Improvements
If additional development time were available, the project could be extended with:
* Severe weather alerts.
* Historical weather lookup.
* Weather comparison across multiple cities.
* More sophisticated recommendation logic.
* Support for additional weather APIs and international locations.
* A dashboard showing recent agent queries and recommendations.
This server cannot be deployed
Maintenance
ActivitySlowing
ResponsivenessNo issues