Skip to content

feat(domain): add pluggable ai tool system with mcp server lifecycle management#555

Open
arielshad wants to merge 23 commits intomainfrom
feat/ai-tool-plugin-system
Open

feat(domain): add pluggable ai tool system with mcp server lifecycle management#555
arielshad wants to merge 23 commits intomainfrom
feat/ai-tool-plugin-system

Conversation

@arielshad
Copy link
Copy Markdown
Contributor

Summary

Introduces a complete AI-native tool plugin system that lets users register, configure, and activate external tools (MCP servers, CLI tools, hook-based plugins) into Shep's agentic SDLC workflows.

  • TypeSpec domain models: Plugin entity, ToolGroup model, PluginType/PluginTransport/PluginHealthStatus enums
  • Persistence layer: SQLite migration, PluginMapper (bidirectional), PluginRepository with full CRUD
  • 8 use cases: AddPlugin, RemovePlugin, ListPlugins, EnablePlugin, DisablePlugin, ConfigurePlugin, CheckHealth, GetCatalog
  • Infrastructure services: PluginHealthCheckerService (multi-tier runtime/env validation), McpServerManagerService (process lifecycle), curated plugin catalog (MemPalace, Token Optimizer, Ruflo)
  • Agent integration: MCP config path injection into AgentExecutionOptions, Claude Code executor --mcp-config flag support, feature agent worker plugin startup/shutdown lifecycle
  • CLI commands: Full shep plugin command group with 8 subcommands (add, remove, list, enable, disable, configure, status, catalog)
  • Web UI: Plugin management page with Installed/Catalog tabs, catalog browser with type badges and install buttons, sidebar navigation, per-feature plugin toggles in create-feature drawer
  • DI container: All service/use-case registrations with string token aliases for web routes

Evidence

Web UI - Installed Plugins Tab (empty state)

Installed tab

Web UI - Plugin Catalog Browser

Catalog tab

Web UI - Sidebar Navigation with Plugins

Sidebar

Web UI - Create Feature Drawer with Plugin Toggles

Create feature drawer

Test Results

  • 6,165 unit tests passing across 437 test files (includes 135 plugin-specific tests across 13 files)
  • 637 integration tests passing across 52 test files (includes 18 plugin-specific tests)
  • Lint, format, typecheck, and build all clean

Test Plan

  • TypeSpec compiles with new Plugin entity and enums
  • SQLite migration creates plugins table with unique index
  • PluginMapper round-trip (domain → DB → domain) preserves all fields
  • All 8 use cases tested with mocked dependencies
  • PluginHealthCheckerService validates runtime, env vars, and install status
  • McpServerManagerService handles start/stop/cleanup lifecycle
  • CLI plugin commands parse arguments and invoke correct use cases
  • Web UI plugin page renders installed list and catalog browser
  • Per-feature plugin toggles conditionally render when plugins exist
  • DI container resolves all plugin services and use cases
  • Build compiles without errors
  • Full test suite (unit + integration) passes

🐑 Built with Shep.bot

@github-actions
Copy link
Copy Markdown
Contributor

🔒 Security Issues Detected

Scanner Status Details
Gitleaks ❌ Failed Secret detection in git history
Semgrep ✅ Pass SAST for TypeScript/JavaScript

⚠️ Please review the failed checks above before merging.


🤖 Generated by CI Security Scan | View Details

@github-actions
Copy link
Copy Markdown
Contributor

Dev Release Published

Artifact Version Install
npm 1.183.0-pr555.262baa8 npm install -g @shepai/cli@1.183.0-pr555.262baa8

Published from commit 3cb34fc | View CI

@arielshad arielshad force-pushed the feat/ai-tool-plugin-system branch from 3cb34fc to 393f2da Compare April 14, 2026 07:04
@github-actions
Copy link
Copy Markdown
Contributor

Dev Release Published

Artifact Version Install
npm 1.183.0-pr555.e53ab0e npm install -g @shepai/cli@1.183.0-pr555.e53ab0e

Published from commit 393f2da | View CI

arielshad and others added 23 commits April 14, 2026 11:05
…stem

Co-Authored-By: Shep Bot <shep-agent@users.noreply.github.com>
…ugin system

Co-Authored-By: Shep Bot <shep-agent@users.noreply.github.com>
Co-Authored-By: Shep Bot <shep-agent@users.noreply.github.com>
…l plugin system

Co-Authored-By: Shep Bot <shep-agent@users.noreply.github.com>
Define Plugin entity, ToolGroup model, and three enums (PluginType,
PluginTransport, PluginHealthStatus) in TypeSpec. Add optional
activePlugins field to Feature entity for per-feature plugin activation
overrides. All generated types compile cleanly with zero test breakage.

Co-Authored-By: Shep Bot <shep-agent@users.noreply.github.com>
…nd repository

Introduces the complete persistence foundation for the AI tool plugin system:

- Migration 060: CREATE TABLE plugins with all columns matching the Plugin entity,
  including JSON columns for arrays (server_args, required_env_vars, tool_groups,
  active_tool_groups) and a UNIQUE index on the name column
- Migration 061: ALTER TABLE features ADD COLUMN active_plugins TEXT for per-feature
  plugin activation overrides (JSON-serialized Record<string, boolean>)
- PluginRow mapper: toDatabase/fromDatabase with camelCase/snake_case conversion,
  JSON serialization for array fields, boolean-to-integer mapping, and Date-to-unix
  millisecond conversion
- IPluginRepository interface: CRUD port (create, findById, findByName, list, update,
  delete) in application/ports/output/repositories
- SQLitePluginRepository: Full implementation with prepared statements
- Feature mapper/repository extension: activePlugins field added to FeatureRow,
  toDatabase, fromDatabase, INSERT column list, and UPDATE SET clause
- Comprehensive test coverage: 26 mapper unit tests, 18 repository integration tests,
  5 feature mapper activePlugins tests, 4 feature repository activePlugins integration
  tests — all passing

Co-Authored-By: Shep Bot <shep-agent@users.noreply.github.com>
Add IMcpServerManager and IPluginHealthChecker port interfaces for MCP
server lifecycle and plugin health verification. Create curated plugin
catalog with MemPalace, Token Optimizer, and Ruflo entries. Implement
seven plugin use cases: GetPluginCatalog, AddPlugin, RemovePlugin,
ListPlugins, EnablePlugin, DisablePlugin, and ConfigurePlugin.

Co-Authored-By: Shep Bot <shep-agent@users.noreply.github.com>
…case

Implement PluginHealthCheckerService with multi-tier health checks:
runtime detection via which/where, env var validation. Add
CheckPluginHealthUseCase that runs health checks and persists
updated status to the plugin repository.

Co-Authored-By: Shep Bot <shep-agent@users.noreply.github.com>
Wire up IPluginRepository, IPluginHealthChecker, IMcpServerManager
(no-op placeholder), 8 plugin use cases, and their string-token
aliases for web route resolution.

Co-Authored-By: Shep Bot <shep-agent@users.noreply.github.com>
…ycle

McpServerManagerService replaces the no-op placeholder with real
child_process.spawn() management. Features: per-feature server
start/stop, reference counting for shared servers across concurrent
features, temp .mcp.json config file generation, SIGTERM cleanup,
and explicit env var passing (PATH + required vars only).

Co-Authored-By: Shep Bot <shep-agent@users.noreply.github.com>
New optional mcpConfigPath field on AgentExecutionOptions carries the
path to a per-feature .mcp.json temp file through the agent-agnostic
interface. Each executor translates this to its own MCP config flag.

Co-Authored-By: Shep Bot <shep-agent@users.noreply.github.com>
ClaudeCodeExecutorService.buildArgs() now adds --mcp-config <path>
when options.mcpConfigPath is set. This tells Claude Code to load
plugin MCP servers from the generated per-feature temp file. Works
alongside existing --strict-mcp-config (disableMcp) flag.

Co-Authored-By: Shep Bot <shep-agent@users.noreply.github.com>
…ptions builder

Wire mcpConfigPath through the feature agent graph state annotation and
buildExecutorOptions so plugin MCP server config is forwarded to the
agent executor. Update test state fixtures to include the new channel.

Co-Authored-By: Shep Bot <shep-agent@users.noreply.github.com>
…t worker

Start enabled MCP plugin servers before graph invocation and pass the
generated mcpConfigPath into graph state. Stop servers in the finally
block for cleanup. Degrades gracefully if plugin startup fails.

Co-Authored-By: Shep Bot <shep-agent@users.noreply.github.com>
Add shep plugin {add,remove,list,enable,disable,configure,status,catalog}
CLI commands following the settings command group pattern. Each subcommand
resolves its use case from the DI container and provides user-friendly
output with colored status indicators and table formatting.

Co-Authored-By: Shep Bot <shep-agent@users.noreply.github.com>
Co-Authored-By: Shep Bot <shep-agent@users.noreply.github.com>
…ure toggles

- Add 7 server actions for plugin CRUD operations (list, add, remove,
  toggle, configure, health check, catalog)
- Add PluginList component with health status badges and enable/disable
  toggles
- Add PluginCatalog browser component with install buttons
- Add /plugins page with tabbed Installed/Catalog views
- Add plugins navigation item to app sidebar with i18n support
- Add per-feature plugin activation toggles to the create feature drawer
- Wire activePlugins through CreateDrawerClient, server action, and use
  case layers

Co-Authored-By: Shep Bot <shep-agent@users.noreply.github.com>
Co-Authored-By: Shep Bot <shep-agent@users.noreply.github.com>
Co-Authored-By: Shep Bot <shep-agent@users.noreply.github.com>
Co-Authored-By: Shep Bot <shep-agent@users.noreply.github.com>
Co-Authored-By: Shep Bot <shep-agent@users.noreply.github.com>
Co-Authored-By: Shep Bot <shep-agent@users.noreply.github.com>
Rewrote docs(specs) research commit subject from 74 to 54 characters
to pass commitlint subject-max-length rule.

Co-Authored-By: Shep Bot <shep-agent@users.noreply.github.com>
@arielshad arielshad force-pushed the feat/ai-tool-plugin-system branch from 393f2da to ce5384b Compare April 14, 2026 08:12
@github-actions
Copy link
Copy Markdown
Contributor

Dev Release Published

Artifact Version Install
npm 1.184.0-pr555.4b88627 npm install -g @shepai/cli@1.184.0-pr555.4b88627

Published from commit ce5384b | View CI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant