Skip to content

feat: replace the internal plugin framework with CPEX#3754

Draft
araujof wants to merge 2 commits intomainfrom
feat/cpex
Draft

feat: replace the internal plugin framework with CPEX#3754
araujof wants to merge 2 commits intomainfrom
feat/cpex

Conversation

@araujof
Copy link
Member

@araujof araujof commented Mar 20, 2026

Summary

Replace the internal plugin framework (mcpgateway/plugins/framework/, mcpgateway/plugins/tools/, plugin_templates/) with the CPEX external package (cpex>=0.1.0.dev10).

Closes: #3753

What changed

  • Added cpex as external dependency in pyproject.toml
  • Migrated all imports: from mcpgateway.plugins.frameworkfrom cpex.framework, from mcpgateway.plugins.toolsfrom cpex.tools
  • Moved get_plugin_manager() singleton factory to mcpgateway/plugins/__init__.py (bridges cpex with gateway-specific hook policies)
  • Migrated PluginMode enums: ENFORCESEQUENTIAL, PERMISSIVETRANSFORM, ENFORCE_IGNORE_ERRORSEQUENTIAL + on_error: ignore
  • Adapted to cpex API changes:
    • PluginViolation.http_status_code / .http_headersviolation.details["http_status_code"] / details["http_headers"]
    • PromptPosthookPayload.name.prompt_id; ToolPreInvokePayload.arguments.args
  • Deleted internal framework: mcpgateway/plugins/framework/, mcpgateway/plugins/tools/, plugin_templates/ directory, tests/unit/mcpgateway/plugins/framework/
  • Created acceptance tests (tests/acceptance/plugins/test_cpex_contract.py) verifying cpex API surface, behavioral contracts, serialization, and settings compatibility
  • Updated YAML configs across plugins and test fixtures
  • Updated documentation under docs/docs/using/plugins/, plugins/README.md, plugins/AGENTS.md, llms/plugins-llms.md

Test results

  • Unit tests pass
  • Acceptance tests pass
  • Performance profiling shows no regression
  • flake8, bandit, pylint all clean

araujof added 2 commits March 20, 2026 01:57
Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>
Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>
@araujof araujof added enhancement New feature or request design Architecture and Design plugins MUST P1: Non-negotiable, critical requirements without which the product is non-functional or unsafe labels Mar 20, 2026
@araujof araujof requested a review from terylt March 20, 2026 05:22
@crivetimihai crivetimihai added this to the Release 1.0.0 milestone Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

design Architecture and Design enhancement New feature or request MUST P1: Non-negotiable, critical requirements without which the product is non-functional or unsafe plugins

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Replace Internal Plugin Framework with CPEX (standalone plugin framework package)

2 participants