Overview
Secure MCP Gateway uses a plugin architecture that allows you to extend core functionality with custom implementations. Create your own authentication providers, guardrail detectors, or telemetry exporters without modifying the gateway core.Plugin Types
Auth Plugins
Custom authentication methods (JWT, LDAP, SSO, custom API keys)
Guardrail Plugins
Custom content filters and validators (OpenAI, AWS, custom rules)
Telemetry Plugins
Custom logging and metrics exporters (Datadog, New Relic, stdout)
Architecture
The gateway uses a provider-based plugin system following SOLID principles:Creating an Auth Plugin
Auth Provider Interface
All auth providers must implement theAuthProvider abstract base class:
src/secure_mcp_gateway/plugins/auth/my_provider.py
Register the Provider
Update your config to use the custom provider:~/.enkrypt/enkrypt_mcp_config.json
Example: JWT Auth Provider
Creating a Guardrail Plugin
Guardrail Provider Interface
src/secure_mcp_gateway/plugins/guardrails/my_guardrail.py
Register Guardrail Provider
~/.enkrypt/enkrypt_mcp_config.json
Example: OpenAI Moderation Provider
Creating a Telemetry Plugin
Telemetry Provider Interface
src/secure_mcp_gateway/plugins/telemetry/my_telemetry.py
Register Telemetry Provider
~/.enkrypt/enkrypt_mcp_config.json
Testing Plugins
Unit Testing
Integration Testing
test_plugin_integration.py
Best Practices
Follow SOLID Principles
Keep providers focused on single responsibility
Handle Errors Gracefully
Return proper error messages, never raise unhandled exceptions
Implement All Methods
Implement all required abstract methods completely
Validate Configuration
Always validate config in
validate_config() methodUse Async/Await
Use async for I/O operations (API calls, DB queries)
Add Comprehensive Tests
Write unit and integration tests for your plugin
Document Your Plugin
Include docstrings and usage examples
Version Your Plugin
Use semantic versioning for your provider
Plugin Checklist
Real-World Examples
Find complete plugin examples in the gateway repository:- Auth Plugins:
src/secure_mcp_gateway/plugins/auth/example_providers.py - Guardrail Plugins:
src/secure_mcp_gateway/plugins/guardrails/example_providers.py - Telemetry Plugins:
src/secure_mcp_gateway/plugins/telemetry/example_providers.py
Next Steps
Plugin API Reference
Detailed API documentation for all plugin interfaces
Contributing
Contribute your plugin to the official repository
Add MCP Servers
Learn how to add servers that use your custom auth
Configure Guardrails
Set up custom guardrails for your servers