MCP Weather Server

MCP Weather Server

A weather query MCP server providing current weather, forecasts, temperature conversion, and travel weather advice using wttr.in without API tokens.

Category
Visit Server

README

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。

环境要求

  • 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 文件。

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured