weather-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@weather-mcp what's the weather in Beijing tomorrow?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Weather MCP
一个基于 Open-Meteo 的 MCP 天气服务:提供"按天数"和"按星期几"两种查询方式,返回 Markdown(默认)或 JSON。
环境要求
Python:3.13+
依赖:
httpx、pydantic、mcp(见pyproject.toml)
Related MCP server: Weather MCP Server
快速开始
方式 1:使用 uvx 直接运行(推荐)
无需安装,直接运行:
uvx weather-mcp方式 2:从 PyPI 安装
pip install weather-mcp然后运行:
weather-mcp方式 3:本地开发
安装依赖(如果你使用 uv):
uv sync或使用 pip:
pip install httpx>=0.27.0 pydantic>=2.6.0 mcp>=0.1.0工具列表
1) weather_query_by_days
查询“指定城市在 N 天后”的天气(支持 0~16 天)。
输入参数:
city(string):城市名(如北京、上海、New York)days_later(int):未来第几天(0=今天,1=明天,范围0-16)response_format(string,可选):markdown或json(默认markdown)
示例(以 MCP 工具入参 JSON 表示):
{"city":"北京","days_later":1,"response_format":"markdown"}2) weather_query_by_weekday
查询“下一个指定星期几”的天气。
输入参数:
city(string):城市名(如北京、上海、New York)target_weekday(string):目标星期(英文,大小写不敏感):Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sundayresponse_format(string,可选):markdown或json(默认markdown)
说明:
如果今天刚好是
target_weekday,为了避免歧义,本工具会查询“下周同一天”(即 +7 天)。
示例:
{"city":"上海","target_weekday":"Saturday","response_format":"json"}返回内容
Markdown(默认)
包含(如有数据):
天气状况(WMO code 映射的中文描述)
最高/最低温、最高/最低体感温
降水量、最大降水概率
最大风速
最大/最小湿度
最大紫外线指数(含等级:低/中等/高/很高/极高)
日出/日落时间
JSON
工具会返回一个 JSON 字符串,结构类似:
顶层:
city、country、date、latitude、longitudeweather:包含 Open-Meteodaily下的各字段在目标日期对应的值(例如weathercode、temperature_2m_max、precipitation_sum、sunrise、sunset等)
MCP 服务配置
本服务使用 STDIO (标准输入输出) 传输方式。
快速启动配置
方式 1:使用 weather-mcp 命令(推荐)
如果已通过 pip 或 uvx 安装:
{
"command": "weather-mcp",
"args": [],
"env": {}
}方式 2:使用 uvx 直接运行
{
"command": "uvx",
"args": ["weather-mcp"],
"env": {}
}方式 3:使用 Python 直接运行
{
"command": "python",
"args": ["weather.py"],
"env": {}
}配置说明
传输方式:STDIO (标准输入输出)
环境变量:无需额外环境变量配置
托管类型:仅本地可用(STDIO 方式需要本地运行)
网络要求:需要能访问 Open-Meteo API (
api.open-meteo.com和geocoding-api.open-meteo.com)
Claude Desktop 配置示例
在 Claude Desktop 的配置文件中添加:
{
"mcpServers": {
"weather": {
"command": "weather-mcp"
}
}
}或者使用 uvx:
{
"mcpServers": {
"weather": {
"command": "uvx",
"args": ["weather-mcp"]
}
}
}备注与限制
预报范围:Open-Meteo 日级预报限制为
0-16天。城市解析:先通过 Open-Meteo Geocoding 获取经纬度,再拉取预报(需要可访问外网)。
错误返回:出错时返回以
Error:开头的字符串(例如城市不存在、参数校验失败、请求超时/限流等)。传输方式:使用 STDIO 传输,需要在本地运行,适合集成到 MCP 客户端(如 Claude Desktop)。
Available Tools
2 toolsweather_query_by_daysARead-onlyIdempotent
查询指定城市在指定天数后的天气情况。
这个工具可以查询未来16天内任意一天的天气预报,包括温度、降水、风力等信息。
Args: params (WeatherQueryInput): 已验证的输入参数,包含: - city (str): 城市名称(例如:'北京', '上海', 'New York', 'London') - days_later (int): 未来的天数(0=今天, 1=明天, 2=后天, 范围:0-16) - response_format (ResponseFormat): 输出格式,默认为markdown
Returns: str: 格式化的天气信息
成功响应包含:
- 天气状况(晴朗、多云、雨等)
- 温度范围(最低/最高温度)
- 体感温度
- 降水量和降水概率
- 风速
- 湿度
- 紫外线指数
- 日出日落时间
错误响应:
"Error: <错误信息>"Examples: - 查询明天的天气: city="北京", days_later=1 - 查询后天的天气: city="上海", days_later=2 - 查询7天后的天气: city="New York", days_later=7
Error Handling: - 如果城市名称无效,返回城市未找到错误 - 如果天数超出范围(0-16),返回验证错误 - 如果API请求失败,返回相应的错误信息
Inputs: params (required). Returns: result
weather_query_by_weekdayARead-onlyIdempotent
查询指定城市在下一个指定星期几的天气情况。
这个工具可以查询下一个指定星期几(如本周六、本周日)的天气预报。
Args: params (WeekdayQueryInput): 已验证的输入参数,包含: - city (str): 城市名称(例如:'北京', '上海', 'New York') - target_weekday (str): 目标星期几(例如:'Saturday', 'Sunday', 'Monday') - response_format (ResponseFormat): 输出格式,默认为markdown
Returns: str: 格式化的天气信息,包含与weather_query_by_days相同的详细信息
Examples: - 查询本周六的天气: city="北京", target_weekday="Saturday" - 查询本周日的天气: city="上海", target_weekday="Sunday" - 查询下周一的天气: city="Guangzhou", target_weekday="Monday"
Error Handling: - 如果城市名称或星期几无效,返回相应的验证错误 - 如果API请求失败,返回相应的错误信息
Inputs: params (required). Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 2 tools
The two tools differ only in how the target date is expressed (day offset vs. weekday name) and return identical data, so an agent must decide between query interfaces rather than distinct capabilities. The descriptions make the boundary clear enough (0-16 day range vs. next occurrence of a weekday), but the overlap is real since weather_query_by_weekday is essentially a syntactic sugar wrapper over weather_query_by_days.
Both tools follow an identical, predictable 'weather_query_by_<dimension>' pattern with snake_case throughout. The suffix directly reflects the parameter that distinguishes them, which reinforces rather than confuses the distinction.
Two tools is thin for a weather service; the surface is entirely forecast-by-date and nothing else. A weather domain naturally supports current conditions, hourly data, or location resolution, so the set feels under-scoped even for a deliberately minimal server.
The 16-day forecast with rich detail is well covered, and 'today' is reachable via days_later=0, so the core query is not a dead end. However there is no geocoding/city validation tool, no current-conditions or hourly tool, and no way to query multiple cities or historical data, leaving notable gaps for a weather domain.
Maintenance
Related MCP Connectors
Weather forecast for any city, UV index, sunrise and sunset, pollen and air quality. Free, no key.
Global weather via Open-Meteo: forecast, historical, marine, air quality, geocoding, elevation.
Current weather and forecast lookup as an agent tool.
Weather MCP — wraps Open-Meteo API (free, no auth)
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables users to get current weather information for any city using the Open-Meteo API. Provides detailed meteorological data including temperature, precipitation, day/night status, and hourly forecasts through natural language queries.ISC
- AlicenseNot gradedqualityDmaintenanceEnables 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.ISC
- FlicenseNot gradedqualityDmaintenanceProvides real-time and historical weather data for any city worldwide, including forecasts, air quality, and marine conditions, using the free Open-Meteo API.-
- FlicenseNot gradedqualityDmaintenanceEnables querying current weather, 7-day forecast, UV index, and air quality for any city using the free Open-Meteo API, without requiring an API key.-