Token导航 LogoToken导航TokenDH.com
Chuk MCP Open Meteo logo
地图位置stdio官方级别未说明来源级核验

Chuk MCP Open Meteo

MCP Server

一个基于Open-Meteo API的模型上下文协议(MCP)服务器,提供全面的天气数据访问功能,包括天气预报、地理位置编码、历史天气、空气质量监测和海洋预报等。

工具数

12

提示词数

0

GitHub Stars

1

资源数

0
位置天气地理编码PythonClaudeClaude DesktopClaude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

IBM

提供方

IBM

最后核验

2026/5/17 20:20

运行时

Python

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

uvx chuk-mcp-open-meteo

详细介绍

楚科奇MCP公开赛

有史以来最好的天气MCP服务器 -用于访问Open Meteo天气数据的综合模型上下文协议(MCP)服务器。

这是一个为学习和测试目的而提供的演示项目。

![Python 3.11+](https://www.python.org/downloads/)

特性

此MCP服务器通过12个工具(6个单位置工具和6个用于多位置查询的批处理工具)提供对Open Meteo天气API的全面访问。

所有工具都返回完全类型化的Pydantic v2模型 用于类型安全、验证和出色的IDE支持。每个模型都包含丰富的、LLM友好的字段描述,并附有解释指南,以更好地理解人工智能。

单位置工具

1.天气预报(get_weather_forecast)

使用可定制的参数获取详细的天气预报:

  • 当前天气状况
  • 每小时预测(最多16天)
  • 每日预报
  • 50+天气变量,包括温度、降水、风、湿度、云量等
  • 多个单位(摄氏度/华氏度、公里/小时、英里/小时、米/秒、节)
  • 自动时区检测

2.位置地理编码(geocode_location)

将位置名称转换为坐标:

  • 搜索全球任何地点
  • 获取坐标、高程、时区
  • 国家和行政信息
  • 人口数据(如有)
  • 多语言支持

3.历史天气(get_historical_weather)

访问历史天气数据:

  • 1940年以后的数据(取决于位置)
  • 与预测相同的综合变量
  • 非常适合气候分析和趋势
  • 每小时和每日汇总

4.空气质量(get_air_quality)

监测空气质量和污染物:

  • PM2.5、PM10颗粒物
  • CO、NO2、SO2、O3气体浓度
  • 欧洲空气质量指数和美国空气质量指数
  • 花粉数据(多物种)
  • 紫外线指数
  • 气溶胶光学厚度

5.海洋预报(get_marine_forecast)

获取海洋天气状况:

  • 波高、方向和周期
  • 风浪和涌浪分开
  • 洋流速度和方向
  • 长达16天的预测
  • 对海上活动至关重要
  • 现场描述包括波浪质量解释(0-0.5m平静,1.5-2.5m中等等)

6.天气代码解释(interpret_weather_code)

将数字天气代码转换为描述:

  • 将WMO天气代码(0-99)转换为人类可读文本
  • 包括严重程度类别(晴、雨、雪、雷暴等)
  • 帮助LLM用自然语言解释天气状况
  • 所有标准天气代码的内置参考

批处理工具

批处理工具大大减少了查询多个位置时的延迟。批处理工具在一次调用中完成,而不是N次连续的工具调用(20个城市约3分钟)(约0.3-0.5秒)。

7.批量地理编码(batch_geocode_locations)

同时对多个位置名称进行地理编码:

  • 逗号分隔输入: "London,Paris,Berlin,Madrid,Rome"
  • 连接池并发执行
  • 部分故障处理——单个位置可能会发生故障,而不会破坏批次
  • 结果与输入顺序相同

8.批量天气预报(batch_get_weather_forecasts)

在单个API调用中获取多达1000个地点的预测:

  • 使用Open Meteo的原生多位置支持
  • 所有位置的单个HTTP请求
  • 参数与 get_weather_forecast

9.批次空气质量(batch_get_air_quality)

一个API调用中多个位置的空气质量数据:

  • 比较各城市的污染水平
  • 默认为常见污染物指标(PM2.5、PM10、AQI等)

10.批量海洋预报(batch_get_marine_forecasts)

一个API调用中多个海岸点的海洋条件:

  • 比较冲浪点,监测海岸线状况
  • 不同地点的波浪、涌浪、洋流和潮汐

11.批次历史天气(batch_get_historical_weather)

一个API调用中多个位置的历史数据:

  • 所有地点共享相同的日期范围
  • 可用于城市间的气候比较

12.批量天气代码解释(batch_interpret_weather_codes)

在一次通话中解释多个WMO天气代码:

  • 逗号分隔输入: "3,51,61,95"
  • 消除了多个连续 interpret_weather_code 电话
  • 理想的批后预测为每个位置返回不同的代码

推荐的批处理工作流

1. batch_geocode_locations("London,Paris,Berlin")  → coordinates
2. batch_get_weather_forecasts(latitudes="51.51,48.86,52.52", longitudes="-0.13,2.35,13.41")  → weather
3. batch_interpret_weather_codes("3,51,61")  → descriptions

安装

使用uvx(推荐-无需安装!)

使用服务器的最简单方法是 uvx,无需安装即可运行:

uvx chuk-mcp-open-meteo

这将自动下载并运行最新版本。非常适合克劳德桌面!

使用紫外线(建议用于开发)

# Install from PyPI
uv pip install chuk-mcp-open-meteo

# Or clone and install from source
git clone 
cd chuk-mcp-open-meteo
uv sync --dev

使用pip(传统)

pip install chuk-mcp-open-meteo

用法

使用克劳德桌面

选项1:使用公共服务器(最简单)

连接到托管的公共服务器 weather.chukai.io:

MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json 视窗: %APPDATA%/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "weather": {
      "url": "https://weather.chukai.io/mcp"
    }
  }
}

选项2:使用uvx在本地运行

{
  "mcpServers": {
    "open-meteo": {
      "command": "uvx",
      "args": ["chuk-mcp-open-meteo"]
    }
  }
}

选项3:使用pip在本地运行

{
  "mcpServers": {
    "open-meteo": {
      "command": "chuk-mcp-open-meteo"
    }
  }
}

独立

直接运行服务器:

# With uvx (recommended - always latest version)
uvx chuk-mcp-open-meteo

# With uvx in HTTP mode
uvx chuk-mcp-open-meteo http

# Or if installed locally
chuk-mcp-open-meteo
chuk-mcp-open-meteo http

或者使用uv/Python:

# STDIO mode (default, for MCP clients)
uv run chuk-mcp-open-meteo
# or: python -m chuk_mcp_open_meteo.server

# HTTP mode (for web access)
uv run chuk-mcp-open-meteo http
# or: python -m chuk_mcp_open_meteo.server http

STDIO模式 适用于Claude Desktop和MCP-cli等MCP客户端。 HTTP模式 在上运行web服务器http://localhost:8000用于基于HTTP的MCP客户端。

示例用法

配置后,您可以向Claude提出以下问题:

  • “伦敦现在的天气怎么样?”
  • “给我一份东京7天的天气预报,包括每小时的温度和降水量”
  • “2020年7月4日纽约的天气怎么样?”
  • “洛杉矶现在的空气质量怎么样?”
  • “夏威夷海岸的波浪状况如何?”
  • “找到法国巴黎的坐标”

Python示例

看看 examples/ 可运行Python示例的目录:

# With uv (recommended)
uv run python examples/example_basic.py
uv run python examples/example_trip_planner.py
uv run python examples/test_mcp_protocol.py

# Or with plain python (if installed)
python examples/example_basic.py
python examples/example_trip_planner.py
python examples/test_mcp_protocol.py

# Run all examples
./examples/test_all.sh

示例/README.md 详细文档。

工具参考

所有工具归还 Pydantic v2型号 具有完全的类型安全性。从Python调用时,您将获得干净的对象访问权限:

from chuk_mcp_open_meteo.server import get_weather_forecast

# Get weather forecast
forecast = await get_weather_forecast(latitude=51.5072, longitude=-0.1276, current_weather=True)

# Access data via typed attributes (not dictionaries!)
if forecast.current_weather:
    temp = forecast.current_weather.temperature  # Type-safe access
    wind = forecast.current_weather.windspeed

get_weather_forecast

参数:

{
  "latitude": 51.5072,
  "longitude": -0.1276,
  "temperature_unit": "celsius",  # or "fahrenheit"
  "wind_speed_unit": "kmh",       # or "ms", "mph", "kn"
  "precipitation_unit": "mm",      # or "inch"
  "timezone": "auto",              # or specific timezone
  "forecast_days": 7,              # 1-16
  "current_weather": true,
  "hourly": "temperature_2m,precipitation,wind_speed_10m",
  "daily": "temperature_2m_max,temperature_2m_min,precipitation_sum"
}

退货: WeatherForecast Pydantic模型

流行的小时变量: temperature_2m, relative_humidity_2m, precipitation, rain, snowfall, cloud_cover, wind_speed_10m, wind_direction_10m, pressure_msl, visibility

热门日常变量: temperature_2m_max, temperature_2m_min, precipitation_sum, rain_sum, sunrise, sunset, wind_speed_10m_max

地理位置

参数:

{
  "name": "London",
  "count": 10,        # number of results
  "language": "en"    # language code
}

退货: GeocodingResponse Pydantic模型

获取历史天气

参数:

{
  "latitude": 40.7128,
  "longitude": -74.0060,
  "start_date": "2020-01-01",
  "end_date": "2020-01-31",
  "hourly": "temperature_2m,precipitation",
  "daily": "temperature_2m_max,temperature_2m_min"
}

退货: HistoricalWeather Pydantic模型

获得空气质量

参数:

{
  "latitude": 34.0522,
  "longitude": -118.2437,
  "hourly": "pm10,pm2_5,us_aqi,european_aqi"
}

退货: AirQualityResponse Pydantic模型

获取主预报

参数:

{
  "latitude": 21.3099,
  "longitude": -157.8581,
  "hourly": "wave_height,wave_direction,wave_period"
}

退货: MarineForecast Pydantic模型

发展

设置

# Clone the repository
git clone 
cd chuk-mcp-open-meteo

# Install with uv (recommended)
uv sync --dev

# Or with pip
pip install -e ".[dev]"

运行测试

make test              # Run tests (excludes network tests)
make test-cov          # Run tests with coverage
make coverage-report   # Show coverage report

# Run all tests including network tests (requires internet)
pytest tests/          # Run all 40 tests
pytest tests/ -m network  # Run only network tests

注: 网络测试对Open-Meteo进行真正的API调用,并从CI中排除,以避免构建不稳定。它们包括用于本地开发的自动重试逻辑。

代码质量

make lint      # Run linters
make format    # Auto-format code
make typecheck # Run type checking
make security  # Run security checks
make check     # Run all checks

建筑

make build         # Build package
make docker-build  # Build Docker image

部署

Fly.io

只需一个命令即可部署到Fly.io:

# First time setup
fly launch

# Deploy updates
fly deploy

服务器将通过HTTP在您的Fly.io URL上可用。

码头工人

# Build the image
docker build -t chuk-mcp-open-meteo .

# Run the container
docker run -p 8000:8000 chuk-mcp-open-meteo

API学分

此服务器使用免费 开放气象APIOpen Meteo提供:

  • 非商业用途的免费访问
  • 不需要API密钥
  • 高分辨率天气模型
  • 25+全球天气模型
  • 1940年的历史数据
  • 合理使用无费率限制

请考虑 支持Open Meteo 如果你广泛使用它。

建筑

该服务器基于chuk-mcp服务器构建,采用模块化架构:

src/chuk_mcp_open_meteo/
├── server.py          # Thin entry point — imports tools, runs server
├── models.py          # All Pydantic v2 response models (26 models)
├── _constants.py      # API URLs, default parameters, weather codes
├── _batch.py          # Generic batch fetch helper (DRY across 4 batch tools)
└── tools/             # Domain-focused tool modules
    ├── forecast.py    # get_weather_forecast + batch_get_weather_forecasts
    ├── geocoding.py   # geocode_location + batch_geocode_locations
    ├── historical.py  # get_historical_weather + batch_get_historical_weather
    ├── air_quality.py # get_air_quality + batch_get_air_quality
    ├── marine.py      # get_marine_forecast + batch_get_marine_forecasts
    └── weather_codes.py # interpret_weather_code

设计原则:

  • 异步本机:所有工具都是async/await,都是通过httpx进行HTTP。异步客户端
  • Pydantic土著:所有响应都使用Pydantic v2模型进行验证和类型安全
  • 没有魔术弦:API URL和默认参数是命名常量
  • 可组合模块:每个域都是一个包含单个和批处理工具的自包含模块
  • 类型安全:从Python类型提示自动生成JSON-RPC模式
  • LLM优化:丰富的字段描述,模型中嵌入了解释指南

- 波高包括大小类别(平静/小/中等/大/危险) - 波动周期包括质量评级(波动/良好/优秀) - 天气代码包括字段描述中的快速参考 - 方向场解释气象惯例 - 所有测量都包括上下文和安全阈值

  • 高性能:低于3毫秒的延迟,36000+RPS能力

公用服务器

公共实例托管在 weather.chukai.io 为了便于访问:

  • 统一资源定位符: https://weather.chukai.io/mcp
  • 协议:HTTPS上的MCP
  • 免费使用:不需要API密钥
  • 始终保持最新状态:运行最新版本

只需将其添加到您的Claude Desktop配置中:

{
  "mcpServers": {
    "weather": {
      "url": "https://weather.chukai.io/mcp"
    }
  }
}

贡献

欢迎投稿!请随时提交拉取请求。

  1. 分叉存储库
  2. 创建功能分支(git checkout -b feature/amazing-feature)
  3. 提交您的更改(git commit -m 'Add amazing feature')
  4. 推到分支(git push origin feature/amazing-feature)
  5. 打开拉取请求

许可证

此项目根据MIT许可证获得许可-请参阅 许可证 文件以获取详细信息。

致谢

许可证

Apache许可证2.0-有关详细信息,请参阅许可证。

文档

目录标签

目录标签

位置天气地理编码PythonClaude天气数据本地部署MCP服务器天气预报空气质量监测

支持客户端

Claude DesktopClaude

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

运行时(runtime,运行环境)

Python

工具数量(toolCount,工具数)

12

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdionone部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP