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

# Overview

### Goals of the Plugin System

The Xpert AI plugin system aims to provide developers with an **extensible, reusable, and loosely coupled** extension mechanism, enabling business features to be integrated into the system in a modular way. Through plugin-based design, we can:

* **Quickly extend system capabilities** without modifying core code
* Decouple different business logic into **independent, maintainable functional units**
* Build a unified plugin ecosystem to facilitate **collaborative development by internal teams and external developers**

### Design Philosophy

The plugin system is built on the **[NestJS](https://nestjs.com/) + [TypeORM](https://typeorm.io/)** tech stack, combining dependency injection, modularization, decorator pattern, and strategy pattern to provide a comprehensive extension point mechanism:

1. **Modular Design**: Each plugin is an independent NestJS module with its own `controller`, `service`, `strategy`, and `entity`.
2. **Strategy-Based Extension**: Through [strategy mechanisms](https://en.wikipedia.org/wiki/Strategy_pattern) such as `IntegrationStrategy` and `DocumentSourceStrategy`, plugins can be mounted to the host system using the strategy pattern, enabling integration with external systems or document data sources.
3. **Lifecycle Management**: Plugins have a complete lifecycle (register → start → destroy), allowing developers to perform initialization or cleanup at different stages.
4. **Enhancement Points**: The host system defines several enhancement points (strategies). Plugins only need to implement the corresponding interfaces to seamlessly extend system capabilities.
5. **Security and Configuration**: Based on `zod` configuration schemas, plugins can declare required parameters (such as API Key, URL, etc.) and manage them securely via the system interface or configuration files.
6. **Resource Packaging**: A plugin can also ship installable resources such as `Skills`, `MCP`, `Apps`, and `Hooks`. The host can initialize them into a workspace or an existing Xpert based on the target.

### Why Plugin Architecture?

In traditional monolithic architectures, business features are often tightly coupled with core code, resulting in:

* High cost of extension, requiring changes to core code
* High coupling between functional modules, making maintenance difficult
* Poor ecosystem development, preventing external contributors

With plugin architecture, Xpert AI achieves:

* **Flexible extension**: New features can be added by installing plugins, not modifying the core
* **Module decoupling**: Each plugin is maintained independently, reducing code conflicts
* **Ecosystem building**: Third-party developers can quickly write and publish plugins, enriching system functionality
* **Cross-system integration**: Plugins can act as bridges to connect external APIs or systems

### Suitable Scenarios for Plugin Development

The plugin system is widely applicable to the following scenarios:

* **System integration**: Integrating with third-party systems such as Firecrawl, OpenAI, Slack, Feishu, etc.
* **Data source extension**: Introducing new data sources for BI, search, knowledge base, and other features
* **Toolset extension**: Providing new tool capabilities for agents or Copilot
* **MCP Tools and MCP Apps**: Exposing standard MCP tools through a [plugin-managed MCP server](./mcp-tools-and-apps) and rendering interactive tool results in ChatKit
* **Industry-specific customization**: Developing independent plugins for business expansion in industries such as energy, finance, retail, etc.
