Skip to content

Conversation

@rinormaloku
Copy link

@rinormaloku rinormaloku commented Jan 17, 2026

This PR updates the basic-host to support MCP Resource Templates. The changes are backward compatible: if a tool provides a static URI, it behaves as before. If it provides a URI template, the host will fill in the parameters before fetching the resource.

Why this change?

The current implementation only supports static resources. Supporting Resource Templates allows for Server-Side Rendering (SSR). This simplifies app development because the server can inject data directly into the HTML before it is sent to the host, reducing the need for complex JavaScript inside the app's sandbox.

How to test

You can test this SSR flow using the following sample app:

  1. Server: Use the Pizza Carousel Sample App.
  2. Tool: Call the pizza-carousel tool.
  3. Arguments: topping=vegetarian.
  4. Expectation: The host will detect the template, replace the parameter to form the URI ui://widget/pizza-carousel/vegetarian, and render the page showing only vegetarian options.

References:

@rinormaloku rinormaloku changed the title utilize resource templates in basic-host Add Resource Template support to basic-host Jan 17, 2026
@ochafik
Copy link
Contributor

ochafik commented Jan 21, 2026

Hi @rinormaloku , this is an interesting idea!

I think it would deserve a spec change, but there are devils in the details:

  • Would the parameters come from the tool invocation args? (if so, these may arrive later than today - after inputs are finished streaming - possibly negating some of the benefits of SSR)
  • Should we tag templates w/ a different field? (_meta.ui.resourceUriTemplate)?

@rinormaloku
Copy link
Author

rinormaloku commented Jan 21, 2026

@ochafik I created this proposal to get more input #298.

A big yes for resourceUriTemplate, it would be a more specific name, and being able to distinguish could be useful for hosts as well.

I would say the parameters would come from tool response, because, let's assume that the tool is doing some clever and complex work. To illustrate with an example:

  1. User: "Oh I liked this and this movie, can you recommend me another one..."
  2. The tool, instead of just returning a list of strings it could return a unique token for a list of recommended movies created for the user on the fly.
  3. The host would call the URL with that token, e.g. user/recommended/{token}/movies, and then the App would visualize the movies in more detail, who is the director, what genre, ratings, etc.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants