Skip to main content
Glama
darshan0548

weather-mcp

by darshan0548

weather-mcp

一个 MCP(Model Context Protocol)服务器,让 AI 助手(如 Claude、Gemini CLI 或任何兼容 MCP 的客户端)能使用实时数据回答真实天气问题,而不只是获取原始数字。

Open-Meteo 提供支持 — 免费,无需 API 密钥。

为什么这不只是一个原始的天气 API 封装

大多数天气集成只会返回 temperature: 22°C。本项目在原始数据之上增加了一个推理层,因此你可以提出纯 API 无法直接回答的问题:

  • get_weather("Bangalore") — 当前状况 + 今日预报

  • should_i_carry_umbrella("Mumbai") — 给出带理由的是/否答案,而不只是降水百分比

  • is_good_for_outdoors("Delhi") — 综合雨量、风力和温度,判断今天是否适合待在户外

  • compare_weather("Bangalore", "Delhi") — 同时比较两个城市的天气

Related MCP server: Weather MCP Server

安装

git clone https://github.com/darshan0548/weather-mcp.git
cd weather-mcp
python3 -m venv venv
source venv/bin/activate   # on Windows: venv\Scripts\activate
pip install -r requirements.txt

运行测试

对真实 API 进行快速验证(无需 mock,无需 API 密钥):

python test_weather.py

将其连接到 Claude Desktop

把这部分添加到你的 Claude Desktop 配置(claude_desktop_config.json)中:

{
  "mcpServers": {
    "weather": {
      "command": "python",
      "args": ["/absolute/path/to/weather-mcp/server.py"]
    }
  }
}

将其连接到 Gemini CLI

把这部分添加到 ~/.gemini/settings.json 中:

{
  "mcpServers": {
    "weather": {
      "command": "python",
      "args": ["/absolute/path/to/weather-mcp/server.py"]
    }
  }
}

重启你的客户端,然后直接问它类似 “今天在金奈需要带伞吗?” 这样的问题。

项目结构

weather_core.py     # talks to the Open-Meteo API, no MCP-specific code
weather_advice.py    # reasoning layer built on top of raw weather data
server.py            # MCP server — wires the above into tools
test_weather.py       # sanity tests against the real API

刻意拆分为独立的文件——weather_core.pyweather_advice.py 完全不依赖 MCP,因此可以单独测试或复用。

贡献

欢迎提交 PR。如果你想添加一个工具,这里有一些想法:

  • 提供分小时的预报明细,而不只是今日概况

  • 空气质量数据(Open-Meteo 同样提供免费的接口)

  • 多日出行规划(本周最适合户外活动的日子)

  • 恶劣天气警报

如果新工具是在原始数据之上增加推理,就放在 weather_advice.py 中;如果只是纯数据获取,就放在 weather_core.py 中——然后用新的 @mcp.tool() 把它们接入 server.py

许可证

MIT — 请参阅 LICENSE

A
license - permissive license
Not graded
quality - not tested
B
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables AI assistants to fetch current weather conditions and forecasts for any city using the Open-Meteo API. Provides temperature, precipitation, and hourly forecast data through natural language queries.
  • A
    license
    Not graded
    quality
    F
    maintenance
    Enables AI assistants to retrieve current weather, forecasts, and summaries for any global location using the Open-Meteo API, with no API key required.
    21
    Creative Commons Zero v1.0 Universal
  • F
    license
    Not graded
    quality
    B
    maintenance
    Provides real-time weather data via 12 tools (current weather, forecasts, air quality, umbrella advice, etc.) using Open-Meteo and FastMCP, enabling LLMs to answer weather-related queries.
    1
  • A
    license
    Not graded
    quality
    C
    maintenance
    Provides live weather data (current conditions, forecasts) and city geocoding through Open-Meteo API, enabling AI assistants to answer weather queries without an API key.
    MIT

View all related MCP servers

Related MCP Connectors

  • Global weather via Open-Meteo: forecast, ERA5 archive, marine, air quality, geocoding, elevation.

  • Real-time weather conditions and multi-day forecasts via Open-Meteo — free, no API key required

  • US weather, alerts, earthquakes and elevation for AI agents, from NWS/NOAA and USGS. No API keys.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/darshan0548/weather-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server