esrp-mcp-server-python 0.0.1
ESRP MCP Server - Azure Functions Python implementation for discovering and validating Microsoft certified OSS packages
License: MIT
Requires Python: >=3.9
Keywords: azure-functions, mcp, esrp, certified-packages

# Getting Started with Remote MCP Servers using Azure Functions (Python)

This is a quickstart template to easily build and deploy a custom remote MCP server to the cloud using Azure Functions with Python. You can clone/restore/run on your local machine with debugging, and `azd up` to have it in the cloud in a couple of minutes. The MCP server is secured by design using keys and HTTPS, and allows more options for OAuth using EasyAuth and/or API Management as well as network isolation using VNET.

## Prerequisites

+ [Python 3.9+](https://www.python.org/downloads/)
+ [Azure Functions Core Tools](https://learn.microsoft.com/azure/azure-functions/functions-run-local?pivots=programming-language-python#install-the-azure-functions-core-tools) >= `4.0.7030`
+ [Azure Developer CLI](https://aka.ms/azd)
+ To use Visual Studio Code to run and debug locally:
  + [Visual Studio Code](https://code.visualstudio.com/)
  + [Azure Functions extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurefunctions)
  + [Python extension](https://marketplace.visualstudio.com/items?itemName=ms-python.python)
+ [Docker](https://www.docker.com/) to run Azurite, the Azure Storage Emulator (optional)

## Prepare your local environment

An Azure Storage Emulator is needed for this particular sample because Azure Functions requires a storage account for certain operations.

1. **Start Azurite** (if using Docker):
   ```bash
   docker run -p 10000:10000 -p 10001:10001 -p 10002:10002 mcr.microsoft.com/azure-storage/azurite
   ```

2. **Create a Python virtual environment**:
   ```bash
   python -m venv .venv
   ```

3. **Activate the virtual environment**:
   
   On Windows:
   ```powershell
   .\.venv\Scripts\Activate.ps1
   ```
   
   On macOS/Linux:
   ```bash
   source .venv/bin/activate
   ```

4. **Install dependencies**:
   ```bash
   pip install -r requirements.txt
   ```

## Run and Debug Locally

1. Open the project in VS Code
2. Make sure Azurite is running
3. Press `F5` to start debugging, or run:
   ```bash
   func start
   ```

## Deploy to Azure

1. **Login to Azure** (if not already logged in):
   ```bash
   azd auth login
   ```

2. **Provision and deploy**:
   ```bash
   azd up
   ```

This will:
- Create the required Azure resources (Resource Group, Storage Account, Function App)
- Deploy your Python MCP server to Azure Functions

## MCP Tools Available

This MCP server exposes the following tools:

| Tool Name | Description |
|-----------|-------------|
| `microsoftCertifiedNodeJsPackages` | Get a list of Microsoft certified Node.js packages |
| `microsoftCertifiedPythonPackages` | Get a list of Microsoft certified Python packages |
| `microsoftCertifiedJavaPackages` | Get a list of Microsoft certified Java packages |
| `validateMicrosoftPackageIntegrity` | Validate the integrity of a Microsoft certified package |
| `validateImageSKUUpdate` | Validate whether an image SKU update is recommended |

## Project Structure

```
esrp-mcp-server-python/
├── function_app.py        # Main Azure Functions app with MCP tools
├── host.json              # Azure Functions host configuration
├── local.settings.json    # Local settings (not committed to git)
├── azure.yaml             # Azure Developer CLI configuration
├── requirements.txt       # Python dependencies
├── server.json            # MCP server manifest
├── data/                  # Data files
│   ├── publishedPackages.json   # List of certified packages
│   └── packageHashes.json       # Package hash information
└── README.md              # This file
```

## Configuration

### Environment Variables

| Variable | Description |
|----------|-------------|
| `FUNCTIONS_WORKER_RUNTIME` | Set to `python` |
| `AzureWebJobsStorage` | Connection string for Azure Storage |

## Connecting MCP Clients

After deployment, you can connect MCP clients to your remote MCP server using the function URL provided by Azure Functions. The URL format will be:

```
https://<your-function-app>.azurewebsites.net/runtime/webhooks/mcp/sse
```

Make sure to include the function key for authentication.

## License

This project is licensed under the MIT License - see the LICENSE.md file for details.