Skip to main content
Glama
liusicheng

MCP Weather Server

by liusicheng

MCP Weather Server

一个基于 FastMCP 的天气查询 MCP Server,提供当前天气、未来天气预报、摄氏度/华氏度转换、热门城市资源和旅行天气建议 Prompt。

项目包含两个启动入口:

  • server.py:本地 stdio 模式,适合 Claude Desktop、Cursor、Cherry Studio 等本地 MCP 客户端。

  • server_remote.py:Streamable HTTP 模式,适合部署到 ModelScope 等远程托管平台。

功能

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

  • get_forecast(city: str, days: int = 3):查询指定城市未来天气预报,默认 3 天。

  • temperature_convert(value: float, from_unit: str):摄氏度与华氏度互转。

  • weather://cities:返回常用城市列表资源。

  • travel_advisor(destination: str, date: str):生成旅行天气咨询 Prompt。

天气数据来自 wttr.in,无需额外 API Token。

Related MCP server: weather-mcp-server

环境要求

  • Python >= 3.12

  • 推荐使用 uv 管理依赖

安装依赖

uv sync

如果不使用 uv,也可以在虚拟环境中安装依赖:

pip install "mcp[cli]>=1.27.0" "httpx>=0.28.1"

本地运行

stdio 模式:

uv run python server.py

MCP 客户端配置示例:

{
  "mcpServers": {
    "weather-server": {
      "command": "uv",
      "args": ["run", "python", "server.py"]
    }
  }
}

远程运行

Streamable HTTP 模式:

uv run python server_remote.py

默认监听:

http://0.0.0.0:8000/mcp/

远程 MCP 客户端配置示例:

{
  "mcpServers": {
    "weather-server": {
      "url": "http://127.0.0.1:8000/mcp/"
    }
  }
}

ModelScope 部署说明

在 ModelScope 创建或部署 MCP Server 时,可填写本项目的 GitHub 仓库地址,并使用远程入口文件:

python server_remote.py

服务会以 Streamable HTTP 方式启动,监听 0.0.0.0:8000,MCP endpoint 为:

/mcp/

如果平台支持自定义启动命令,建议使用:

uv run python server_remote.py

或在平台环境中提前安装依赖后使用:

python server_remote.py

项目结构

.
├── README.md
├── pyproject.toml
├── server.py
├── server_remote.py
└── uv.lock

许可证

如需开源发布,请根据实际情况补充 License 文件。

Install Server
F
license - not found
A
quality
D
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    -
    quality
    D
    maintenance
    An MCP server that provides real-time weather data, hourly forecasts, and daily summaries using the free Open-Meteo API with no API key required. It enables users to search for weather conditions by specific coordinates or city names across multiple measurement units.
    1
    MIT
  • A
    license
    -
    quality
    C
    maintenance
    Real-time weather query MCP server providing current weather for cities via wttr.in, with support for listing built-in city mappings and server metadata.
    MIT

View all related MCP servers

Related MCP Connectors

  • OpenWeather MCP — wraps the OpenWeatherMap API (openweathermap.org)

  • Open-Meteo MCP — weather forecast + historical reanalysis + sister APIs

  • WeatherAPI.com MCP — wraps WeatherAPI.com (api.weatherapi.com)

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/liusicheng/mcp-weather'

If you have feedback or need assistance with the MCP directory API, please join our Discord server