azure function hosting mcp server
Run the following command to create the azure function with mcp
azd init --template remote-mcp-functions-python -e mcpserver-python
Once you have finish, go to the root folder where you will see pyproject.toml and azure.yaml, etc.
Then start vscode. Make sure you have the pre-requisites like Azure function Developer tool and azurite all setup.
From vscode, select "Debug". It will prompt you to create a virtual environment. Please select "yes". When it ask you to run azurite - please select yes.
Running the MCP function app
Next run the function app. You have to go into the src folder first and run vscode.
Then you will be prompted to create an environment. Hit F5 or Run -> Debug. that will install your python modules under requirements.txt.
Launch MCP Server
Next we will lanch our mcp server by creating a file call mcp.json.
}
And you can see it here
Goto local-mcp-function and click "Run"
So the purpose of that whole block is: when you run your Function app locally with func start, this entry lets an MCP client (VS Code/Copilot, MCP Inspector, etc.) connect to http://localhost:7071/runtime/webhooks/mcp, discover your tools (like hello_mcp), and invoke them — all without needing auth, since it matches AuthLevel.ANONYMOUS in your code.
It's the local counterpart to what would otherwise be a remote-mcp-function entry pointing at https://<funcappname>.azurewebsites.net/runtime/webhooks/mcp once deployed , since the Azure Functions MCP extension defines the MCP server info via host.json, and mcp.json configuration examples typically set up one local server for testing with Azure Functions Core Tools and a second server for a function app hosted in Azure.
From the chat window, we issue a "say hello". Then the chatbot will ask for permission to use mcp tool.
Ensure you have configure the chatbox correctly. Ensure it is agent mode and then click on "Configure tools" you can see mcp-local-function, as shown here
Next we will configure the chatbot
And as you can see from here, we are able to hit the azure function mcp server hello_mcp function and it is also asking for permission.
And finally we can see the outputs:-
Comments