@fractal-mcp/cli
v2.2.5
Published
CLI tools for Fractal MCP development
Maintainers
Readme
@fractal-mcp/cli
CLI tools for Fractal MCP development.
Installation
Global Installation
npm install -g @fractal-mcp/cliUse with npx (No Installation)
# For a bootstrapped application with index.html
npx @fractal-mcp/cli bundle --entrypoint=path/to/index.html --out=path/to/outdir
# For a standalone react component
npx @fractal-mcp/cli bundle --entrypoint=path/to/Component.tsx --out=path/to/outdir
# For a JS/TS entrypoint
npx @fractal-mcp/cli bundle --entrypoint=path/to/main.ts --out=path/to/outdirCommands
bundle
Bundle a React component, JS/TS entrypoint, or HTML file into a self-contained output.
Usage
For a React component (.tsx/.jsx):
npx @fractal-mcp/cli bundle --entrypoint=./src/MyComponent.tsx --out=./distFor a JS/TS entrypoint (.ts/.js):
npx @fractal-mcp/cli bundle --entrypoint=./src/main.ts --out=./distFor an HTML application:
npx @fractal-mcp/cli bundle --entrypoint=./index.html --out=./distOptions
Required:
--entrypoint <path>- Path to entrypoint file (.html, .tsx, .jsx, .ts, .js)--out <path>- Output directory
Output Configuration:
--output-type <type>- Output type:htmlorassets(default:html)html- Single HTML file with inlined/linked assetsassets- Separatemain.jsandindex.cssfiles
HTML Output Options (only applicable when --output-type=html):
--inline-js/--no-inline-js- Inline JavaScript in HTML (default: true)--inline-css/--no-inline-css- Inline CSS in HTML (default: true)--root-only- Generate root element snippet instead of full HTML document (default: false)
JS/TS Entrypoint Options:
--root-element <id>- Root element ID for JS/TS entrypoints (default:root)
Examples
Basic usage:
# Bundle a React component into a single HTML file
npx @fractal-mcp/cli bundle \
--entrypoint=src/components/Hello.tsx \
--out=bundled
# Bundle an HTML app with dependencies
npx @fractal-mcp/cli bundle \
--entrypoint=public/index.html \
--out=distOutput types:
# Create a single HTML file with everything inlined (default)
npx @fractal-mcp/cli bundle \
--entrypoint=src/App.tsx \
--out=dist \
--output-type=html
# Create separate main.js and index.css files
npx @fractal-mcp/cli bundle \
--entrypoint=src/App.tsx \
--out=dist \
--output-type=assetsInline control:
# Link to external JS/CSS files instead of inlining
npx @fractal-mcp/cli bundle \
--entrypoint=src/App.tsx \
--out=dist \
--no-inline-js \
--no-inline-css
# Inline JS but link CSS
npx @fractal-mcp/cli bundle \
--entrypoint=src/App.tsx \
--out=dist \
--inline-js \
--no-inline-cssRoot element snippet:
# Generate just the root element content (no <html>, <head>, etc.)
npx @fractal-mcp/cli bundle \
--entrypoint=src/App.tsx \
--out=dist \
--root-onlyJS/TS entrypoint with custom root:
# Bundle a JS/TS file with a custom root element ID
npx @fractal-mcp/cli bundle \
--entrypoint=src/main.ts \
--out=dist \
--root-element=app-rootOutput
HTML Output (default):
The command will create a self-contained HTML file at <out>/index.html:
- All JavaScript bundled (inlined by default, or as
<script src="main.js">) - All CSS bundled (inlined by default, or as
<link href="index.css">) - All dependencies included
- Full HTML document or root element snippet (with
--root-only)
Assets Output: The command will create separate files:
<out>/main.js- Bundled JavaScript<out>/index.css- Bundled CSS
HTML Input: HTML inputs always produce a single self-contained HTML file with everything inlined, regardless of output options.
Features
- Multiple Input Types: Supports HTML, React components (.tsx/.jsx), and JS/TS entrypoints (.ts/.js)
- Flexible Output: Choose between single HTML file or separate assets (main.js, index.css)
- Inline Control: Decide whether to inline or link JavaScript and CSS
- Root Element Snippets: Generate just the root element content for embedding
- Custom Root Elements: Specify custom root element IDs for JS/TS entrypoints
- Automatic Detection: Detects framework (React, Vue, Svelte) automatically
- Fast: Powered by Vite
- Zero Config: Works out of the box with sensible defaults
Development
# Build
npm run build
# Watch mode
npm run dev
# Clean
npm run cleanPublishing
npm publishLicense
MIT
