Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The Model Context Protocol (MCP) is a client-server protocol designed to help language models and agents more efficiently discover and use external data sources and tools.
The Azure Functions MCP extension enables you to use Azure Functions to create remote MCP servers. These servers can host MCP tool trigger functions that MCP clients, such as language models and agents, can query and access to perform specific tasks. The extension also supports MCP Apps, which lets your tools return interactive user interfaces instead of plain text by combining tool triggers with resource triggers.
| Action | Type |
|---|---|
| Run a function from an MCP tool call request | Tool trigger |
| Expose a function as an MCP resource | Resource trigger |
Important
The MCP extension doesn't currently support PowerShell apps.
Prerequisites
- When you use the SSE transport, the MCP extension relies on Azure Queue storage provided by the default host storage account (
AzureWebJobsStorage). When using identity-based connections, make sure that your function app has at least the equivalent of these role-based permissions in the host storage account: Storage Queue Data Reader and Storage Queue Data Message Processor. - When running locally, the MCP extension requires version 4.0.7030 of the Azure Functions Core Tools, or a later version.
- Requires version 2.1.0 or later of the
Microsoft.Azure.Functions.Workerpackage. - Requires version 2.0.2 or later of the
Microsoft.Azure.Functions.Worker.Sdkpackage.
Install extension
Note
For C#, the Azure Functions MCP extension supports only the isolated worker model.
Add the extension to your project by installing this NuGet package in your preferred way:
Microsoft.Azure.Functions.Worker.Extensions.Mcp
- Requires version 3.2.2 or later of the
azure-functions-java-librarydependency. - Requires version 1.40.0 or later of the
azure-functions-maven-plugindependency.
- Requires version 4.9.0 or later of the
@azure/functionsdependency
- Requires version 1.24.0 or later of the
azure-functionspackage.
Install bundle
To be able to use this binding extension in your app, make sure that the host.json file in the root of your project contains this extensionBundle reference:
{
"version": "2.0",
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[4.0.0, 5.0.0)"
}
}
In this example, the version value of [4.0.0, 5.0.0) instructs the Functions host to use a bundle version that is at least 4.0.0 but less than 5.0.0, which includes all potential versions of 4.x. This notation effectively maintains your app on the latest available minor version of the v4.x extension bundle.
When possible, you should use the latest extension bundle major version and allow the runtime to automatically maintain the latest minor version. You can view the contents of the latest bundle on the extension bundles release page. For more information, see Azure Functions extension bundles.
host.json settings
This section describes the configuration settings available for this binding in version 2.x and later. Settings in the host.json file apply to all functions in a function app instance. For more information about function app configuration settings, see host.json reference for Azure Functions.
Use the extensions.mcp section in host.json to define MCP server information.
{
"version": "2.0",
"extensions": {
"mcp": {
"instructions": "Some test instructions on how to use the server",
"serverName": "TestServer",
"serverVersion": "2.0.0",
"encryptClientState": true,
"messageOptions": {
"useAbsoluteUriForEndpoint": false
},
"system": {
"webhookAuthorizationLevel": "System"
}
}
}
}
| Property | Description |
|---|---|
| instructions | Describes to clients how to access the remote MCP server. |
| serverName | A friendly name for the remote MCP server. |
| serverVersion | Current version of the remote MCP server. |
| encryptClientState | Determines if client state is encrypted. Defaults to true. Setting to false can be useful for debugging and test scenarios but isn't recommended for production. |
| messageOptions | Options object for the message endpoint in the SSE transport. |
| messageOptions.UseAbsoluteUriForEndpoint | Defaults to false. Only applicable to the server-sent events (SSE) transport; this setting doesn't affect the Streamable HTTP transport. If set to false, the message endpoint is a relative URI during initial connections over the SSE transport. If set to true, the message endpoint is an absolute URI. Using a relative URI isn't recommended unless you have a specific reason to do so. |
| system | Options object for system-level configuration. |
| system.webhookAuthorizationLevel | Defines the authorization level required for the webhook endpoint. Defaults to "System". Allowed values are "System" and "Anonymous". When you set the value to "Anonymous", an access key is no longer required for requests. Regardless of if a key is required or not, you can use built-in MCP server authorization as an identity-based access control layer. |
Connect to your MCP server
To connect to the MCP server that your function app exposes, provide an MCP client with the appropriate endpoint and transport information. The following table shows the transports supported by the Azure Functions MCP extension, along with their corresponding connection endpoint.
| Transport | Endpoint |
|---|---|
| Streamable HTTP | /runtime/webhooks/mcp |
| Server-Sent Events (SSE)1 | /runtime/webhooks/mcp/sse |
1 Newer protocol versions deprecate the Server-Sent Events transport. Unless your client specifically requires it, use the Streamable HTTP transport instead.
When you host your function app in Azure, the extension requires the system key named mcp_extension for the exposed endpoints. If you don't provide this key in the x-functions-key HTTP header or in the code query string parameter, your client receives a 401 Unauthorized response. You can remove this requirement by setting the system.webhookAuthorizationLevel property in host.json to Anonymous. For more information, see the host.json settings section.
You can retrieve the key by using any of the methods described in Get your function access keys. The following example shows how to get the key by using the Azure CLI:
az functionapp keys list --resource-group <RESOURCE_GROUP> --name <APP_NAME> --query systemKeys.mcp_extension --output tsv
MCP clients accept this configuration in various ways. Consult the documentation for your chosen client. The following example shows an mcp.json file like you might use to configure MCP servers for GitHub Copilot in Visual Studio Code. The example sets up two servers, both using the Streamable HTTP transport. The first server is for local testing with the Azure Functions Core Tools. The second server is for a function app hosted in Azure. The configuration takes input parameters for which Visual Studio Code prompts you when you first run the remote server. By using inputs, you ensure that secrets like the system key aren't saved to the file and checked into source control.
{
"inputs": [
{
"type": "promptString",
"id": "functions-mcp-extension-system-key",
"description": "Azure Functions MCP Extension System Key",
"password": true
},
{
"type": "promptString",
"id": "functionapp-host",
"description": "The host domain of the function app."
}
],
"servers": {
"local-mcp-function": {
"type": "http",
"url": "http://localhost:7071/runtime/webhooks/mcp"
},
"remote-mcp-function": {
"type": "http",
"url": "https://${input:functionapp-host}/runtime/webhooks/mcp",
"headers": {
"x-functions-key": "${input:functions-mcp-extension-system-key}"
}
}
}
}