> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agentfront.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Introduction

> Getting started with FrontMCP Plugins

# Introduction to FrontMCP Plugins

Plugins extend FrontMCP servers with reusable functionality. They hook into the server lifecycle and can modify tool behavior, add new capabilities, and integrate with external services.

## What Are Plugins?

Plugins are modular extensions that:

* Add tools to your server
* Intercept and modify tool calls
* Provide shared services
* Integrate with external systems

## Plugin Architecture

```
┌─────────────────────────────────────┐
│           FrontMCP Server           │
├─────────────────────────────────────┤
│  ┌─────────┐  ┌─────────┐  ┌─────┐  │
│  │ Cache   │  │Remember │  │Code │  │
│  │ Plugin  │  │ Plugin  │  │Call │  │
│  └────┬────┘  └────┬────┘  └──┬──┘  │
│       │            │          │     │
│  ─────┴────────────┴──────────┴───  │
│              Plugin API             │
├─────────────────────────────────────┤
│                Apps                 │
│         (Tools, Resources)          │
└─────────────────────────────────────┘
```

## Installing Plugins

```bash theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
npm install @frontmcp/plugins
```

## Using Plugins

```typescript theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
import { FrontMcp } from '@frontmcp/sdk';
import { CachePlugin } from '@frontmcp/plugins';

@FrontMcp({
  name: 'my-server',
  plugins: [
    new CachePlugin({
      ttl: 60000,
      storage: 'memory'
    })
  ]
})
export class MyServer {}
```

## Plugin Lifecycle

Plugins hook into server lifecycle:

```typescript theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
interface Plugin {
  name: string;

  // Called when server starts
  onInit?(server: Server): Promise<void>;

  // Called when server stops
  onDestroy?(): Promise<void>;

  // Called before each tool execution
  beforeTool?(context: ToolContext): Promise<void>;

  // Called after each tool execution
  afterTool?(context: ToolContext, result: any): Promise<any>;

  // Called on errors
  onError?(error: Error, context: ToolContext): Promise<void>;
}
```

## Plugin Categories

| Category      | Examples                   |
| ------------- | -------------------------- |
| Caching       | Cache, Redis, Memcached    |
| Memory        | Remember, Context, History |
| Execution     | CodeCall, Sandbox, Worker  |
| Integration   | Database, API, Webhook     |
| Observability | Logging, Metrics, Tracing  |

## Next Steps

<CardGroup cols={2}>
  <Card title="Cache Plugin" icon="database" href="/frontmcp/plugins/docs/official/cache">
    Add response caching
  </Card>

  <Card title="Create Plugins" icon="wrench" href="/frontmcp/plugins/docs/creating-plugins">
    Build custom plugins
  </Card>
</CardGroup>
