Skip to main content
Builds a distributable executable bundle using esbuild. Produces a single-file output ideal for containerized deployments.

Usage

nx build-exec my-app

Configuration

project.json
{
  "targets": {
    "build-exec": {
      "executor": "@frontmcp/nx:build-exec",
      "outputs": ["{projectRoot}/dist"],
      "options": {
        "entry": "{projectRoot}/src/main.ts",
        "outputPath": "{projectRoot}/dist"
      }
    }
  }
}

Options

OptionTypeDescription
entrystringEntry file path
outputPathstringOutput directory path
clibooleanGenerate CLI with subcommands per tool (optional)

CLI Mode

Pass cli: true (or use frontmcp build --target cli) to generate a standalone CLI executable with auto-generated subcommands for every tool, resource, prompt, and template in your MCP server.
project.json
{
  "targets": {
    "build-exec": {
      "executor": "@frontmcp/nx:build-exec",
      "outputs": ["{projectRoot}/dist"],
      "options": {
        "entry": "{projectRoot}/src/main.ts",
        "outputPath": "{projectRoot}/dist",
        "cli": true
      }
    }
  }
}

Output Files

ModeOutputDescription
Server onlydist/{name}-server.cjsSingle-file MCP server bundle
Server onlydist/{name}-runner.shShell runner with env/port setup
CLI modedist/{name}-server.cjsSingle-file MCP server bundle
CLI modedist/{name}-cli.cjsGenerated Commander CLI entry
CLI modedist/{name}-runner.shShell runner for the CLI
CLI modedist/{name}-installer.shInstall script (optional)

frontmcp.config.js — CLI Options

The cli block controls what the generated CLI includes:
// frontmcp.config.js
module.exports = {
  name: 'myapp',
  version: '1.0.0',
  cli: {
    enabled: true,
    outputDefault: 'text',       // 'text' | 'json'
    authRequired: false,         // inject OAuth token into calls
    description: 'My MCP CLI',
    excludeTools: [],            // tool names to omit from CLI
    nativeDeps: {                // checked by generated `doctor` command
      brew: [],
      apt: [],
      npm: [],
    },
    oauth: {
      serverUrl: 'https://auth.example.com',
      clientId: 'my-app',
      defaultScope: 'read write',
      portRange: [17830, 17850], // local callback port range for PKCE
      timeout: 120000,           // login flow timeout (ms)
    },
  },
};
CLI Config KeyTypeDescriptionDefault
enabledbooleanEnable CLI generationfalse
outputDefaultstringDefault output format (text or json)'text'
authRequiredbooleanAuto-inject OAuth token into all callsfalse
descriptionstringCLI description shown in --helpapp name
excludeToolsstring[]Tool names to exclude from the generated CLI[]
nativeDepsobjectSystem dependencies for doctor command{}
oauth.serverUrlstringOAuth authorization server URL
oauth.clientIdstringOAuth client ID
oauth.defaultScopestringDefault OAuth scopes
oauth.portRange[number, number]Port range for local PKCE callback[17830, 17850]
oauth.timeoutnumberLogin flow timeout in ms120000

Caching

This executor is cacheable. The bundled output is deterministic given the same inputs.