Skip to main content

Creating Plugins

Build custom plugins to extend FrontMCP with cross-cutting capabilities like caching, authorization, logging, and more.
Nx users: Scaffold with nx g @frontmcp/nx:plugin my-plugin --project my-app. See Plugin Generator.

Plugin Architecture

FrontMCP plugins use the @Plugin decorator and typically extend DynamicPlugin. They can:
  1. Register providers — Services available to the plugin and exported to the host app
  2. Contribute tools, resources, and skills — Add capabilities when the plugin is attached
  3. Intercept flows via hooks — Run code before/after specific stages using @ToolHook and @ListToolsHook
  4. Accept configuration — Via init() for runtime customization
  5. Extend metadata — Add custom fields to tool metadata

Basic Plugin

Registering a Plugin

Attach plugins at the app level:

Adding Hooks

Plugins intercept flow stages using @ToolHook and @ListToolsHook decorators:

Hook Timing

  • .Will(stage) — runs before the stage
  • .Did(stage) — runs after the stage

Priority

Lower numbers run first:

Dynamic Providers

For plugins that create providers based on configuration:

Extending Tool Metadata

Plugins can add custom fields to tool metadata via global type augmentation:
Tools can then use this metadata:

Contributing Tools and Skills

Plugins can contribute tools and skills via the @Plugin decorator:

Publishing Plugins

package.json

Next Steps

Plugin Guide

Full plugin API reference with hooks, scopes, and DynamicPlugin details

Create a Plugin

Step-by-step tutorial building a real-world plugin

Cache Plugin

Study the built-in cache plugin implementation

Community

Share your plugin with the community