Skip to main content
Generates a shared library for code reuse across apps. Supports four library types: generic, plugin, adapter, and tool-register.

Usage

nx g @frontmcp/nx:lib my-lib

Options

OptionTypeDefaultDescription
namestringRequired. The name of the library
directorystringlibs/<name>The directory of the library
libTypegeneric | plugin | adapter | tool-registergenericThe type of library to generate
publishablebooleanfalseGenerate a publishable library with package.json
importPathstringThe npm scope/import path (required for publishable)
tagsstringComma-separated tags for the project

Library Types

Generic (default)

A plain TypeScript library with a class and barrel export:
nx g @frontmcp/nx:lib shared-utils --libType generic
libs/shared-utils/src/
├── shared-utils.ts    # Sample class
└── index.ts           # Barrel export

Plugin

A FrontMCP plugin library extending DynamicPlugin:
nx g @frontmcp/nx:lib my-plugin --libType plugin
libs/my-plugin/src/
├── my-plugin.plugin.ts  # @Plugin class
└── index.ts

Adapter

A FrontMCP adapter library extending DynamicAdapter:
nx g @frontmcp/nx:lib my-adapter --libType adapter
libs/my-adapter/src/
├── my-adapter.adapter.ts  # @Adapter class
└── index.ts

Tool Register

A multi-tool library that exports an array of tools:
nx g @frontmcp/nx:lib github-tools --libType tool-register
libs/github-tools/src/
├── github-tools.tools.ts  # Tool classes + exported array
└── index.ts
Usage in an app:
import { GithubToolsTools } from '@libs/github-tools';

@App({
  id: 'my-app',
  tools: [...GithubToolsTools, ...OtherTools],
})
class MyApp {}

Publishable Libraries

Generate a library with a package.json for npm publishing:
nx g @frontmcp/nx:lib my-plugin --libType plugin --publishable --importPath @my-org/plugin-cache