Skip to content

.tsx FileSource fails with cryptic nx build ui error when @frontmcp/ui is missing #443

@alexmercerpo

Description

@alexmercerpo

Describe the bug
Using a separated React widget — ui.template: { file: './widget.tsx' } — without @frontmcp/ui installed fails at tool-call (render) time with a cryptic, monorepo-specific error: Failed to bundle FileSource "<file>": ... Ensure workspace packages are built (e.g. nx build ui). nx build ui is a frontmcp-monorepo command and is meaningless in a consumer project, so the error points nowhere. Root cause: @frontmcp/uipack's bundleFileSource (component/index.js) injects an auto-generated mount that does import { McpBridgeProvider } from '@frontmcp/ui/react'. esbuild externalizes react / react-dom / react/jsx-runtime but not @frontmcp/ui/react, so that package must resolve on disk; if @frontmcp/ui isn't installed, bundling throws.

To Reproduce
Steps to reproduce the behavior:

  1. Scaffold a fresh FrontMCP v1.3.0 project (no @frontmcp/ui installed).
  2. Add a tool with ui: { template: { file: './widget.tsx' }, uiType: 'react' } and create widget.tsx.
  3. Run yarn dev, then call the tool from an MCP client.
  4. See error in server logs: Failed to bundle FileSource ... Ensure workspace packages are built (e.g. nx build ui).

Expected behavior
The error should be replaced with consumer-friendly guidance: "Install @frontmcp/ui to use .tsx/.jsx widget files." A skill should document: "For .tsx/.jsx FileSource widgets, install @frontmcp/ui — it provides the React bridge mount." Ideally @frontmcp/ui would be listed as an optional peer dependency of @frontmcp/uipack / @frontmcp/sdk so the requirement surfaces at install time.

Screenshots
N/A.

Desktop (please complete the following information):

  • OS: macOS (Darwin 25.3.0)
  • Browser: N/A (server-side bundling failure)
  • Version: @frontmcp/sdk@1.3.0, @frontmcp/uipack@1.3.0; Node 22+

Smartphone (please complete the following information):

  • N/A

Additional context
Fix that worked: yarn add @frontmcp/ui (matching version 1.3.0). react / react-dom stay external and load from the CDN at runtime — only @frontmcp/ui needs to be present for server-side bundling.

Metadata

Metadata

Labels

No labels
No labels

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions