使用说明
天气MCP
使用美国国家气象局API的小型MCP工具服务器。
提供两个工具: get_alerts(state) 和 get_forecast(latitude, longitude).
安装uv(Homebrew、macOS)
# Update Homebrew and install uv
brew update
brew install uv
# If Homebrew cannot find `uv`, follow the official installer from:
# https://docs.astral.sh/uv/getting-started/installation/
克隆、安装依赖项并使用uv运行
# Clone the repo
git clone https://github.com/sridharkesavan/weatherMCP.git
cd REPO
# Use uv to run pip to install runtime dependencies into uv's managed environment
# (this keeps the environment contained to uv)
uv run -- pip install httpx mcp
# Optionally add these dependencies to uv's project manifest (if you want them tracked)
# (replace with exact uv add syntax if using manifest features)
uv add pypi/httpx pypi/mcp || true
# Run the app under uv so it uses the uv-managed environment
uv run -- python main.py
# For quick testing of a function directly:
uv run -- python -c "import asyncio; from main import get_forecast; print(asyncio.run(get_forecast(37.7749, -122.4194)))"
笔记:
uv run -- <command>在uv的托管运行时中运行该命令。- 如果
uv adduv版本的语法不同,请按照uv文档将包添加到项目清单中。 - 替换
git@github.com:USERNAME/REPO.git使用您的存储库URL。
