Skip to main content
Glama
weather-mcp-server

weather-mcp-server

by EternityG2

Weather MCP Server

一个基于官方 MCP Python SDK FastMCP 的天气查询 MCP 服务器。服务通过 wttr.in 获取实时天气数据,支持中文城市名映射,也支持直接传入英文城市名。

功能

  • get_weather(city: str): 查询指定城市当前天气。

  • list_supported_cities(): 列出内置支持的中文城市。

  • get_server_info(): 查看服务器名称、版本、工具列表和数据来源。

Related MCP server: MCP Weather Server

环境要求

  • Python 3.10+

  • 可访问 https://wttr.in

本地运行

pip install -r requirements.txt
python server.py

服务器默认使用 stdio transport,适合由支持 MCP 的客户端以子进程方式启动。容器环境默认使用 streamable-http transport,监听 0.0.0.0:8000。

MCP 客户端配置示例

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

Docker 运行

docker build -t weather-mcp-server .
docker run --rm -i weather-mcp-server

如需在本地用 HTTP transport 运行:

MCP_TRANSPORT=streamable-http MCP_HOST=0.0.0.0 PORT=8000 python server.py

发布到 Smithery

本目录已经包含 Smithery 所需的 smithery.yaml 和推荐的 Dockerfile。如果你的 GitHub 仓库根目录不是本目录,请在 Smithery 的 GitHub integration 设置里将 base directory 配置为:

weather_mcp_server

然后在 Smithery 中触发部署即可。

数据来源

天气数据来自 wttr.in。请注意第三方服务的可用性、限流策略和数据准确性可能会变化。

License

MIT

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      An MCP server that provides real-time weather information, 4-day forecasts, and city search functionality for Chinese cities via the AMap API. It enables users to query weather data using city names or administrative codes through natural language interactions.
      1
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Real-time weather query MCP server supporting 12 Chinese cities (and global cities via English names) using wttr.in API, built on HelloAgents framework.
      MIT