Build a smart weather server which offers two APIs (get_alerts and get_forecast) for Claude for Desktop to use based on MCP (Model Context Protocol).
curl -LsSf https://astral.sh/uv/install.sh | sh
# Create virtual environment and activate it
uv venv
source .venv/bin/activate
# Install dependencies
uv add "mcp[cli] httpx
uv run weather.py
# Confige (MacOS)
code ~/Library/Application\ Support/Claude/claude_desktop_config.json
# Copy the following code and replace path of weather.py and uv
{
"mcpServers": {
"weather": {
"command": "uv",
"args": [
"--directory",
"/ABSOLUTE/PATH/TO/PARENT/FOLDER/weather",
"run",
"weather.py"
]
}
}
}