Azure-Samples / remote-mcp-functions

Landing page for Remote MCP Server efforts in Azure Functions with links to all language stack specific repos.
MIT License
53 stars 11 forks source link

Function Runtime Version 4.83 doesn't include Microsoft.Azure.Functions.Extensions.Mcp class. #3

Closed komayama closed 3 weeks ago

komayama commented 4 weeks ago

Hi Team,

I'm happy to publish MCP server on Azure Functions. I tried to be running MCP Server the bellow Python and TypeScripts on runtime host version 4.83. https://github.com/Azure-Samples/remote-mcp-functions-python https://github.com/Azure-Samples/remote-mcp-functions-typescript

Looks like this host runtime doesn't have Microsoft.Azure.Functions.Extensions.Mcp extension bundle even set ExtensionBundleExperimental version.

https://github.com/Azure/azure-functions-extension-bundles/releases

host.json

{
  "version": "2.0",
  "logging": {
    "applicationInsights": {
      "samplingSettings": {
        "isEnabled": true,
        "excludedTypes": "Request"
      }
    }
  },
  "extensionBundle": {
    "id": "Microsoft.Azure.Functions.ExtensionBundle.Experimental",
    "version": "[4.*, 5.0.0)"
  }
}
$ func start

Azure Functions Core Tools
Core Tools Version:       4.0.5907 Commit hash: N/A +807e89766a92b14fd07b9f0bc2bea1d8777ab209 (64-bit)
Function Runtime Version: 4.834.3.22875

[2025-04-16T06:54:42.297Z] Error configuring services in an external startup class.
[2025-04-16T06:54:42.298Z] Error configuring services in an external startup class. Microsoft.Azure.Functions.Extensions.Mcp: Could not load file or assembly 'System.Threading.Channels, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
[2025-04-16T06:54:42.298Z] .
[2025-04-16T06:54:42.343Z] A host error has occurred during startup operation '42fd56d8-9df4-48fe-92a8-17d10ffbccff'.
[2025-04-16T06:54:42.343Z] Microsoft.Azure.WebJobs.Script: Error configuring services in an external startup class. Microsoft.Azure.Functions.Extensions.Mcp: Could not load file or assembly 'System.Threading.Channels, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
[2025-04-16T06:54:42.343Z] .
Value cannot be null. (Parameter 'provider')
[2025-04-16T06:54:42.357Z] Host startup operation has been canceled
[2025-04-16T06:55:09.900Z] Unable to get table reference or create table. Aborting write operation.
[2025-04-16T06:55:09.900Z] Microsoft.Azure.Cosmos.Table: Connection refused (127.0.0.1:10002). System.Net.Http: Connection refused (127.0.0.1:10002). System.Net.Sockets: Connection refused.
komayama commented 4 weeks ago

I had switched Runtime Version 4.1037 is successfully running Function Host.

$ func start

Azure Functions Core Tools
Core Tools Version:       4.0.7030 Commit hash: N/A +bb4c949899cd5659d6bfe8b92cc923453a2e8f88 (64-bit)
Function Runtime Version: 4.1037.0.23568

[2025-04-16T07:16:12.620Z] MCP server SSE endpoint: http://localhost:7071/runtime/webhooks/mcp/sse
[2025-04-16T07:16:12.684Z] result {
[2025-04-16T07:16:12.684Z]   toolName: 'mcpToolTriggerWithZod',
[2025-04-16T07:16:12.684Z]   description: 'Mcp Tool with Zod Validation Example',
[2025-04-16T07:16:12.684Z]   toolProperties: '[{"propertyName":"latitude","propertyType":"number","description":"Latitude of the location"},{"propertyName":"longitude","propertyType":"array","description":"Longitude of the location"}]'
[2025-04-16T07:16:12.685Z] }
[2025-04-16T07:16:12.685Z] result {
[2025-04-16T07:16:12.685Z]   toolName: 'mcpToolTriggerWithZodObject',
[2025-04-16T07:16:12.685Z]   description: 'Mcp Tool with Zod Validation Example',
[2025-04-16T07:16:12.685Z]   toolProperties: '[{"propertyName":"latitude","propertyType":"number","description":"Latitude of the location"},{"propertyName":"longitude","propertyType":"boolean","description":"Longitude of the location"}]'
[2025-04-16T07:16:12.685Z] }
[2025-04-16T07:16:12.745Z] Worker process started and initialized.

Functions:

        getSnippet: mcpToolTrigger

        hello: mcpToolTrigger

        mcpToolTriggerWithArguments: mcpToolTrigger

        mcpToolTriggerWithZod: mcpToolTrigger

        mcpToolTriggerWithZodObject: mcpToolTrigger

        saveSnippet: mcpToolTrigger

For detailed output, run func with --verbose flag.
[2025-04-16T07:16:14.475Z] Host did not shutdown within its allotted time.
[2025-04-16T07:16:14.479Z] Shutting down language worker channels for runtime:node
[2025-04-16T07:16:17.749Z] Host lock lease acquired by instance ID '0000000000000000000000006CA709AB'.
manvkaur commented 3 weeks ago

@komayama, The experimental extension bundle requires Azure Functions Core Tools version 4.0.7030 or higher. The exception you're encountering is due to a missing .NET 8 dependency, which is expected when using this bundle with an older version of Core Tools. This issue is resolved in Core Tools version >= 4.0.7030 or Host version >= 4.1037.

@paulyuk , please feel free to close this issue and let's update our documentation that experimental bundles require core tools 4.0.7030 as minimum

komayama commented 3 weeks ago

Hi @manvkaur, Thank you for the confirm my environment questions and more detail explain. I created PR which is helpful content minimum azure functions core tools version.