Skip to main content

Overview

import { PluginRegistry } from '@frontmcp/sdk';

// Access via scope
const plugins = scope.plugins;

// List all plugins
const allPlugins = plugins.getPlugins();

Methods

getPlugins()

Get all registered plugins.
getPlugins(): ReadonlyArray<PluginEntry>
Example:
const plugins = registry.getPlugins();
for (const plugin of plugins) {
  console.log(`Plugin: ${plugin.name}`);
}

Plugin Architecture

Plugins create nested registries for their components:
PluginRegistry
├── pProviders    → Map<Token, ProviderDef>
├── pPlugins      → Map<Token, PluginRegistry>  (nested plugins)
├── pAdapters     → Map<Token, AdapterRegistry>
├── pTools        → Map<Token, ToolRegistry>
├── pResources    → Map<Token, ResourceRegistry>
├── pPrompts      → Map<Token, PromptRegistry>
└── pSkills       → Map<Token, SkillRegistry>

Plugin Registration

Plugins are registered via the @FrontMcp decorator:
@FrontMcp({
  name: 'my-server',
  plugins: [
    RememberPlugin,
    CachePlugin,
    MyCustomPlugin,
  ],
})
class MyServer { }
Or via the @Plugin decorator for custom plugins:
@Plugin({
  name: 'my-plugin',
  tools: [CustomTool],
  providers: [CustomProvider],
})
class MyCustomPlugin { }

Plugin Capabilities

Plugins can provide:

Tools

Additional MCP tools

Resources

Additional MCP resources

Prompts

Additional MCP prompts

Skills

Additional MCP skills

Providers

DI providers

Hooks

Flow hooks

Hook Registration

Plugins can register hooks that run during tool/resource/prompt flows:
@Plugin({
  name: 'audit-plugin',
  hooks: [
    {
      flow: 'tools:call-tool',
      stage: 'afterExecute',
      handler: async (ctx) => {
        await auditLog(ctx.toolName, ctx.result);
      },
    },
  ],
})
class AuditPlugin { }
Hooks are registered with scope-aware targeting:
  • App-scoped: Hook applies only to the app’s tools
  • Server-scoped: Hook applies to all tools in the server

Context Extensions

Plugins can extend execution contexts with new properties:
// In plugin
declare module '@frontmcp/sdk' {
  interface ExecutionContextBase {
    readonly remember: RememberApi;
  }
}

export function installRememberContextExtension(): void {
  Object.defineProperty(ExecutionContextBase.prototype, 'remember', {
    get: function() {
      return this.get(RememberToken);
    },
  });
}
Usage in tools:
@Tool({ name: 'my_tool', inputSchema: {} })
class MyTool extends ToolContext {
  async execute() {
    // Plugin-provided context extension
    await this.remember.set('key', 'value');
  }
}

Provider Merging

Plugin providers are merged into both:
  • App registry (for app-scoped access)
  • Scope registry (for server-wide access)
@Plugin({
  name: 'cache-plugin',
  providers: [
    {
      token: CacheToken,
      useFactory: () => new RedisCache(),
      scope: ProviderScope.SINGLETON,
    },
  ],
})
class CachePlugin { }

Built-in Plugins

FrontMCP includes official plugins:
PluginDescription
CachePluginResponse caching with Redis/memory support
RememberPluginSession memory storage
CodeCallPluginDynamic code execution
See the Plugins documentation for details.