A full Model Context Protocol (MCP) project containing:
- A custom MCP Weather Server (Python, FastMCP, NWS API)
- A custom MCP Client (Python, Anthropic API, Claude tool-use)
- Fully interactive tool-calling between Claude ↔ Server
- Built following Anthropic's tutorials: Build an MCP Server + Build an MCP Client
- Provides two MCP tools:
get_alerts(state)— fetch active NWS alertsget_forecast(latitude, longitude)— fetch 5-period weather forecast
- Uses:
FastMCPhttpxasync HTTP requests
- Safe for STDIO (no
print(), useslogging)
- Connects to any MCP server (
.pyor.js) - Sends queries to Claude using the Anthropic API
- Automatically executes tool calls requested by Claude
- Maintains full interactive chat loop
Query: What's the weather in Sacramento?
→ Claude → MCP Tool → Server → Forecast → Claude → You
Query: Show me alerts in TX
→ get_alerts("TX")
- Python 3.10+
- MCP Python SDK
- FastMCP
- Anthropic API
- httpx
- uv
- python-dotenv
Claude analyzes the query
→ chooses tools
→ client executes the tool
→ server returns data
→ client sends result back
→ Claude produces final text
- Do not use
print()in STDIO servers - Use
loggingso output goes to stderr - Keep API keys in
.env - Claude Desktop requires absolute paths
- NWS API only supports U.S. weather data
{
"mcpServers": {
"weather": {
"command": "uv",
"args": [
"--directory",
"C:\\ABSOLUTE\\PATH\\TO\\weather",
"run",
"weather.py"
]
}
}
}MIT License (modify as needed)