MCP App
MCP App
Details
An R6 class that bundles UI components and tools into a servable MCP App. The app generates HTML with an embedded JS bridge and provides tools annotated with resource URIs for MCP consumption.
Methods
Method new()
Create a new McpApp
Arguments
uiAn htmltools tag or tagList defining the UI. Can be a simple tagList of shinymcp components, or a full
bslib::page()with theme.toolsA list of tool definitions (ellmer tool objects or named list)
nameApp name (used in resource URIs)
versionApp version string
themeOptional bslib theme (a
bslib::bs_theme()object). If provided, the UI will be wrapped in a themed page. Not needed ifuiis already abslib::page().
Method html_resource()
Generate the full HTML resource Returns a character string of the complete HTML page including UI components, bridge script, and config. HTML dependencies from bslib or other htmltools-based packages are inlined automatically.
Method mcp_tools()
Get tools annotated with MCP metadata Returns the tools list with _meta.ui.resourceUri added to each tool.
Method tool_definitions()
Get tool definitions for MCP tools/list responses
Returns a list of tool definition objects suitable for JSON-RPC.
Each tool includes _meta.ui.resourceUri linking it to the app's
UI resource, which tells MCP Apps-capable hosts to render the UI.
Method print()
Print method
