Skip to main content
Glama
Weather MCP Server

Weather MCP Server

by BigDaddy118

Weather MCP Server

基于 wttr.in 的实时天气查询 MCP 服务器(Streamable HTTP),用于 HelloAgents / Datawhale 第十章实践与 Smithery 发布。

功能

工具

说明

get_weather(city)

查询城市当前天气(支持中文城市名与英文名)

list_supported_cities()

列出内置中文城市映射

get_server_info()

服务器元信息

内置中文城市:北京、上海、广州、深圳、杭州、成都、重庆、武汉、西安、南京、天津、苏州。其他城市可直接传英文名。

Related MCP server: Weather MCP Server

快速开始

git clone https://github.com/BigDaddy118/weather-mcp-server.git
cd weather-mcp-server
pip install -r requirements.txt
python server.py

默认监听:http://0.0.0.0:8081/mcp

环境变量:

变量

默认

说明

PORT

8081

端口

HOST

0.0.0.0

绑定地址

MCP_TRANSPORT

streamable-http

MCP 传输(Smithery 需 HTTP)

Docker

docker build -t weather-mcp-server .
docker run --rm -p 8081:8081 weather-mcp-server

在 Smithery 使用 / 发布

已发布标识:1009264368/weather-mcp-server

本地临时公网(开发用):

python server.py
# 另开终端:npx localtunnel --port 8081
# 得到 https://xxxx.loca.lt 后,MCP URL 为 https://xxxx.loca.lt/mcp

正式发布示例:

npx @smithery/cli auth login
npx @smithery/cli mcp publish "https://你的公网域名/mcp" -n 1009264368/weather-mcp-server

Smithery 需要正在运行的 HTTP MCP 地址,不能填本 GitHub 仓库 URL。临时隧道关掉后线上会不可用,生产环境请部署到稳定主机。

在 HelloAgents 中使用

学习仓库里的 stdio 演示见 14_weather_mcp_server.py。本仓库面向 HTTP:

# 连接已部署的 HTTP MCP(视 MCPTool / 客户端是否支持 URL)
# 或本地 stdio:把本目录 server 改为 stdio 传输后再用
# MCPTool(server_command=[sys.executable, "server.py"])

示例返回

get_weather("北京"):

{
  "city": "北京",
  "temperature": 22.0,
  "feels_like": 21.0,
  "humidity": 40,
  "condition": "Sunny",
  "wind_speed": 2.5,
  "visibility": 10.0,
  "timestamp": "2026-10-01 17:00:00"
}

依赖

  • Python >= 3.10

  • fastmcp>=2.0.0

  • requests>=2.31.0

许可证

MIT

Tool Schema Changelog

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

Loading tool schema changelog…

    Related MCP Connectors

    • Toast MCP server for ChatGPT, Claude and any AI agent: list menus, list menu items, 86 a menu item, set menu hours, get sales summary, list time entries, fix time entry and create shift in your own Toast account. Cotlet works in the account through your Cloud Browser, a real Chrome where you sign in to Toast yourself; Cotlet does not store your password and you need no Toast API key. About the official Toast API: Toast has an API, but the access a restaurant creates for itself is read-only (checked 28 Oct 2026). Standard API access needs Restaurant Management Suite (RMS) Essentials or higher and the Manage Integrations permission, and it cannot write. Setup and FAQ: https://cotlet.dev/integrations/toast-api-mcp-server

      https://cotlet.dev/mcp/v1/toast
    • Demo booking server for a fictional salon. Try confirm-first write tools in Claude or ChatGPT.

      https://demo.atithi.win/mcp
    • Wanderlog MCP server for ChatGPT, Claude and any AI agent: create trip, add place, import booking and update itinerary in your own Wanderlog account. Cotlet works in the account through your Cloud Browser, a real Chrome where you sign in to Wanderlog yourself; Cotlet does not store your password and you need no Wanderlog API key. About the official Wanderlog API: Wanderlog has no public API and no developer docs (checked 11 Oct 2026). Trips, places, reservations and expenses are edited in its web and mobile apps; bookings come in by forwarding confirmation emails or connecting Gmail. Setup and FAQ: https://cotlet.dev/integrations/wanderlog-api-mcp-server

    • SiteMinder MCP server for ChatGPT, Claude and any AI agent: update rates, close dates, list reservations, update inventory and get channel performance in your own SiteMinder account. Cotlet works in the account through your Cloud Browser, a real Chrome where you sign in to SiteMinder yourself; Cotlet does not store your password and you need no SiteMinder API key. About the official SiteMinder API: SiteMinder has APIs, but the ones that change rates, availability and restrictions or deliver reservations are for technology partners who sign a partnership agreement and certify each API (checked 11 Oct 2026). A hotel can generate its own key only for the read-only Direct Booking API. Setup and FAQ: https://cotlet.dev/integrations/siteminder-api-mcp-server

    Related MCP Servers

    • 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
      D
      maintenance
      Enables real-time weather queries for 12 major Chinese cities and global cities using the wttr.in API without an API key, with tools for weather, city listing, and server info.
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables real-time weather queries for Chinese and global cities via wttr.in, with support for both stdio and HTTP deployment.
      MIT