About 天气 MCP 服务器
A weather MCP server built with FastMCP and the OpenWeather API. It is for users of MCP clients who need city forecasts of up to five days and current air-quality information.
Key features
- 01Get forecasts for up to five days
- 02Check current air quality
- 03Retrieve data through OpenWeather API
Use cases
- 01Check a city's forecast for coming days
- 02Look up current air quality in a city
MCP support
The server provides MCP clients with tools for retrieving weather forecasts and air-quality information. The README shows how to configure it in a client.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project README天气 MCP 服务器
这是一个使用 OpenWeather API 获取天气数据和空气质量的 Model Context Protocol (MCP) 服务器。
功能
- 获取任何城市的详细天气预报(最多 5 天)
- 获取任何城市的当前空气质量信息
安装
前提条件
- Python 3.11+
- OpenWeather API 密钥(可在 OpenWeather 获取)
- Anthropic Claude Desktop 应用(或其他 MCP 客户端)
- UV 包管理工具(https://github.com/astral-sh/uv)
步骤
-
克隆仓库
git clone https://github.com/odinggg/weather-mcp.git cd weather-mcp -
连接到 MCP 服务器
将以下 JSON 配置添加到您的 MCP 客户端(例如 Claude Desktop)中:
{
"mcpServers": {
"weather": {
"command": "uv", // uv path
"args": [
"--directory",
"/your/path/to/weather-mcp",
"run",
"-m",
"weather_mcp_server.main",
"--api-key",
"xxxxxxxxxxxxxxx"
]
}
}
}
对于 Claude Desktop,将此保存为 claude_desktop_config.json,位置在:
~/Library/Application Support/Claude/claude_desktop_config.json
使用方法
连接后,您可以使用天气 MCP 服务器:
-
获取天气预报:
- 向 Claude 询问任何城市的天气预报
- 指定预报的天数(最多 5 天)
-
获取空气质量信息:
- 向 Claude 询问任何城市的空气质量
示例提示:
- "未来 3 天北京的天气预报是什么?"
- "现在上海的空气质量如何?"
故障排除
- 如果遇到关于 API 密钥的错误,确保您在命令行参数中正确提供了 API 密钥
- 确保您的网络可以访问 OpenWeather API
- 检查您的 MCP 客户端中的服务器配置是否正确
技术细节
该服务器使用:
- OpenWeather API 获取天气数据
- FastMCP 框架实现 MCP 协议
- Python 的 requests 库进行 API 交互
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.