Azure Container Apps remote MCP server example

Azure Container Apps remote MCP server example

By KRVaghani GitHub

-

azure mcp
Overview

What is Azure-MCP-Server?

Azure-MCP-Server is a FastAPI-based Model Context Protocol (MCP) server designed for Azure Container Apps, providing weather-related tools such as alerts and forecasts through a secure API-key-protected Server-Sent Events (SSE) interface.

How to use Azure-MCP-Server?

To use Azure-MCP-Server, clone the repository, set up the virtual environment, install dependencies, set your API key, and run the server. A sample Python client is included for command-line interaction.

Key features of Azure-MCP-Server?

  • Provides weather alerts and forecasts via SSE.
  • Secure API key authentication.
  • Integration with MCP-compatible clients like Visual Studio Code.

Use cases of Azure-MCP-Server?

  1. Real-time weather alerts for specific US states.
  2. Weather forecasts based on geographic coordinates.
  3. Integration with custom scripts for automated weather data retrieval.

FAQ from Azure-MCP-Server?

  • What programming language is used?

The server is built using Python 3.11 or later.

  • How do I deploy it to Azure?

Use the Azure CLI command provided in the documentation to deploy the server to Azure Container Apps.

  • What should I do if I encounter errors?

Check the troubleshooting section in the documentation for common issues and solutions.

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
No tools information available.
School MCP
School MCP by 54yyyu

A Model Context Protocol (MCP) server for academic tools, integrating with Canvas and Gradescope platforms.

canvas mcp
View Details
repo-template
repo-template by loonghao

A Model Context Protocol (MCP) server for Python package intelligence, providing structured queries for PyPI packages and GitHub repositories. Features include dependency analysis, version tracking, and package metadata retrieval for LLM interactions.

-

google-calendar mcp
View Details
strava-mcp
strava-mcp by jeremysilva1098

MCP server for strava

strava mcp
View Details

Model Context Protocol (MCP) server implementation for Rhinoceros/Grasshopper integration, enabling AI models to interact with parametric design tools

grasshopper mcp
View Details

MCP configuration to connect AI agent to a Linux machine.

security mcp
View Details

AI assistant built with Streamlit, NVIDIA NIM (LLaMa 3.3:70B) / Ollama, and Model Control Protocol (MCP).

python mcp
View Details