Skip to content

[Proposal] Add support for UI Resource Templates in SEP-1865 #298

Open

Description

@rinormaloku

Motivation

The current draft of SEP-1865 primarily focuses on static UI resources. However, the core Model Context Protocol already defines Resource Templates for dynamic URI resolution. If we support ResourceTemplates it would make Server-Side Rendering (SSR) for MCP Apps very-very powerful.

Proposed Specification Change

We should explicitly allow _meta.ui.resourceUri to be an MCP Resource Template (URI Template - RFC 6570).

  1. Alignment: Leverage the existing MCP mechanism where tools can reference template-based URIs.
  2. SSR Logic: Instead of the UI performing client-side data fetching, the request goes to the server for a specific resource and server the server generates the entire page (good old simple SSR).
  3. Efficiency: This allows the server to return pre-rendered HTML specifically for this resource.

Example

1. Tool Definition (on Server)
The server registers a tool with a template URI:

{
  "name": "get_pizza_details",
  "_meta": {
    "ui": { "resourceUri": "ui://pizzas/{pizzaId}/details" }
  }
}

2. Tool Response
The tool returns the specific ID in the structuredContent:

{
  "structuredContent": { "pizzaId": "margherita-123" }
}

3. Host Action
The Host extracts the pizzaId from the tool response and reads the resource template
ui://pizzas/margherita-123/details.

4. Server
Generates the details page for margherita-123.

Goal

To simplify the developer experience by allowing "0-JS" or low-JS apps, moving the logic from the sandboxed client back to the server.

Checkout this PR to see this concretely: #296

Activity

  1. added
    enhancement
    on Jan 17, 2026
  2. antonpk1 commented on Jan 20, 2026

    @antonpk1
    Contributor

    Thanks for the proposal!

    The concern here is that template variables come from structuredContent — which is part of the tool response. This means the host can't resolve the resource URI until the tool fully completes. In practice that timeline looks like:

    1. Agent streams tool input (takes time)
    2. Tool executes on the server (takes time)
    3. Tool response arrives — now we finally know the URI, fetch the resource, and show the app

    With a static resourceUri in the tool definition, the host already knows exactly what to fetch the moment the tool call starts — so it can preload and show the app immediately, no waiting.

    While the template approach is convenient for developers who want to avoid client-side JS, the latency tradeoff is hard to justify — users would have to wait significantly longer to see any UI.

  3. rinormaloku commented on Jan 21, 2026

    @rinormaloku
    Author

    @antonpk1 thanks for the explanation the preloading benefit makes sense, and I wasn't thinking of that. Mainly because from my perspective, without the tool response, the app provides little value to show.

    In many cases the tool's output determines what data gets displayed (e.g., a search or lookup). In those scenarios, the client still has to wait for the tool to complete before fetching data anyway. So in practice it would look like this:

    1. Agent streams tool input — meanwhile, MCP App loads HTML, CSS, JS
    2. Tool response arrives — now we have actionable data
    3. MCP App executes JS to fetch data

    Only then is the app actually useful.

    So the latency difference between SSR and client-side rendering becomes pretty negligible.

    I think there are real tradeoffs on both sides, and one that weighs on me is developer complexity. MCP apps are exciting and data visualization would benefit end users in a lot of cases. But if the barrier to entry is too high, many apps simply won't get built at all.

    Given that, would it make sense to support both approaches and let MCP App developers choose based on their use case?

    Happy to hear if there are other considerations I might be missing.

  4. liady commented on Jan 21, 2026

    @liady
    Contributor

    @rinormaloku thanks for the proposal!
    To add to @antonpk1’s performance considerations, there are also auditing and security concerns on the host side.
    In the original MCP-UI, it was possible to return dynamic resources, which was great for development, but it meant hosts couldn’t easily audit, verify, or cache resource contents and assets (btw, this is also a requirement in the Apps SDK).
    The “hardened” requirement for static, predefined resources was also driven by these constraints, particularly from larger hosts.
    It's a very good point and a common request, and this may be loosened in the future (especially if we allow rendering arbitrary inner iframes), the current considerations/requests that drove it were around auditing, caching, and performance. I 100% agree we need to keep DX as a main consideration, and definitely not get to a point where "apps won't be built" because of this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions