Add MCP UI App support#196
Conversation
- Use string class name for Passport ClientRepository to avoid PHPStan error (not a direct dependency) - Change UiMeta prefersBorder default from true to null so empty instances serialize as []
- UiResource now provides a default handle() that renders mcp.<kebab-name> view, so empty subclasses work without overriding handle() - Restore prefersBorder default to true so hosts always receive the border hint - Update tests to expect prefersBorder in default UiMeta serialization
Import Route class and use short name in docblock @method tags instead of FQCNs to satisfy the fully_qualified_strict_types rule.
joetannenbaum
left a comment
There was a problem hiding this comment.
Overall good, made some adjustments here and there, have a couple of questions. Let me know what you think.
If I changed anything that's fundamentally against your specific design or intention let me know.
@wojo1206 which documentation ? |
joetannenbaum
left a comment
There was a problem hiding this comment.
Just the one question, looks good otherwise.
|
This is awesome, exactly what we needed. Really excited about it, hope the team can ship it soon. Definitely looking forward to using this! |
|
Agreed. I was really concerned Laravel was behind the times a year ago, and my business depended on it. All that has changed with the push into AI. This kind of thing is fantastic. |
MCP currently has no way to show interactive UI to users — every tool response is plain text. This adds MCP App support: a tool linked to an
AppResourcecan render a self-contained HTML app inside a sandboxed iframe in the host.Usage
This generates two files. The PHP class registers the resource — the default
handle()auto-infers the Blade view from the class name, so no code is needed unless you're passing server-side data:The Blade view is the entire app — HTML, JS, and CSS in one file:
Link a tool to display the app when called:
App-only tools (invisible to the model, callable only from the UI):
Approach
AppResourceextendsResourcewithui://URI scheme andtext/html;profile=mcp-appMIME type; serves self-contained HTML viahandle()which renders a Blade view#[RendersApp]attribute on a tool injects_meta.ui.resourceUriinto its tool listing so the host knows which resource to fetchx-mcp::appBlade component inlines the pre-bundled JS SDK so apps require no npm or ViteAppMeta/Csp/Permissionsprovide structured configuration for iframe sandbox permissions and CSPio.modelcontextprotocol/uicapability automatically when anyAppResourceis registered