You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* feat: add http hooks.
Signed-off-by: Teryl Taylor <[email protected]>
* feat: add permissions hook for rbac.
Signed-off-by: Teryl Taylor <[email protected]>
* fix: http payload object intialization and pylint issues
Signed-off-by: Frederico Araujo <[email protected]>
* docs: updated docs with new hooks and examples.
Signed-off-by: Teryl Taylor <[email protected]>
* fix: linting and test case issues
Signed-off-by: Teryl Taylor <[email protected]>
* fix: correct mock patching in HTTP auth integration test
The test was trying to patch get_plugin_manager in the wrong location.
Fixed to only patch mcpgateway.auth.get_plugin_manager where it's actually used.
Signed-off-by: Mihai Criveti <[email protected]>
* fix: move uuid import to top level and remove unnecessary else
- Move uuid import from function scope to module scope
- Remove unnecessary else after return in permission check logic
Signed-off-by: Mihai Criveti <[email protected]>
* fix: add missing newline at end of file
Signed-off-by: Mihai Criveti <[email protected]>
* fix: use keyword argument for HttpHeaderPayload in example plugins
Change HttpHeaderPayload(headers) to HttpHeaderPayload(root=headers)
to match production code pattern and satisfy pylint-pydantic.
Fixes E1121 too-many-function-args errors in:
- plugins/examples/custom_auth_example/custom_auth.py (2 places)
- plugins/examples/simple_token_auth/simple_token_auth.py (2 places)
Signed-off-by: Mihai Criveti <[email protected]>
---------
Signed-off-by: Teryl Taylor <[email protected]>
Signed-off-by: Frederico Araujo <[email protected]>
Signed-off-by: Mihai Criveti <[email protected]>
Co-authored-by: Teryl Taylor <[email protected]>
Co-authored-by: Frederico Araujo <[email protected]>
Co-authored-by: Mihai Criveti <[email protected]>
The base plugin class, of which developers subclass and implement the hooks that are important for their plugins. Hook points are functions that interpose on existing MCP and agent-based functionality.
454
+
The `Plugin` class is an **Abstract Base Class (ABC)** that provides the foundation for all plugins. Developers must subclass it and implement only the hooks they need using one of three registration patterns.
442
455
443
456
```python
444
-
class Plugin:
445
-
"""Base plugin class for self-contained, in-process plugins"""
457
+
from abc import ABC
458
+
459
+
class Plugin(ABC):
460
+
"""Abstract base class for self-contained, in-process plugins.
461
+
462
+
Plugins must inherit from this class and implement at least one hook method.
463
+
Three hook registration patterns are supported:
464
+
465
+
1. Convention-based: Name your method to match the hook type
466
+
2. Decorator-based: Use @hook decorator with custom method names
467
+
3. Custom hooks: Define new hook types with @hook decorator
HTTP_POST_REQUEST = "http_post_request" # Response processing and audit logging
1703
+
```
1578
1704
1705
+
See the [HTTP Authentication Hooks Guide](../../using/plugins/http-auth-hooks.md) for implementation details and the [Simple Token Auth Plugin](https://github.com/IBM/mcp-context-forge/tree/main/plugins/examples/simple_token_auth) for a complete example.
1706
+
1707
+
### Planned Hook Points
1708
+
1709
+
```python
1579
1710
# Server lifecycle hooks
1580
1711
SERVER_PRE_REGISTER = "server_pre_register" # Server attestation and validation
0 commit comments