Skip to content

Add MCP Apps extension support (typed metadata, attribute, and helpers)#1484

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/add-mcp-apps-support
Draft

Add MCP Apps extension support (typed metadata, attribute, and helpers)#1484
Copilot wants to merge 2 commits intomainfrom
copilot/add-mcp-apps-support

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 31, 2026

MCP Apps is the first official MCP extension (io.modelcontextprotocol/ui), enabling servers to deliver interactive UIs inside AI clients. The C# SDK had the foundational primitives (Extensions, _meta) but no typed convenience layer, requiring manual JSON construction that is error-prone and non-discoverable.

New APIs

F1 – Constants (McpApps)

  • McpApps.ResourceMimeType"text/html;profile=mcp-app"
  • McpApps.ExtensionId"io.modelcontextprotocol/ui"
  • McpApps.ResourceUriMetaKey"ui/resourceUri" (legacy backward-compat key)

F2 – Typed metadata models

  • McpUiToolMetaResourceUri, Visibility
  • McpUiToolVisibilityModel/App string constants
  • McpUiResourceMetaCsp, Permissions, Domain, PrefersBorder
  • McpUiResourceCspConnectDomains, ResourceDomains, FrameDomains, BaseUris
  • McpUiResourcePermissionsAllow
  • McpUiClientCapabilitiesMimeTypes

F3 – Client capability helper

McpUiClientCapabilities? caps = McpApps.GetUiCapability(clientCapabilities);
if (caps?.MimeTypes?.Contains(McpApps.ResourceMimeType) is true) { ... }

F6 – [McpAppUi] attribute (declarative path)

[McpServerTool]
[McpAppUi(ResourceUri = "ui://weather/view.html")]
[Description("Get current weather for a location")]
public string GetWeather(string location) => ...;

Takes precedence over any [McpMeta("ui", ...)] on the same method. Populates both _meta.ui (structured) and the legacy _meta["ui/resourceUri"] flat key automatically.

F7 – McpServerToolCreateOptions.AppUi (programmatic path)

var tool = McpServerTool.Create(handler, new McpServerToolCreateOptions
{
    AppUi = new McpUiToolMeta
    {
        ResourceUri = "ui://weather/view.html",
        Visibility = [McpUiToolVisibility.Model, McpUiToolVisibility.App]
    }
});

Explicit Meta entries take precedence over AppUi; AppUi takes precedence over McpMetaAttribute.

Notes

  • All new APIs are [Experimental(MCPEXP001)] — same diagnostic as Extensions and Tasks.
  • New types registered with McpJsonUtilities.JsonContext for Native AOT compatibility.
  • F4 (RegisterAppTool) and F5 (RegisterAppResource) are not included; the C# DI-based registration model makes F6/F7 the idiomatic equivalents.

Copilot AI changed the title [WIP] Add MCP Apps support for typed metadata and helpers Add MCP Apps extension support (typed metadata, attribute, and helpers) Mar 31, 2026
Copilot AI requested a review from mikekistler March 31, 2026 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: MCP Apps Support — Typed Metadata, Helpers, and Attribute Integration

2 participants