This document describes the Model Context Protocol (MCP) weather integration that has been added to the Contoso AI Apps Backend to provide weather forecasting capabilities for yacht tour reservations.
The MCP weather integration consists of three main components:
mcp_weather_server.py
) - A standalone MCP server that integrates with the National Weather Service APIshared/mcp_weather_client.py
) - A client library for communicating with the MCP servershared/assistant_tools_weather.py
) - Assistant tools that integrate weather functionality into the existing Azure Functions backendAzure Functions Backend (Veta Assistant)
↓ calls weather tools
Weather Tools (assistant_tools_weather.py)
↓ uses MCP client
MCP Weather Client (mcp_weather_client.py)
↓ communicates via JSON-RPC over stdio
MCP Weather Server (mcp_weather_server.py)
↓ makes HTTP requests
National Weather Service API (api.weather.gov)
get_weather_forecast
- Get detailed forecast data as JSONget_weather_summary_for_client
- Get client-friendly formatted summarycheck_weather_suitable_for_yacht_tour
- Assess weather suitability with criteriaget_contoso_islands_weather
- Get weather for all tour locationsThe system includes predefined coordinates for major tour locations:
# New dependencies in requirements.txt
mcp == 1.3.0
httpx == 0.28.1
Weather tools are registered in controllers/ask_veta.py
:
from shared.assistant_tools_weather import (
v_get_weather_forecast,
v_get_weather_summary_for_client,
v_check_weather_suitable_for_yacht_tour,
v_get_contoso_islands_weather
)
# Tool mappings
util.register_tool_mapping("get_weather_forecast", v_get_weather_forecast)
util.register_tool_mapping("get_weather_summary_for_client", v_get_weather_summary_for_client)
util.register_tool_mapping("check_weather_suitable_for_yacht_tour", v_check_weather_suitable_for_yacht_tour)
util.register_tool_mapping("get_contoso_islands_weather", v_get_contoso_islands_weather)
Weather tools are defined in assistant_configurations/veta.json
with proper JSON Schema validation.
The agent system message (assistant_configurations/veta.txt
) has been updated with:
AsyncClient
Run the integration test:
cd /workspaces/wth-aiapps-codespace/ContosoAIAppsBackend
python test_weather_integration.py
Potential improvements:
✅ Complete Features:
✅ Verified Components:
The MCP weather integration is now fully implemented and ready for use with the Contoso AI Apps Backend.