-
Notifications
You must be signed in to change notification settings - Fork 460
Description
Description
For hosting BYO MCP servers (servers built with the official MCP SDKs), we need to run them as custom handlers. As a result, certain boilerplate artifacts need to be added to a project. This is a request to have the func init
command, when specified with mcp server as the type, to add the boilerplate files so the process can be streamlined for customers.
Requirements
-
Introduce MCP type app to
func init
func init --configurationProfile mcp-custom-handler --transport streamable-http
The command would follow with prompts to help fill out specific values in host.json so customers don't need to go back to fill them:
- "What is the language of your server?"
- Options: Node, Python, .NET
- "What is the command to run your MCP server? Examples include npm, python, dotnet."
- If an unsupported option (like "uv") is entered by the customer, present the supported options, which are "node", "npm", "python", "dotnet"
- Depending on prompt 1's answer
- If it's Python, "What's the path to the main script? For example, weather.py"
- If it's Node, "What are the arguments for running the MCP server? For example,
run start
" - If it's .NET, "What's the path to the compiled DLL? For example, weather.dll"
Based on the answers, the host.json for a Node server could look like
{ "version": "2.0", "configurationProfie": "mcp-custom-handler", "customHandler": { "description": { "defaultExecutablePath": "npm", "workingDirectory": "", "arguments": ["run start"] } } }
For Python -
{ "version": "2.0", "configurationProfie": "mcp-custom-handler", "customHandler": { "description": { "defaultExecutablePath": "python", "workingDirectory": "", "arguments": ["weather.py"] } } }
For .NET -
{ "version": "2.0", "configurationProfie": "mcp-custom-handler", "customHandler": { "description": { "defaultExecutablePath": "dotnet", "workingDirectory": "", "arguments": ["QuickstartWeatherServer.dll"] } } }
- "What is the language of your server?"
-
A local.settings.json is added as well
{ "IsEncrypted": false, "Values": { "FUNCTIONS_WORKER_RUNTIME": "<python, node, or dotnet-isolated>" } }
-
If the language is Python, prompt the customer to add a requirements.txt if they don't already have it: "A requirements.txt is required today as pyproject.toml is not yet supported."
-
If the language is .NET, add a .azurefunctions directory with an empty file called "required.txt". This is required for successful deployment.
Note: This is a proposal for a new experience that's not available yet. Please don't copy/paste in your app as it won't work.