Skip to main content
Glama
Weather MCP Server

Weather MCP Server

Weather MCP Server

真实天气查询 MCP 服务器,基于 HelloAgents 框架开发。

功能特性

  • 🌤️ 实时天气查询

  • 🌍 支持12个中国主要城市

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

  • 🚀 基于 HelloAgents 框架

Related MCP server: Weather MCP Server

安装

pip install hello-agents requests

发布到 Smithery

Smithery 当前使用 URL 发布模式,不再从 GitHub 仓库和 smithery.yaml 自动构建容器。请先将本项目部署到支持 HTTPS 的托管平台,再向 Smithery 提交完整的 Streamable HTTP 地址:

https://your-public-host.example/mcp

不要提交 GitHub 仓库地址或不带 /mcp 的站点根地址。服务器同时在以下 路径提供 Smithery 静态元数据:

https://your-public-host.example/.well-known/mcp/server-card.json

本服务不要求 API Key,因此 Smithery 的 No config schema provided 提示 只是警告,可以忽略。

使用方法

直接运行

python server.py

在 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"]
    }
  }
}

在 HelloAgents 中使用

from hello_agents import SimpleAgent, HelloAgentsLLM
from hello_agents.tools import MCPTool

agent = SimpleAgent(name="天气助手", llm=HelloAgentsLLM())
weather_tool = MCPTool(server_command=["python", "server.py"])
agent.add_tool(weather_tool)

response = agent.run("北京今天天气怎么样?")

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"]
}

支持的城市

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

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

许可证

MIT License

作者

HelloAgents Team

Tool Schema Changelog

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

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Real-time weather query MCP server for Chinese cities and global cities using 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 users to query real-time weather for 12 major Chinese cities and global cities via wttr.in, and to list supported cities and server information through MCP tools.
      MIT