Code samples for the blog post Hosting Remote MCP Servers on Azure Functions: GA vs. Preview Options.
Azure Functions supports three distinct ways to expose tools to AI agents. Each folder in this repo corresponds to one option.
Do you have an existing MCP SDK server?
├── Yes → Is it Streamable HTTP + stateless?
│ ├── Yes → option2-self-hosted-sdk
│ └── No → option1-binding-extension (rewrite required)
└── No → Do you need async, decoupled, fault-tolerant execution?
├── Yes → option3-queue-based
└── No → option1-binding-extension (default)
Production deadline this quarter? Avoid
option2-self-hosted-sdk— it is in preview and configuration details change.
| Folder | Option | Status | Verified |
|---|---|---|---|
option1-binding-extension |
MCP binding extension | GA | ✓ say_hello tool called from GitHub Copilot agent mode |
option2-self-hosted-sdk |
Self-hosted MCP SDK via FastMCP | Preview | ✓ get_weather returned 18.6°C for Amsterdam |
option3-queue-based |
Queue-based tool | GA | ✓ Result message written to tool-results Service Bus queue |
Microsoft.Azure.Functions.Worker.Sdk (all versions to 2.0.7) generates a WorkerExtensions.csproj hardcoded to net6.0. The MCP extension package requires net8.0, so a plain build fails with:
error NU1202: Package Microsoft.Azure.Functions.Extensions.Mcp is not compatible with net6.0
The workaround is already applied in this repo — extension bundle in host.json, PrivateAssets="all" on extension packages, and 1.0.0-preview.3 for the MCP package. See option1-binding-extension/README.md for the full explanation.
Tracked upstream: azure-functions-dotnet-worker #2924.
Core Tools 4.12.1 on Windows detects Python architecture from the OS rather than from registered Python installations. On machines that have ever had ARM64 Python installed, Core Tools keeps looking for an ARM64 worker even after uninstalling ARM64 Python and clearing all registry entries.
Workaround: Test in WSL2 (Ubuntu) where the Linux ARM64 worker is present and the detection bug does not apply. See option2-self-hosted-sdk/README.md for the full account.
Pin to mcp==1.9.0. Versions below 1.6.0 don't have mcp.server.streamable_http. Version 1.28.x has a different API. See option2-self-hosted-sdk/README.md for details.
- Azure Functions Core Tools v4 (tested on 4.12.1)
- Azure Developer CLI (azd)
- .NET 8 SDK (options 1 and 3)
- Python 3.11+ (option 2 — use WSL2 on Windows)
- Azurite for local storage emulation
- An Azure subscription with an active resource group (option 3 requires Service Bus)
This repo accompanies an ongoing series on AI and Azure Functions at sjwiggers.com.