Azure Functions allows you remotely host servers built with the official MCP SDKs with no code changes. If you've already built a server with the Python MCP SDK, use this scaffold to quickly host the server remotely. The scaffold contains the required Azure Function artifacts, as well as Bicep files for automatic infrastructure provisioning and server deployment. Bicep is a domain-specific language that uses declarative syntax to deploy Azure resources.
Follow instructions in the mcp-sdk-functions-hosting-python repo to leverage this scaffold for hosting remote MCP servers.
Note
The hosting capability is currently in early preview.
The repo has the following main components:
host.jsonlocal.settings.jsoninfradirectory containing Bicep files for resource provisioning and server deployment
This file is required by Azure Functions for deployment. It's used by the Azure Functions host to configure the right settings (through the configuration profile) for the MCP server to run. It also tells the host how to run the server and which port to listen to.
The default authorization level is function, which would require clients to pass an access key when connecting to the server. However, because we'll use a feature called Easy Auth, which provides an authorization flow with identity providers like Microsoft Entra ID, there's no need to require a key as well for server connection.
{
"version": "2.0",
"configurationProfile": "mcp-custom-handler",
"customHandler": {
"description": {
"defaultExecutablePath": "python",
"arguments": ["<path to main script file, e.g., weather.py>"]
},
"http": {
"DefaultAuthorizationLevel": "anonymous"
},
"port": "8000"
}
}This file is required only if you want to run the server locally with Azure Functions Core Tools, which provides a local version of the Azure Functions host. It allows you to run your server locally as if it's run in the Azure Functions environment in the cloud.
{
"IsEncrypted": false,
"Values": {
"FUNCTIONS_WORKER_RUNTIME": "python",
"AzureWebJobsFeatureFlags": "EnableMcpCustomHandlerPreview"
}
}All Bicep files are in the infra directory. The main.bicep file specifies the provisioning of various Azure resources and their settings and/or configuration. Other than the Azure Functions app and the hosting plan (Flex Consumption) where the server is deployed to, other resources such as Azure Storage account, Application Insights, Virtual Network, Entra app, etc. are created as well.