MCP Bundler
raw JSON → 1.2.5 verified Sat Apr 25 auth: no javascript
MCPB (MCP Bundle) bundler for Smithery MCP servers, version 1.2.5. Converts Smithery YAML configs into MCPB-compliant bundles with manifest, dot-notation flattening, and automatic type mapping. Supports Node.js >=18, programmatic API, and auto-detection of entry points. Differentiated from generic bundlers by its tight integration with the Smithery ecosystem and MCPB spec compliance.
Common errors
error Error: Cannot find module '@mcps/bundler' ↓
cause Package not installed or missing in node_modules.
fix
Run
npm install @mcps/bundler error SyntaxError: Unexpected token '{' ↓
cause Using CommonJS require() on an ESM-only package.
fix
Use
import { bundleMCPServer } from '@mcps/bundler'; instead error Error: Node.js version 16.x is not supported ↓
cause Minimum Node.js requirement is 18.x.
fix
Upgrade Node.js to version 18 or higher
error TypeError: (0 , bundler_1.bundleMCPServer) is not a function ↓
cause Attempting to call the default export when it does not exist.
fix
Use named import:
import { bundleMCPServer } from '@mcps/bundler'; Warnings
breaking Requires Node.js >=18.0.0 due to ESM and modern features. ↓
fix Upgrade Node.js to version 18 or higher.
deprecated The `smitheryYaml` export was deprecated in v1.2.0; use `parseSmitheryYaml` instead. ↓
fix Replace import `{ smitheryYaml }` with `{ parseSmitheryYaml }`.
gotcha Minification is enabled by default, which may increase bundle time and cause issues with dynamic imports. ↓
fix Set `minify: false` in options if you encounter issues with dynamic imports or desire faster builds.
gotcha Entry point auto-detection may pick the wrong file if multiple `main.ts` or `index.ts` exist; always specify `entry` explicitly for projects with multiple source roots. ↓
fix Pass the `entry` option explicitly when calling `bundleMCPServer`.
Install
npm install mcp-bundler yarn add mcp-bundler pnpm add mcp-bundler Imports
- bundleMCPServer wrong
const bundleMCPServer = require('@mcps/bundler');correctimport { bundleMCPServer } from '@mcps/bundler'; - parseSmitheryYaml
import { parseSmitheryYaml } from '@mcps/bundler'; - smitheryConfigToUserConfig
import { smitheryConfigToUserConfig } from '@mcps/bundler'; - smitheryToManifest wrong
import smitheryToManifest from '@mcps/bundler';correctimport { smitheryToManifest } from '@mcps/bundler';
Quickstart
import { bundleMCPServer } from '@mcps/bundler';
import { resolve } from 'path';
const projectPath = resolve('./my-server');
const outputDir = resolve('./dist');
const result = await bundleMCPServer(projectPath, outputDir, {
minify: true,
entry: 'src/index.ts'
});
console.log(`Bundle size: ${result.bundleSize} KB`);