-
Notifications
You must be signed in to change notification settings - Fork 28
feat: MCP-638: TS implement UI resource in server #77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: MCP-638: TS implement UI resource in server #77
Conversation
- Add UIResourceDefinition type and supporting interfaces for widget configuration - Implement uiResource() method that registers widgets as both tools and resources - Add widget prop handling with automatic query parameter conversion - Create modular type system with separate files for common, resource, tool, and prompt types - Support widget iframe rendering with configurable frame sizes - Add widget serving routes for static assets and HTML files - Export UIResource types from main package index for external consumption
- Replace hardcoded template list with dynamic directory scanning - Add helpful tip about uiresource template for UI resources - Improve error message when template not found
packages/create-mcp-use-app/src/templates/uiresource/src/server.ts
Outdated
Show resolved
Hide resolved
| widget: 'kanban-board', | ||
| title: 'Kanban Board', | ||
| description: 'Interactive task management board with drag-and-drop support', | ||
| props: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how are they used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The convertPropsToInputs method (lines 479-489) converts your props into tool input definitions, which then get converted to Zod validation schemas.
The applyDefaultProps method (lines 501-511) extracts default values from props to use when accessing the resource directly (without calling the tool).
Description
Introduce comprehensive UIResource support for seamless integration with MCP-UI clients, enabling interactive widget serving through a unified API.
BREAKING CHANGE: None - this is purely additive functionality
New Features
Core UIResource API
uiResource()method to McpServer for unified widget registrationMCP-UI Adapter Layer
Template System
uiresourcetemplate demonstrating all resource typesInspector Integration
Technical Details
Type System
Testing
Dependencies
Usage Example
Migration Path
Closes #MCP-638
Does this PR need a changeset?
pnpm changeset)Quick reminder:
pnpm changeset # Creates a changeset interactively📚 Full guide: Changeset Workflow Guide
Need help? See when to create changesets and examples
🚀 Release Target
mainbranch → Stable release (default)betabranch → Beta/prerelease versionReleasing a beta? See the Beta Release Workflow Guide for instructions.
Checklist
Code Quality
pnpm test)pnpm lint)pnpm build)Documentation
Release Preparation
pnpm changeset) - if this affects published packagesAdditional Notes