Creating Plugins
Build custom plugins to extend FrontMCP with cross-cutting capabilities like caching, authorization, logging, and more.Plugin Architecture
FrontMCP plugins use the@Plugin decorator and typically extend DynamicPlugin. They can:
- Register providers — Services available to the plugin and exported to the host app
- Contribute tools, resources, and skills — Add capabilities when the plugin is attached
- Intercept flows via hooks — Run code before/after specific stages using
@ToolHookand@ListToolsHook - Accept configuration — Via
init()for runtime customization - 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:| Priority | Use Case |
|---|---|
| 100–500 | Critical security checks |
| 500–900 | Authorization, validation |
| 900–1000 | Standard plugin behavior |
| 1000+ | Logging, metrics |
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: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