Existing applications
Requirements and defaults
In integrated mode, Modern.js provides both the MCP endpoint and card builds. The following requirements apply:
mcp_apps.ts is a default filename, not a fixed requirement. For example, mcpAppsPlugin({ configPath: 'mcp/server.ts', endpoint: '/api/mcp' }) reads mcp/server.ts relative to the project root and mounts the endpoint at /api/mcp.
When Modern.js only builds the UI and a user-managed server provides MCP, use mode: 'ui-only'. This mode does not require bffPlugin(), but still needs a UI definition file. See User-managed MCP servers and the full options in the API reference.
Installation and configuration
Install @modern-js/mcp-apps and @modern-js/plugin-mcp-apps in production
dependencies, matching the installed app-tools version. Also install
@modern-js/plugin-bff.
Include the definition and handler directory in tsconfig. Run modern dev and
connect an MCP client to /mcp. A browser address-bar GET returns 405 because the
current transport is stateless HTTP POST.
Application component views
A view references a component with view: { module: './src/components/Greeting.tsx' } and can omit remotes.
The plugin registers standard Modern.js auto-mounted entries, inheriting the application build, CSS processing, aliases, preEntry and runtime plugins. Resource HTML references ordinary application JS/CSS/chunks. Deploy those assets alongside the server or configure dev/output assetPrefix for a CDN. Existing filesystem route layouts and loaders are not implicitly attached to a component entry.
Interactive remote views
Publish an expose with existing MF tooling. Add its manifest URL to remotes
and reference it from a tool with remote and view.module:
The MF renderer loads the component inside the host iframe and passes
tool arguments, handler viewProps, and the connected mcpApp. Use
mcpApp.callServerTool() for interactions; do not create a second useApp connection.
No additional UI-manifest format is introduced.
Keep the existing bff.prefix. The automatic MCP route uses endpoint directly, without adding the BFF prefix:
The defaults are root mcp_apps.ts and /mcp. An existing BFF route at the same path causes a conflict error.
Keep a manual entry
For custom endpoint options or an existing manual route, set mcpAppsPlugin({ endpoint: false }), then add:
This manual route follows the BFF prefix: bff.prefix: '/api' produces /api/mcp. Definition name and version provide server identity; mcpServer can override it with serverInfo.