Plugins

Plugins

Plugins are packages for Claude Code which allow you to share a bundle of skills, agents, hooks, and MCP servers across projects and teams.

my-plugin/
├── .claude-plugin/
│   └── plugin.json      # Required: Plugin manifest/metadata
├── commands/             # Slash commands (.md files) — optional
├── agents/               # Subagent definitions (.md files) — optional
├── skills/               # Agent skills — optional
│   └── skill-name/
│       └── SKILL.md      # Required for each skill
├── hooks/                # Event handlers — optional
│   └── hooks.json
├── .mcp.json             # MCP server definitions — optional
├── .lsp.json             # LSP server definitions — optional
├── scripts/              # Helper scripts and utilities — optional
└── README.md             # Plugin documentation

The plugin.json defines the plugin:

{
  "name": "plugin-name",
  "version": "1.2.0",
  "description": "Brief plugin description",
  "author": {
    "name": "Author Name",
    "email": "author@example.com",
    "url": "https://github.com/author"
  },
  "homepage": "https://docs.example.com/plugin",
  "repository": "https://github.com/author/plugin",
  "license": "MIT",
  "keywords": ["keyword1", "keyword2"],
  "commands": ["./custom/commands/special.md"],
  "agents": "./custom/agents/",
  "skills": "./custom/skills/",
  "hooks": "./config/hooks.json",
  "mcpServers": "./mcp-config.json",
  "outputStyles": "./styles/",
  "lspServers": "./.lsp.json"
}

You can bundle into your plugin an MCP server via the MCP configuration file — used when your plugin needs a custom server that doesn't exist publicly (a proprietary database connector, an internal company API client, a compiled binary):

{
  "mcpServers": {
    "plugin-database": {
      "command": "${CLAUDE_PLUGIN_ROOT}/servers/db-server",
      "args": ["--config", "${CLAUDE_PLUGIN_ROOT}/config.json"],
      "env": { "DB_PATH": "${CLAUDE_PLUGIN_ROOT}/data" }
    },
    "plugin-api-client": {
      "command": "npx",
      "args": ["@company/mcp-server", "--plugin-mode"],
      "cwd": "${CLAUDE_PLUGIN_ROOT}"
    }
  }
}

You can add to your plugin support for a Language Server through LSP via a .lsp.json configuration file. This will allow Claude Code to have access to a language it doesn't know.

{
  "lean4": {
    "command": "lake",
    "args": ["serve"],
    "extensionToLanguage": { ".lean": "lean4" }
  }
}

Related: Agent Skills, Custom Subagents, Hooks, MCP, Plugin Marketplace, Language Server Protocol