Sponsored by Deepsite.site

Mcp Server Weather Example

Created By
aman-panjwani8 months ago
Example project demonstrating how to deploy MCP Servers using Azure Container Apps with a weather data processing use case. This repo showcases best practices for containerizing, configuring, and deploying scalable MCP Servers on Azure for real-time data ingestion and analysis.
Content

Deploying & Connecting Your Remote MCP Weather Server

This project lets you deploy a cloud-based Model Context Protocol (MCP) server that delivers real-time weather data using the U.S. National Weather Service API. It’s built with FastAPI, supports Server-Sent Events (SSE) for real-time communication, and uses secure API key authentication.

This repository provides a ready-to-deploy Weather MCP server. You'll walk through the full setup from cloning the code, configuring authentication, deploying to Azure Container Apps, and finally connecting it inside Visual Studio Code using the MCP extension.


Clone the Repository

git clone https://github.com/your-username/mcp-weather-server.git
cd mcp-weather-server

Understand the Structure

Before deploying, familiarize yourself with the core components:

  • weather.py – Defines two tools: get_alerts() and get_forecast() using the U.S. National Weather Service API.
  • main.py – Wraps the tools in a FastAPI app exposed at /sse, with support for SSE.
  • api_key_auth.py – Implements x-api-key header-based security for incoming requests.
  • Dockerfile – Builds and packages the app using Python 3.13 and the uv web server.

Configure API Key Authentication

Set your API key(s) securely via an environment variable:

export API_KEYS=<YOUR_API_KEY>

You can also supply multiple comma-separated keys. No need to hardcode secrets into the source code.


Build & Deploy to Azure Container Apps

Use the Azure CLI to build and deploy in a single step:

az containerapp up \
  -g <RESOURCE_GROUP> \
  -n weather-mcp \
  --environment <CONTAINERAPPS_ENV_NAME> \
  -l westus \
  --env-vars API_KEYS=<YOUR_API_KEY> \
  --source .

This command will:

  • Build the image using the included Dockerfile.
  • Deploy it to Azure Container Apps.
  • Inject your API key(s) via --env-vars.

Once deployed, Azure CLI will return a public URL this is the endpoint your MCP clients will use.

ContainerAppDeployResponse


Connect from Visual Studio Code

With the server up, connect it inside VS Code:

  1. Create a .vscode/mcp.json file in your project:
{
  "inputs": [
    {
      "type": "promptString",
      "id": "weather-api-key",
      "description": "Weather API Key",
      "password": true
    }
  ],
  "servers": {
    "weather-sse": {
      "type": "sse",
      "url": "https://weather-mcp.orangebush.westus.azurecontainerapps.io/sse",
      "headers": {
        "x-api-key": "${input:weather-api-key}"
      }
    }
  }
}
  1. Open the MCP extension sidebar in VS Code.
  2. Click Start next to your server entry.
  3. Enter the API key when prompted.

You're now connected and ready to process real-time weather queries.


Try It with GitHub Copilot Chat (Agent Mode)

  1. Launch GitHub Copilot Chat in Agent mode.
  2. Ask something like:

"How's the weather forecast in Georgia?"

The agent will call your get_forecast tool behind the scenes and return a live forecast based on NWS data.

RunAgent


You're All Set!

Your MCP server is now:

  • Cloud-hosted
  • API-key protected
  • Integrated with VS Code and GitHub Copilot

You can now build custom agents that interact with real-time weather data from anywhere.

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
Tavily Mcp
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
WindsurfThe new purpose-built IDE to harness magic
Playwright McpPlaywright MCP server
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
DeepChatYour AI Partner on Desktop
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
Serper MCP ServerA Serper MCP Server
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
CursorThe AI Code Editor
Amap Maps高德地图官方 MCP Server
ChatWiseThe second fastest AI chatbot™
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs