使用说明
调用Weather API的MCP服务器
- 天气API使用-Mateo-https://api.open-meteo.com/v1/
- Server.py-定义MCP工具并调用API的Python代码
安装基于uv-Rust的Python打包器(windows)
winget install --id=astral-sh.uv -e
项目设置
uv init
uv venv
source .venv/bin/activate
uv add "mcp[cli]" httpx
跑
mcp dev server.py
- MCP检查员可在http://127.0.0.1:6274
- 连接->工具->列表工具->get_current_weather
- 输入纬度和经度,例如63.4463991、10.8127596
- “工具结果”->您将看到一个包含天气数据的JSON对象
