A MCP server for querying current weather and forecasts via OpenWeatherMap API
Project description
accton-mcpdemo-weather
一个基于 MCP (Model Context Protocol) 的天气查询服务器,通过 OpenWeatherMap API 提供实时天气和未来天气预报。
功能
- 🌍 查询全球城市的当前实时天气(温度、湿度、风速、气压、日出日落等)
- 📅 查询未来 5 天的天气预报(每 3 小时一个时段,含降水概率)
- 🌐 支持中文和英文城市名称
安装
pip install accton-mcpdemo-weather
配置
使用前需要设置环境变量:
export OPENWEATHER_API_KEY="your-api-key"
在 OpenWeatherMap 注册即可免费获取 API Key。
使用
命令行运行
accton-mcpdemo-weather
作为 MCP Server 配置
在 Claude Desktop 或其他 MCP 客户端的配置文件中添加:
{
"mcpServers": {
"weather": {
"command": "uvx",
"args": ["accton-mcpdemo-weather"],
"env": {
"OPENWEATHER_API_KEY": "your-api-key"
}
}
}
}
提供的工具
| 工具 | 说明 |
|---|---|
get_current_weather |
获取指定城市的当前实时天气 |
get_weather_forecast |
获取指定城市未来某天的天气预报 |
get_weather |
综合查询:不传日期返回当前天气,传日期返回预报 |
开发
# 克隆仓库
git clone https://github.com/your-repo/accton-mcpdemo-weather.git
cd accton-mcpdemo-weather
# 安装依赖
uv sync
# 运行
uv run accton-mcpdemo-weather
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file accton_mcpdemo_weather-0.1.9.tar.gz.
File metadata
- Download URL: accton_mcpdemo_weather-0.1.9.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f65edd815f429df9a667b0132fcfb1d98bf88187be21a59e6734259068bec9d
|
|
| MD5 |
95f798b67bcf9a622cb4001d83fc1706
|
|
| BLAKE2b-256 |
bcfafac0035b49d97e71428c2a665d84a40d660662f5a8ac54cf3d79e744cf43
|
File details
Details for the file accton_mcpdemo_weather-0.1.9-py3-none-any.whl.
File metadata
- Download URL: accton_mcpdemo_weather-0.1.9-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8a0cbf3c079e4fd8a2aced3b6255d8ec295f425acf4451128f33f665fda689b2
|
|
| MD5 |
6ac15d902862a10acedf093d2b14db44
|
|
| BLAKE2b-256 |
f7223886a23ab669a5e1354dbc3141851c71fa9c4811370eed25b9718846db57
|