Skip to content

Plugin Development

Alessio Rocchi edited this page Jan 27, 2026 · 1 revision

Plugin Development

Guide to creating custom plugins for aistack.


Overview

Plugins extend aistack with:

  • Custom agent types
  • Custom MCP tools
  • Custom hooks
  • Custom workflows

Plugin Structure

my-plugin/
├── package.json
├── index.ts
└── README.md

Basic Plugin

// index.ts
import { Plugin, registerAgent, registerMCPTool } from '@blackms/aistack';

export const plugin: Plugin = {
  name: 'my-plugin',
  version: '1.0.0',
  description: 'My custom plugin',

  initialize(config) {
    // Register custom agent
    registerAgent({
      type: 'my-agent',
      name: 'My Custom Agent',
      description: 'Does custom things',
      systemPrompt: 'You are a custom agent...',
      capabilities: ['custom-capability']
    });

    // Register custom MCP tool
    registerMCPTool({
      name: 'my_custom_tool',
      description: 'Custom tool',
      inputSchema: {
        type: 'object',
        properties: {
          input: { type: 'string' }
        }
      },
      handler: async (input) => {
        return { result: 'custom result' };
      }
    });
  },

  cleanup() {
    // Cleanup on shutdown
  }
};

Installation

# Install plugin
npx @blackms/aistack plugin add ./my-plugin

# List plugins
npx @blackms/aistack plugin list

# Remove plugin
npx @blackms/aistack plugin remove my-plugin

Configuration

{
  "plugins": {
    "enabled": true,
    "directory": "./plugins",
    "autoload": true
  }
}

Related:

Clone this wiki locally