Files
gabrielvidalandClaude Opus 5.5 319560f8d9 feat(plugins): live plugins add their own ai-agent CLI commands and MCP tools
A plugin declares `commands` in plugin.json — each one names a declared
action, with a summary, its args and how to print the answer — and gets
`ai-agent plugin <id> <command> …` and, opt-in (`"mcp": true`), the MCP
tool `plugin_<id>_<command>`. Core no longer names any plugin
(Gabriel's form ai-agent-cli-and-mcp-for-live-plugins_fevcts: manifest
commands, namespaced under `plugin`, MCP opt-in, guests by their grants).

- backend/plugins/commands.py: validation (names, typed args, positional
  order, output text|rows, ≤ 64-char tool names, no commands for a plugin
  named like a core verb) and the caller's catalogue; GET
  /api/plugins/commands (plugins.use — a guest's CLI and AI-app connection
  see the plugins granted to them, never an ownerOnly action). Not in the
  approval fingerprint: a command only reaches an action the plugin already
  declares, through the same route. The consent card lists them.
- cli/plugin_commands.py: the per-plugin argparse parser, table/text
  printing, `ai-agent plugin commands`, `ai-agent plugin call ID ACTION`
  (any action, raw), and the MCP tool specs. readOnly actions go by GET
  ?payload=, so read-only MCP connections work.
- cli/mcp_tools.py: tools/list appends the plugin tools (read group when
  readOnly, run otherwise; none on a worker-bound connection);
  tools/call runs them.
- Removed the hard-coded plugin surfaces: `ai-agent plans|memories|goals`,
  MCP browse plans|goals|memories, read_document, work_on_goal (goals is
  not used — Gabriel). Plans and memories come back as their plugins'
  commands. This also fixes read-only MCP connections, which got "this
  connection is read-only" on plans and memories since they moved to
  plugins (the CLI POSTed). `ai-agent plans` now says where its commands are.
- openapi.json + orval regenerated, authz golden matrix (+1 route), docs
  (plugins.md "Commands", mcp.md, CLAUDE.md, create-plugin skill).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 23:17:09 +01:00
..