Python Weather Server is an MCP server that provides weather forecasts and alert data from the National Weather Service API, protected by OAuth 2.1 authentication. It connects AI assistants and MCP clients to official United States meteorological data while using Microsoft Entra ID (Azure AD) for enterprise-grade security. Software developers, system architects, and AI engineers use this server as a production-ready reference architecture for deploying authenticated remote MCP applications. The server enables client applications to fetch active US weather alerts by state and pull detailed forecasts for specific geographical coordinates. Built with FastAPI, it implements dynamic client registration, mandatory Proof Key for Code Exchange (PKCE) validation with S256, authorization server metadata discovery, and JSON Web Token (JWT) verification. The codebase is configured for deployment to Azure App Service using the Azure Developer CLI, providing a complete framework for testing and running remote Model Context Protocol services with strict protocol version header compliance.
Category: Maps, Weather & Local Data
Tags: fastapi, nws, oauth, weather
bash git clone https://github.com/Azure-Samples/remote-mcp-webapp-python-auth-oauth cd remote-mcp-webapp-python-auth-oauth python -m venv venv pip install -r requirements.txt 2. Configure your environment variables in .env with your Azure OAuth credentials following AUTH_SETUP.md. 3. Start the server locally with uvicorn main:app --host 0.0.0.0 --port 8000. 4. Visit http://localhost:8000/mcp_oauth_test.html in your browser to complete the OAuth 2.1 flow and obtain a JWT token. 5. Register the HTTP server in your MCP client configuration: json { "mcpServers": { "weather-mcp-server-local": { "transport": { "type": "http", "url": "http://localhost:8000/", "headers": { "Authorization": "Bearer <your-jwt-token>" } } } } }Part of MCP Servers
Python Weather Server connects MCP clients to the National Weather Service API to retrieve real-time US weather alerts and detailed regional forecasts. It also handles end-to-end OAuth 2.1 authentication flows, including dynamic client registration, authorization server metadata discovery, and JWT token validation.
Clone the Azure-Samples repository, set up a Python 3.8+ virtual environment, and install dependencies from requirements.txt. Configure your Azure AD credentials in the environment file, launch the FastAPI server with uvicorn, and retrieve a JWT token via the included test interface before configuring your MCP client.
Any MCP-compatible client that supports HTTP remote transport and authorization headers can connect to this server. It can be tested using the MCP Inspector by setting the transport to HTTP, specifying the server URL, and including the Bearer token in the header configuration.
Yes, Python Weather Server is an open-source project hosted on GitHub under the Azure-Samples organization. You can inspect the source code, modify it for custom implementations, or deploy it directly to your Azure infrastructure.