一个使用 OpenWeatherMap API 提供天气信息的现代代码协议 (MCP) 服务器,能够帮助用户便捷地获取实时天气数据。
通过 Smithery 可自动安装 Weather MCP Server for Claude Desktop:
npx -y @smithery/cli install @CodeByWaqas/weather-mcp-server --client claude
python -m venv .venv
source .venv/bin/activate # 在 Windows 上使用:.venv\Scripts\activate
pip install -e .
# claude_desktop_config.json
# 可以通过以下位置找到位置:
# Claude -> Settings -> Developer -> Edit Config
{
"mcpServers": {
"mcp-weather-project": {
"command": "uv",
"args": [
"--directory",
"/<绝对路径>/weather-mcp-server/src/resources",
"run",
"server.py"
],
"env": {
"WEATHER_API_KEY": "YOUR_API_KEY"
}
}
}
}
git clone https://github.com/CodeByWaqas/weather-mcp-server
cd weather-mcp-server
# 创建虚拟环境并激活它
uv venv
source .venv/bin/activate # MacOS/Linux
# 或者在 Windows 上
.venv/Scripts/activate
# 安装依赖
uv add "mcp[cli]" python-dotenv requests httpx
src/resources/env.example 到 src/resources/.env。.env 文件中:WEATHER_API_KEY=your_api_key_here
运行 Claude Desktop 并使用大语言模型(LLM)获取天气信息。
此项目遵循 MIT 许可证 - 请查看 LICENSE 文件以获取详细信息。