weather-mcp-server

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.

Category
访问服务器

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.
  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?
  1. 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?
  1. 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:
  6. Use tools for weather facts.
  7. Never hallucinate weather information.
  8. Select the appropriate tool based on the user's request.
  9. Ask for clarification when the location or date is ambiguous.
  10. Report API failures clearly.
  11. 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 Current Weather Test 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 Forecast Weather Test

Forecast Weather Test

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

Weather Recommendation Test

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.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选