Skip to main content
Glama
Mufens

Weather MCP Server

by Mufens

Weather MCP Server

真实天气查询 MCP 服务器,基于 FastMCP 实现,数据来源 wttr.in

功能特性

  • 实时天气查询

  • 内置 12 个中国主要城市中文映射

  • 使用 wttr.in API(无需密钥)

  • 同时支持本地 stdio 与 Smithery HTTP 部署

Related MCP server: Weather MCP Server

安装

pip install -r requirements.txt

使用方法

直接运行(HTTP,默认 8081 端口)

python server.py

访问端点:http://localhost:8081/mcp

本地 stdio(Claude Desktop 等 MCP 客户端)

python server.py --stdio

在 Claude Desktop 中使用

编辑 ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) 或 %APPDATA%\Claude\claude_desktop_config.json (Windows):

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

本地测试:

python test_weather_server.py

可选:若本机已安装 HelloAgents,可用 weather_agent.py 把本服务接到 Agent 里。这个脚本不是服务器运行依赖。

API 工具

get_weather

获取指定城市的当前天气。

参数:

  • city (string): 城市名称(支持中文和英文)

示例:

{
  "city": "北京"
}

返回:

{
  "city": "北京",
  "temperature": 10.0,
  "feels_like": 9.0,
  "humidity": 94,
  "condition": "Light rain",
  "wind_speed": 1.7,
  "visibility": 10.0,
  "timestamp": "2025-10-09 13:25:03"
}

list_supported_cities

列出所有支持的中文城市。

返回:

{
  "cities": ["北京", "上海", "广州", "深圳", "杭州", "成都", "重庆", "武汉", "西安", "南京", "天津", "苏州"],
  "count": 12
}

get_server_info

获取服务器信息。

返回:

{
  "name": "Weather MCP Server",
  "version": "1.0.0",
  "tools": ["get_weather", "list_supported_cities", "get_server_info"]
}

支持的城市

北京、上海、广州、深圳、杭州、成都、重庆、武汉、西安、南京、天津、苏州

也支持使用英文城市名查询全球任意城市。

发布到 Smithery

  1. 将本仓库推送到 GitHub:https://github.com/Mufens/weather-mcp-server

  2. 打开 https://smithery.ai/,使用 GitHub 账号登录

  3. 点击 Publish Server,填入仓库 URL 后等待发布

发布完成后可通过以下方式使用:

npm install -g @smithery/cli
smithery install weather-mcp-server

许可证

MIT License

Maintenance

ActivityMaintained
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables real-time weather queries for 12 Chinese cities and global cities using English names via the wttr.in API.
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables real-time weather queries for 12 major Chinese cities and global cities using the wttr.in API. Provides tools to get weather, list supported cities, and server info.
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables real-time weather queries for Chinese and global cities via the wttr.in API, providing current conditions such as temperature, humidity, and wind speed.
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables real-time weather queries for 12 major Chinese cities and global cities using English names, powered by the wttr.in API with no API key required.
    MIT