Microsoft.Azure.Functions.Worker.Extensions.Mcp 1.5.0
What's Changed
Microsoft.Azure.Functions.Worker.Extensions.Mcp 1.5.0
Bug Fixes
- Fixed
DateTimetool parameters failing to bind when the JSON input contains an ISO 8601 date string. TheDictionaryStringObjectJsonConverterwas deserializing date strings asDateTimeOffset, which had no conversion path toDateTime. Added explicitDateTimeOffset↔DateTimeconversions inMcpInputConversionHelper. - Fixed MCP App
WithView(filePath)failing on Azure withDirectoryNotFoundExceptionby resolving relative paths againstAppContext.BaseDirectoryinstead of the process working directory.
Changes
-
Implement fluent API for building MCP Apps (#226)
This feature introduces first-class support for MCP App tools in the MCP extension, enabling tools to be configured as apps with UI views, static assets, and visibility controls. It adds a new configuration model for MCP Apps, emits synthetic resource functions for app views, and includes robust validation and security features for app configuration and static asset serving.
// 1. Define an MCP tool function [Function(nameof(HelloApp))] public string HelloApp( [McpToolTrigger("HelloApp", "A simple MCP App that says hello.")] ToolInvocationContext context) { _logger.LogInformation("HelloApp tool invoked."); return "Hello from app"; } // 2. Configure the tool as an app in Program.cs builder.ConfigureMcpTool("HelloApp") .AsMcpApp(app => app .WithView("assets/hello-app.html") .WithTitle("Hello App") .WithPermissions(McpAppPermissions.ClipboardWrite | McpAppPermissions.ClipboardRead) .WithCsp(csp => { csp.AllowBaseUri("https://www.microsoft.com") .ConnectTo("https://www.microsoft.com"); }));
-
Add
WithOutputSchemafluent API for MCP tools (#246)Lets users provide an explicit JSON output schema for an MCP tool via
McpToolBuilder.WithOutputSchema(string|JsonNode). The schema is validated at configuration time and advertised through the MCP protocol when tools are listed.builder.ConfigureMcpTool("MyTool") .WithOutputSchema(""" { "type": "object", "properties": { "results": { "type": "array", "items": { "type": "string" } }, "query": { "type": "string" } }, "required": ["results", "query"] } """);
-
Add
WithInputSchemafluent API for MCP tools (#243)Lets users provide an explicit JSON input schema for an MCP tool via
McpToolBuilder.WithInputSchema(string|JsonNode).builder.ConfigureMcpTool("MyTool") .WithInputSchema(""" { "type": "object", "properties": { "name": { "type": "string", "description": "The user's name" } }, "required": ["name"] } """);