This document describes the Model Context Protocol (MCP) weather integration added to the Contoso AI Apps Backend for enhanced yacht tour booking with weather awareness.
The MCP weather integration consists of:
mcp_weather_server.py
) - A standalone MCP server that interfaces with the National Weather Service APIshared/mcp_weather_client.py
) - Client interface for communicating with the MCP servershared/assistant_tools_weather.py
) - Weather tools integrated into the Veta assistant┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Veta Assistant │───▶│ MCP Client │───▶│ MCP Server │
│ (ask_veta.py) │ │ (sync wrapper) │ │ (weather API) │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│
▼
┌─────────────────┐
│ National Weather│
│ Service API │
└─────────────────┘
get_weather_forecast
- Get detailed weather forecast dataget_weather_summary_for_client
- Get client-friendly weather summarycheck_weather_suitable_for_yacht_tour
- Assess weather suitability for yacht toursget_contoso_islands_weather
- Get weather for all Contoso Islands locationsThe following packages have been added to requirements.txt
:
mcp == 1.3.0
httpx == 0.28.1
pip install -r requirements.txt
python test_mcp_weather.py
Customer: "I'd like to book yacht 200 for next Friday"
Veta: "Let me check availability and weather conditions..."
Veta: "Great! Yacht 200 is available for $800. Let me check the weather..."
Veta: "🌊 Weather Information for Your Yacht Tour Location 🌊
Friday: Temperature 72°F, Partly Cloudy
Conditions look excellent for yacht touring!
Would you be comfortable proceeding with this weather forecast?"
Customer: "Yes, that sounds perfect!"
Veta: "Excellent! I'll proceed with your reservation..."
Run the test script to verify MCP integration:
python test_mcp_weather.py
Test through the Veta assistant by:
ContosoAIAppsBackend/
├── mcp_weather_server.py # MCP weather server
├── test_mcp_weather.py # Test script
├── controllers/
│ └── ask_veta.py # Updated Veta controller
├── shared/
│ ├── mcp_weather_client.py # MCP client
│ └── assistant_tools_weather.py # Weather tools
└── assistant_configurations/
├── veta.json # Updated tool definitions
└── veta.txt # Updated system message
# Test MCP server directly
python mcp_weather_server.py
# Test weather tools
python -c "from shared.assistant_tools_weather import v_get_weather_forecast; print(v_get_weather_forecast('25.7617', '-80.1918'))"
# Check configuration
python -c "from application_settings import ApplicationSettings; settings = ApplicationSettings(); print(settings.get_assistant_config('veta')['tools'][-1])"
Potential improvements:
For issues related to MCP weather integration: