Skip to content

feat: add readServerResource() and listServerResources() api to App#470

Draft
Avcharov wants to merge 1 commit intomodelcontextprotocol:mainfrom
Avcharov:feat/app-resource-api
Draft

feat: add readServerResource() and listServerResources() api to App#470
Avcharov wants to merge 1 commit intomodelcontextprotocol:mainfrom
Avcharov:feat/app-resource-api

Conversation

@Avcharov
Copy link
Contributor

Introduced methods enable apps to read individual resources and discover available resources from the MCP server via host proxy without need to use app.request

Changes:

  • Add readServerResource() method to App class for reading resources by URI
  • Add listServerResources() method to App class for resource discovery
  • Add type-checked examples in app.examples.ts
  • Add JSDoc with @example tags linking to companion examples

Example enhancements (video-resource-server):

  • Replace data URIs with Object URLs + URL.revokeObjectURL() to prevent memory leaks
  • Implement ResourceTemplate list callback for dynamic resource enumeration
  • Add video picker UI with resource discovery and selection
  • Add 'Change Video' button to switch between videos
  • Refactor duplicate resource-fetching logic into shared fetchAndPlayVideo() helper

CSS improvements (video-resource-server):

  • Migrate to host style variables (--color-, --spacing-, --font-*)
  • Use light-dark() function for theme-aware colors
  • Add proper focus-visible outlines for accessibility

Motivation and Context

Apps had no convenient way to access MCP resources. Reading resources required calling the low-level app.request method directly with raw protocol types.

How Has This Been Tested?

basic-host, Claude desktop

Breaking Changes

None. Both methods are additive.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Demo

Screen.Recording.2026-02-18.at.09.41.20.mov

…lass

Introduced methods enable apps to read individual resources and
discover available resources from the MCP server via host proxy.

Changes:
- Add readServerResource() method to App class for reading resources by URI
- Add listServerResources() method to App class for resource discovery
- Add type-checked examples in app.examples.ts with proper region markers
- Add JSDoc with @example tags linking to companion examples

Example enhancements (video-resource-server):
- Replace data URIs with Object URLs + URL.revokeObjectURL() to prevent memory leaks
- Implement ResourceTemplate list callback for dynamic resource enumeration
- Add video picker UI with resource discovery and selection
- Add 'Change Video' button to switch between videos
- Refactor duplicate resource-fetching logic into shared fetchAndPlayVideo() helper
- Preserve video playback state when showing picker

CSS improvements (video-resource-server):
- Migrate to host style variables (--color-*, --spacing-*, --font-*)
- Use light-dark() function for theme-aware colors
- Add proper focus-visible outlines for accessibility
@Avcharov Avcharov marked this pull request as draft February 18, 2026 09:10
@Avcharov
Copy link
Contributor Author

@antonpk1 @ochafik can you make a quick a look at this proto please?

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.

1 participant

Comments