Skip to content

Microsoft.Azure.Functions.Worker.Extensions.Mcp 1.5.0

Choose a tag to compare

@liliankasem liliankasem released this 07 May 22:44
53c95b0

What's Changed

Microsoft.Azure.Functions.Worker.Extensions.Mcp 1.5.0

Bug Fixes

  • Fixed DateTime tool parameters failing to bind when the JSON input contains an ISO 8601 date string. The DictionaryStringObjectJsonConverter was deserializing date strings as DateTimeOffset, which had no conversion path to DateTime. Added explicit DateTimeOffsetDateTime conversions in McpInputConversionHelper.
  • Fixed MCP App WithView(filePath) failing on Azure with DirectoryNotFoundException by resolving relative paths against AppContext.BaseDirectory instead 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 WithOutputSchema fluent 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 WithInputSchema fluent 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"]
        }
        """);