Sponsored by Deepsite.site

Azure Container Apps remote MCP server example

Created By
KRVaghani8 months ago
Content

Azure Container Apps remote MCP server example

This MCP server uses SSE transport and is authenticated with an API key.


Project Overview

This project is a FastAPI-based Model Context Protocol (MCP) server designed for Azure Container Apps. It provides weather-related tools (such as alerts and forecasts) via a secure, API-key-protected Server-Sent Events (SSE) interface. The server is intended for integration with MCP-compatible clients, such as Visual Studio Code or custom scripts.

Setup Instructions

  1. Clone the repository:
    git clone https://github.com/KRVaghani/Azure-MCP-Server.git
    cd Azure-MCP-Server
    
  2. Install prerequisites:
    • Python 3.11 or later
    • uv
  3. Set up the virtual environment and dependencies:
    uv venv
    uv sync
    
  4. Set the API key:
    export API_KEYS=devkey  # or your chosen key
    
  5. Run the server:
    uv run fastapi dev main.py
    

Client Usage

A sample Python client (model_request_client.py) is included for command-line interaction:

python model_request_client.py
  • Enter your API key (default: devkey)
  • Choose a tool: get_alerts (by US state) or get_forecast (by latitude/longitude)
  • Enter the required parameters
  • The server response will be displayed in your terminal

API Endpoints

  • /sse (GET): Main SSE endpoint for MCP protocol communication. Requires x-api-key header.
  • /messages (SSE): Used internally for message streaming (session-based).

Example curl Test

curl -H "x-api-key: devkey" http://localhost:8000/sse

Troubleshooting

  • If you see ModuleNotFoundError, ensure your virtual environment is activated and dependencies are installed.
  • If the client hangs, check that the server is running and the API key matches.
  • For pip issues in the venv, run:
    python -m ensurepip --upgrade
    python -m pip install --upgrade pip
    

Contributing

Pull requests are welcome! Please open an issue first to discuss major changes.

License

MIT License (add LICENSE file if needed)

Running locally

Prerequisites:

  • Python 3.11 or later
  • uv

Run the server locally:

uv venv
uv sync

# linux/macOS
export API_KEYS=<AN_API_KEY>
# windows
set API_KEYS=<AN_API_KEY>

uv run fastapi dev main.py

VS Code MCP configuration (mcp.json):

{
    "inputs": [
        {
            "type": "promptString",
            "id": "weather-api-key",
            "description": "Weather API Key",
            "password": true
        }
    ],
    "servers": {
        "weather-sse": {
            "type": "sse",
            "url": "http://localhost:8000/sse",
            "headers": {
                "x-api-key": "${input:weather-api-key}"
            }
        }
    }
}

Deploy to Azure Container Apps

az containerapp up -g <RESOURCE_GROUP_NAME> -n weather-mcp --environment mcp -l westus --env-vars API_KEYS=<AN_API_KEY> --source .

If the deployment is successful, the Azure CLI returns the URL of the app. You can use this URL to connect to the server from Visual Studio Code.

If the deployment fails, try again after updating the CLI and the Azure Container Apps extension:

az upgrade
az extension add -n containerapp --upgrade
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
WindsurfThe new purpose-built IDE to harness magic
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
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.
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
DeepChatYour AI Partner on Desktop
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.
Amap Maps高德地图官方 MCP Server
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
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"
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.
CursorThe AI Code Editor
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
ChatWiseThe second fastest AI chatbot™
Playwright McpPlaywright MCP server
Serper MCP ServerA Serper MCP Server
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.