Weather Prediction MCP Server

Weather Prediction MCP Server

Provides current weather, forecasts, and travel recommendations via Open-Meteo, and connects to Databricks agents through FastMCP.

Category
访问服务器

README

Weather Prediction MCP Server + Databricks Agent

Assignment 3 for the DataExpert.io Databricks AI Boot Camp.

This project exposes weather capabilities through a FastMCP Streamable-HTTP server backed by Open-Meteo, then connects a Databricks Agent Bricks agent to those tools.

Architecture

User
  |
  v
Databricks Agent Bricks
  |
  | MCP tool calls
  v
Weather Prediction MCP Server (Databricks App)
  |-- get_current_weather
  |-- get_forecast
  `-- get_travel_recommendation
            |
            v
      weather_adapter.py
            |
            | HTTPS
            v
 Open-Meteo Geocoding + Forecast APIs

The MCP layer is deliberately thin. All HTTP calls, geocoding, response parsing, WMO weather-code mapping, validation, and recommendation logic live in weather_adapter.py.

Weather API and authentication

Open-Meteo is used for geocoding and weather forecasts. This lab requires no API key, so there are no API secrets to store or commit.

MCP tools

get_current_weather(location)

Returns current temperature, feels-like temperature, conditions, humidity, precipitation, cloud cover, and wind.

get_forecast(location, days=5)

Returns 1-16 daily forecasts with high/low temperatures, conditions, maximum precipitation probability, precipitation total, and maximum wind.

get_travel_recommendation(location, date)

A derived prediction/recommendation rather than an API passthrough:

  • umbrella when precipitation probability >= 40% or precipitation > 0.02 in
  • jacket when daily low < 55°F
  • heat caution when daily high >= 90°F
  • wind caution when max wind >= 25 mph

The tool returns forecast values, booleans, exact threshold logic, reasons, and a human-readable recommendation.

Error handling

  • Blank/unresolvable locations return a clean status: error result.
  • Invalid coordinates, invalid forecast days, and invalid/out-of-range dates return clean errors.
  • HTTP failures and invalid upstream JSON are translated into user-safe errors.
  • Unexpected MCP failures are logged server-side but return a generic message instead of a stack trace.

Project structure

weather-prediction-mcp-agent/
├── weather_mcp_server.py
├── weather_adapter.py
├── app.yaml
├── requirements.txt
├── agent/
│   ├── system_prompt.md
│   ├── agent_config.json
│   └── demo_questions.md
└── tests/
    ├── test_weather_adapter.py
    └── test_server_contract.py

Run locally

python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
pip install pytest
pytest -q
python weather_mcp_server.py

FastMCP serves the MCP endpoint at:

http://localhost:8000/mcp

Deploy MCP server as a Databricks App

  1. Push this repository to GitHub and open it as a Databricks Git folder.
  2. In Compute -> Apps, create a Custom app such as weather-prediction-mcp.
  3. Point the app source to the repository root containing app.yaml.
  4. Deploy it.
  5. Copy the Databricks App URL. The MCP endpoint is the app URL plus /mcp, for example: https://<your-app>.aws.databricksapps.com/mcp

app.yaml runs:

command: ["python", "weather_mcp_server.py"]

The server binds to DATABRICKS_APP_PORT automatically.

Register the MCP and build Agent Bricks agent

  1. In Databricks, register the deployed app's /mcp URL as the MCP service/tool source.
  2. Confirm Databricks discovers:
    • get_current_weather
    • get_forecast
    • get_travel_recommendation
  3. Create an Agent Bricks agent.
  4. Add the registered weather MCP server under Tools.
  5. Paste agent/system_prompt.md as the system prompt.
  6. Run the three prompts in agent/demo_questions.md.
  7. Capture screenshots showing each natural-language prompt, its tool call, and the grounded answer.

System prompt / guardrails

The supplied system prompt requires the agent to use tools for weather facts, never fabricate readings, explain tool errors rather than guess, clarify ambiguous locations, and explain the threshold behind derived recommendations.

Required demonstration prompts

  1. What is the weather in Chicago right now?
  2. Will it rain in Austin over the next 3 days?
  3. Should I bring an umbrella and jacket to New York on <a date within the next 16 days>?

S

Notes

Open-Meteo forecasts are forecasts, not guarantees. The agent is instructed to avoid presenting predictions as certain and to use only values returned by tools.

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选