srjv11/mcp-server-weather-py
If you are the rightful owner of mcp-server-weather-py and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
The Weather MCP Server is a production-ready server that provides weather data from the National Weather Service API, featuring caching, monitoring, robust error handling, and comprehensive testing.
get_alerts
Get weather alerts with optional severity filtering
get_forecast
Get weather forecast for specific coordinates
get_location_forecast
Get weather forecast by city and state
health_check
Check server health and performance metrics
Weather MCP Server
A comprehensive, production-ready MCP (Model Context Protocol) server providing weather data from the National Weather Service API with caching, monitoring, robust error handling, and comprehensive testing.
๐ Quick Start
# Install dependencies
uv sync --group dev
# Run the weather MCP server
uv run weather-mcp
# or
uv run -m src.main
# Run tests
uv run pytest tests/ -v
# Run code quality checks
ruff check --fix && ruff format
๐ Project Structure
mcp-server-weather-py/
โโโ ๐ Core Application
โ โโโ src/
โ โโโ main.py # Main entry point
โ โโโ client.py # HTTP client with caching
โ โโโ config.py # Configuration management
โ โโโ exceptions.py # Custom exception classes
โ โโโ formatters.py # Data formatting utilities
โ โโโ models.py # Data models and types
โ โโโ tools.py # MCP tools implementation
โ โโโ validators.py # Input validation
โ โโโ weather.py # Alternative entry point
โ
โโโ ๐งช Testing & Quality
โ โโโ tests/
โ โโโ test_client.py # HTTP client tests
โ โโโ test_config.py # Configuration tests
โ โโโ test_exceptions.py # Exception handling tests
โ โโโ test_formatters.py # Data formatting tests
โ โโโ test_models.py # Data model tests
โ โโโ test_tools.py # MCP tools tests
โ โโโ test_validators.py # Validation tests
โ โโโ test_weather.py # Main module tests
โ
โโโ ๐ณ Deployment
โ โโโ Dockerfile # Container configuration
โ โโโ docker-compose.yml # Multi-service orchestration
โ โโโ .dockerignore # Container build optimization
โ
โโโ ๐ Configuration & Documentation
โ โโโ pyproject.toml # Package configuration & dependencies
โ โโโ CLAUDE.md # Development guide
โ โโโ MCP_SETUP.md # MCP integration guide
โ โโโ docs/README_ENHANCED.md # Detailed enhancement documentation
โ
โโโ ๐ Examples & Utilities
โโโ examples.py # Usage examples & demos
โโโ example_state_machine.py # Educational state machine example
โโโ setup_script.py # Setup automation script
โจ Features
- ๐ก๏ธ Robust Error Handling: Custom exception hierarchy with retry logic
- โก Performance: In-memory caching with TTL and rate limiting
- ๐ Monitoring: Health checks and structured logging
- ๐งช Comprehensive Testing: 95%+ test coverage across 8 modules
- ๐ณ Production Ready: Docker support and deployment configs
- ๐ง Configurable: Environment-based configuration
- ๐ MCP Integration: Ready for Claude Code integration
๐ ๏ธ API Reference
Core MCP Tools
get_alerts(state, severity_filter=None)
: Get weather alerts with optional severity filteringget_forecast(latitude, longitude)
: Get weather forecast for specific coordinatesget_location_forecast(city, state)
: Get weather forecast by city and statehealth_check()
: Check server health and performance metrics
๐งช Testing
# Run all tests with coverage
uv run pytest tests/ -v --cov=. --cov-report=html
# Run specific test modules
uv run pytest tests/test_validators.py -v
uv run pytest tests/test_tools.py -v
Test Coverage: 46 tests across 8 modules covering validation, data models, HTTP client, MCP tools, formatting, exceptions, and configuration.
๐ณ Deployment
Local Development
uv sync --group dev
uv run weather-mcp
Docker Deployment
docker build -t weather-mcp .
docker run -it weather-mcp
Production with Docker Compose
docker-compose up -d
๐ MCP Integration
Connect to Claude Code for interactive weather queries. See MCP_SETUP.md for complete setup instructions.
๐ Documentation
Quick Reference
- CLAUDE.md: Development guide with commands and architecture details
- MCP_SETUP.md: Claude Code integration instructions
- examples.py: Interactive usage demonstrations
Comprehensive Documentation
- ๐ Project Wiki: Complete documentation including:
Weather MCP Server - Production-ready weather data for Large Language Models ๐ค๏ธ