weather-mcp-server
Provides weather tools using the National Weather Service API, enabling AI agents to retrieve current weather, multi-day forecasts, and simple weather-based recommendations for U.S. locations.
README
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.
- 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?
- 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?
- 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
- Create the Databricks App Create a new Databricks App using the MCP Server starter. Configuration: App name: mcp-weather-server Compute: Medium
- Connect the GitHub repository Connect the Databricks workspace to this repository and deploy the application source.
- Deploy the MCP server The application uses: app.yaml requirements.txt mcp_server/weather_mcp_server.py
- Register the MCP server Register the deployed Databricks App as an external MCP server in Databricks Agent Bricks.
- 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:
- Use tools for weather facts.
- Never hallucinate weather information.
- Select the appropriate tool based on the user's request.
- Ask for clarification when the location or date is ambiguous.
- Report API failures clearly.
- 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.
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.
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.
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.
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.
E2B
Using MCP to run code via e2b.