Skip to content

Conversation

@ochafik
Copy link
Collaborator

@ochafik ochafik commented Jan 12, 2026

Summary

Improves the basic-host example with better UI organization and proper SDK type usage.

e.g. w/ upcoming transcription app:

CleanShot 2026-01-12 at 18 52 29

Changes

Collapsible Panels UI

  • Add reusable CollapsiblePanel component
  • Show tool input in collapsible panel above app iframe
  • Show tool result in collapsible panel below app iframe
  • Show messages in collapsible panel (with message count badge)
  • Show model context in collapsible panel at bottom
  • Title bar format: ServerName:tool_name

SDK Type Integration

  • Replace custom ModelContext with McpUiUpdateModelContextRequest['params']
  • Replace custom AppMessage with McpUiMessageRequest['params']
  • Import types from @modelcontextprotocol/ext-apps/app-bridge

Content Block Handling

  • Handle non-text content blocks (image, audio, resource)
  • Show placeholders like <image: image/png> for non-text content
  • Apply formatting to both messages and model context

updateModelContext Support

  • Declare updateModelContext: { text: {} } capability
  • Add onupdatemodelcontext handler
  • Replace alert() popup with collapsible Messages panel

Other

  • Use AppBridgeCallbacks interface for cleaner callback handling

- Import McpUiUpdateModelContextRequest and McpUiMessageRequest from SDK
- Replace custom ModelContext with McpUiUpdateModelContextRequest['params']
- Replace custom AppMessage with McpUiMessageRequest['params']
- Pass full message params instead of extracting text
- Format messages by extracting text from content blocks in display
- Add formatContentBlock helper for text, image, audio, resource types
- Show placeholders like <image: image/png> for non-text content
- Apply to both messages and model context display
@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 12, 2026

Open in StackBlitz

@modelcontextprotocol/ext-apps

npm i https://pkg.pr.new/modelcontextprotocol/ext-apps/@modelcontextprotocol/ext-apps@244

@modelcontextprotocol/server-basic-react

npm i https://pkg.pr.new/modelcontextprotocol/ext-apps/@modelcontextprotocol/server-basic-react@244

@modelcontextprotocol/server-basic-vanillajs

npm i https://pkg.pr.new/modelcontextprotocol/ext-apps/@modelcontextprotocol/server-basic-vanillajs@244

@modelcontextprotocol/server-budget-allocator

npm i https://pkg.pr.new/modelcontextprotocol/ext-apps/@modelcontextprotocol/server-budget-allocator@244

@modelcontextprotocol/server-cohort-heatmap

npm i https://pkg.pr.new/modelcontextprotocol/ext-apps/@modelcontextprotocol/server-cohort-heatmap@244

@modelcontextprotocol/server-customer-segmentation

npm i https://pkg.pr.new/modelcontextprotocol/ext-apps/@modelcontextprotocol/server-customer-segmentation@244

@modelcontextprotocol/server-scenario-modeler

npm i https://pkg.pr.new/modelcontextprotocol/ext-apps/@modelcontextprotocol/server-scenario-modeler@244

@modelcontextprotocol/server-system-monitor

npm i https://pkg.pr.new/modelcontextprotocol/ext-apps/@modelcontextprotocol/server-system-monitor@244

@modelcontextprotocol/server-threejs

npm i https://pkg.pr.new/modelcontextprotocol/ext-apps/@modelcontextprotocol/server-threejs@244

@modelcontextprotocol/server-wiki-explorer

npm i https://pkg.pr.new/modelcontextprotocol/ext-apps/@modelcontextprotocol/server-wiki-explorer@244

commit: c04a043

Copy link
Member

@jonathanhefner jonathanhefner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks nice!

Since the tool input is no longer side-by-side with the iframe, do we want to set a narrower max-width for the main element?

@ochafik
Copy link
Collaborator Author

ochafik commented Jan 12, 2026

Looks nice!

Thanks! (i'll tell Claude)

Since the tool input is no longer side-by-side with the iframe, do we want to set a narrower max-width for the main element?

Good idea for a follow up, will push this first

@ochafik ochafik merged commit 741b1d3 into main Jan 12, 2026
19 checks passed
@ochafik ochafik deleted the ochafik/improve-host branch January 12, 2026 21:28
@ochafik ochafik mentioned this pull request Jan 12, 2026
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.

3 participants