一个使用OpenWeatherMap API提供天气信息的现代代码协议(MCP)服务器。
要通过Smithery为Claude Desktop自动安装天气MCP服务器:
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 -> 设置 -> 开发者 -> 编辑配置
{
"mcpServers": {
"mcp-weather-project": {
"command": "uv",
"args": [
"--directory",
"/<绝对路径>/weather-mcp-server/src/resources",
"run",
"server.py"
],
"env": {
"WEATHER_API_KEY": "你的API密钥"
}
}
}
}

git clone https://github.com/CodeByWaqas/weather-mcp-server
安装MCP服务器依赖项:
cd weather-mcp-server
# 创建虚拟环境并激活它
uv venv
source .venv/bin/activate # MacOS/Linux
# 或者
.venv/Scripts/activate # Windows
# 安装依赖项
uv add "mcp[cli]" python-dotenv requests httpx

src/resources/env.example
复制到src/resources/.env
.env
文件中添加你的OpenWeatherMap API密钥:WEATHER_API_KEY=你的API密钥
运行Claude Desktop并使用LLM获取天气信息
本项目采用MIT许可证 - 详情请参阅LICENSE文件。