Problem Statement
Developers who want to deploy a self-hosted MCP server currently need to manually add Function artifacts to their project. This involves creating and populating host.json and local.settings.json with the appropriate defaults. Manual setup is error-prone and slows down onboarding. We propose to introduce a new flag, --configurationProfile, to the func init command, streamlining this process.
User Experience
Minimal Example
In an existing MCP server project, a developer runs:
func init --configurationProfile mcp-custom-handler --worker-runtime <python|node|dotnet>
The command scaffolds the project with the following files and settings:
host.json
{
"version": "2.0",
"configurationProfile": "mcp-custom-handler",
"customHandler": {
"description": {
"defaultExecutablePath": "",
"arguments": []
}
}
}
local.settings.json
{
"IsEncrypted": false,
"Values": {
"FUNCTIONS_WORKER_RUNTIME": "<python|node|dotnet-isolated>",
"AzureWebJobsFeatureFlags": "EnableMcpCustomHandlerPreview"
}
}
- The language value is set based on the
--worker-runtime flag.
- The feature flag for MCP custom handler is set.
Requirements
- New flag: Add --configurationProfile to the func init command.
- Supported value: Only
mcp-custom-handler is supported for now. Other values are invalid and should be rejected with a clear error.
- Validation: If an unsupported configurationProfile value is provided, the CLI should fail with an error message:
"configurationProfile '<value>' is not supported. Supported values: mcp-custom-handler."
- File Output:
- Generate a
host.json file with the profile and relevant defaults.
- Generate a
local.settings.json file with the proper worker runtime and feature flag.
- Override Precedence: If the files already exist, do not overwrite them; warn the user or prompt for overwrite.
- Extensibility: Future profiles may be added; for now, extensibility is out-of-scope.
func pack requirements
-
Remove need for requirements.txt and .azurefunctions directory when the FWR is python and dotnet-isolated, respectively.
Changes have been made to remove the need for requirements.txt and .azurefunctions directory. However, func pack is still checking for the presence of these artifacts and blocking the zip.
Acceptance Criteria
- Running
func init --configurationProfile mcp-custom-handler --worker-runtime <python|node|dotnet> in a project creates a host.json and local.settings.json as specified, with the correct values substituted.
- The CLI fails with a clear error for unsupported
--configurationProfile values.
- Running the command in a directory with existing config files does not overwrite them without user consent.
Testing plan
- Regression: Ensure other
func init scenarios remain unchanged.
Work Items
[ ] Add --configurationProfile flag to func init.
[ ] Implement supported value: mcp-custom-handler.
[ ] Generate host.json and local.settings.json with correct values.
[ ] Handle existing files gracefully.
[ ] Add tests for new functionality.
[ ] Update documentation.
Problem Statement
Developers who want to deploy a self-hosted MCP server currently need to manually add Function artifacts to their project. This involves creating and populating host.json and local.settings.json with the appropriate defaults. Manual setup is error-prone and slows down onboarding. We propose to introduce a new flag,
--configurationProfile, to thefunc initcommand, streamlining this process.User Experience
Minimal Example
In an existing MCP server project, a developer runs:
The command scaffolds the project with the following files and settings:
host.json
{ "version": "2.0", "configurationProfile": "mcp-custom-handler", "customHandler": { "description": { "defaultExecutablePath": "", "arguments": [] } } }local.settings.json
{ "IsEncrypted": false, "Values": { "FUNCTIONS_WORKER_RUNTIME": "<python|node|dotnet-isolated>", "AzureWebJobsFeatureFlags": "EnableMcpCustomHandlerPreview" } }--worker-runtimeflag.Requirements
mcp-custom-handleris supported for now. Other values are invalid and should be rejected with a clear error."configurationProfile '<value>' is not supported. Supported values: mcp-custom-handler."host.jsonfile with the profile and relevant defaults.local.settings.jsonfile with the proper worker runtime and feature flag.func packrequirementsRemove need for
requirements.txtand.azurefunctionsdirectory when the FWR ispythonanddotnet-isolated, respectively.Changes have been made to remove the need for
requirements.txtand.azurefunctionsdirectory. However,func packis still checking for the presence of these artifacts and blocking the zip.Acceptance Criteria
func init --configurationProfile mcp-custom-handler --worker-runtime <python|node|dotnet>in a project creates a host.json and local.settings.json as specified, with the correct values substituted.--configurationProfilevalues.Testing plan
func initscenarios remain unchanged.Work Items
[ ] Add --configurationProfile flag to func init.
[ ] Implement supported value: mcp-custom-handler.
[ ] Generate host.json and local.settings.json with correct values.
[ ] Handle existing files gracefully.
[ ] Add tests for new functionality.
[ ] Update documentation.