Skip to content

Add WithAppTool helper for MCP Apps - #1815

Open
KirschBluteX wants to merge 4 commits into
modelcontextprotocol:mainfrom
KirschBluteX:feat/with-app-tool-1607
Open

Add WithAppTool helper for MCP Apps#1815
KirschBluteX wants to merge 4 commits into
modelcontextprotocol:mainfrom
KirschBluteX:feat/with-app-tool-1607

Conversation

@KirschBluteX

@KirschBluteX KirschBluteX commented Aug 13, 2026

Copy link
Copy Markdown

Fixes #1607

Summary

Add an ergonomic WithAppTool helper for registering an MCP Apps tool and its linked HTML resource in one call.

The helper composes the existing tool, resource, and MCP Apps registration paths while keeping the lower-level WithTools and WithResources APIs unchanged.

Behavior

  • Requires a concrete absolute ui:// resource URI.
  • Rejects malformed URIs and URI templates.
  • Uses resourceUri as the authoritative tool/resource link.
  • Rejects conflicting existing _meta.ui.resourceUri metadata.
  • Preserves other existing UI metadata.
  • Registers resources with text/html;profile=mcp-app.
  • Supports synchronous and asynchronous HTML factories returning:
    • string
    • Task<string>
    • ValueTask<string>
  • HTML factories may optionally accept a single CancellationToken.
  • Duplicate registrations using the exact same URI remain supported; the first registered HTML handler is used deterministically.
  • Conflicting tool names, equivalent URI spellings, and collisions with lower-level resource registrations are rejected during options validation.

Testing

  • MCP Apps focused tests: 65 passed, 0 failed
  • Apps Release builds for net10.0, net9.0, net8.0, and netstandard2.0: 0 warnings, 0 errors
  • Scoped whitespace format verification: passed
  • Full non-Manual suite: 2,385 passed, 4 skipped, 0 failed。

GitHub Actions are currently waiting for maintainer approval (action_required), so no hosted CI result is available yet.

@KirschBluteX
KirschBluteX force-pushed the feat/with-app-tool-1607 branch from 7fc29e4 to f19fc75 Compare August 14, 2026 18:31
@KirschBluteX

Copy link
Copy Markdown
Author

@mikekistler Could you review PR #1815 when you have a chance? It adds the ergonomic WithAppTool helper for MCP Apps by composing the existing tool and resource registration paths. The helper enforces a concrete ui:// resource link, preserves compatible UI metadata, rejects conflicting links, and has focused integration coverage.

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.

MCP Apps: Add ergonomic WithAppTool helper to reduce wiring boilerplate

1 participant