Use a user-managed MCP Server
If you already maintain an MCP Server, use Modern.js to build React cards. Keep tool execution, authentication, and the MCP endpoint in your existing service, and connect each tool to its UI through the build manifest.
Configure a UI-only build
Use mcpAppsPlugin({ mode: 'ui-only' }) alongside appTools(). This mode does not require the BFF plugin, register an MCP endpoint, or compile the server definition. It disables default page entry discovery, so a homepage is not required.
Declare local views in mcp_apps.ts without importing server handlers:
Configure output.assetPrefix with the public static asset URL. After modern build, deploy the JS and CSS to that URL and give the server dist/mcp-apps/ui-manifest.json together with dist/mcp-apps/ui/. Development writes the manifest under <internalDirectory>/mcp-apps/.
Build outputs and tool mapping
The version 1 manifest maps tool names to resourceUri, mimeType, html, assetBase, and ui metadata. HTML paths are relative to the manifest directory. Explicit HTTPS HTML URLs remain unchanged. This manifest covers local views, while MF views continue to use the standard MF manifest and exposes.
Look up tools.greet.html rather than computing hashed filenames. Preserve the relative paths between the manifest and HTML files when deploying. The resource reading helper adds the public asset origin to CSP.
Connect your server
In your MCP server:
- Set each tool's
_meta.ui.resourceUrifrom the manifest. - Advertise the corresponding resource URI, MIME type and UI metadata.
- Handle resource reads by returning the HTML and UI metadata.
- Return tool arguments in
_meta['modernjs.dev/mcp-app'].argsand component props in_meta['modernjs.dev/mcp-app'].viewProps.
Node servers can use these helpers:
readUiManifestResource() injects the asset base into HTML and adds its origin to CSP. Override the default request asset base with the public static asset URL. Servers in other languages can consume the JSON directly and implement the same HTML, CSP and result contracts.
Integrated production BFF deployments also consume the manifest mapping. Development before compilation and older builds without a manifest retain the existing filename convention.
UI-only projects also include the development inspector. Simulate arguments and viewProps to preview local cards, or switch to Live server and connect to your MCP Server. See MCP Apps Inspector.