Weather MCP Server
A powerful weather information server built with FastMCP that provides weather alerts and tools through multiple interfaces.
Features
- 🌤️ Weather Alerts: Get real-time weather alerts for any US state
- 🔊 Echo Resource: Simple message echoing functionality
- 🖥️ Multiple Interfaces: Choose between MCP server or web interface
- 🎨 Beautiful UI: Modern, responsive web interface
Quick Start
Option 1: Interactive Launcher (Recommended)
python run_server.py
This will present you with options to run either the MCP server or web interface.
Option 2: Direct Web Interface
python server/web_interface.py
Then open your browser to: http://localhost:8000
Option 3: MCP Server Only
python main.py
Installation
-
Install dependencies:
uv sync -
Run the server:
python run_server.py
Usage
Web Interface
- Start the web interface
- Open http://localhost:8000 in your browser
- Use the forms to:
- Get weather alerts for a US state (e.g., CA, NY, TX)
- Echo messages through the resource system
MCP Server
The MCP server provides these tools:
-
get_alerts(state): Get weather alerts for a US statestate: Two-letter US state code (e.g., "CA", "NY")
-
echo_resource(message): Echo a message as a resourcemessage: Any text message to echo
API Endpoints
GET /: Main web interfacePOST /api/alerts: Get weather alerts (form data:state)POST /api/echo: Echo a message (form data:message)
Dependencies
mcp[cli]>=1.13.0: MCP server frameworkfastapi>=0.104.0: Web frameworkuvicorn[standard]>=0.24.0: ASGI serverhttpx>=0.25.0: HTTP clientpython-multipart>=0.0.6: Form data handling
Project Structure
secondproject/
├── main.py # MCP server entry point
├── run_server.py # Interactive launcher
├── server/
│ ├── weather.py # MCP server implementation
│ └── web_interface.py # Web interface
├── pyproject.toml # Project configuration
└── README.md # This file
Troubleshooting
Common Issues
- Port already in use: Change the port in
web_interface.pyor stop other services - Dependencies missing: Run
uv syncto install all dependencies - API errors: Check your internet connection for weather data
Getting Help
- Check the console output for error messages
- Ensure all dependencies are installed
- Verify Python version (requires 3.12+)
License
This project is open source and available under the MIT License.
