Skip to main content

Overview

Secure MCP Gateway features a comprehensive plugin architecture that allows you to extend and customize authentication, guardrails, and telemetry functionality. The plugin system follows SOLID principles and provides clean interfaces for building custom providers.

Plugin Types

Authentication

Custom authentication providers for API keys, OAuth, JWT, and more

Guardrails

Input/output validation providers for content safety

Telemetry

Logging, tracing, and metrics providers

Architecture Principles

The plugin system follows these design patterns:

Open/Closed Principle

The system is open for extension (new plugins) but closed for modification (core system unchanged):

Interface Segregation

Providers implement only the interfaces they need:

Dependency Inversion

High-level modules depend on abstractions, not concrete implementations:

Authentication Plugins

AuthProvider Interface

src/secure_mcp_gateway/plugins/auth/base.py

Example: OAuth2 Provider

src/secure_mcp_gateway/plugins/auth/example_providers.py

Guardrail Plugins

GuardrailProvider Interface

src/secure_mcp_gateway/plugins/guardrails/base.py

Example: Custom Keyword Guardrail

src/secure_mcp_gateway/plugins/guardrails/example_providers.py

Telemetry Plugins

TelemetryProvider Interface

src/secure_mcp_gateway/plugins/telemetry/base.py

Plugin Configuration

Configure Plugins in Gateway Config

enkrypt_mcp_config.json

Creating Custom Plugins

1

Create Provider Class

Implement the appropriate abstract base class (AuthProvider, GuardrailProvider, or TelemetryProvider)
2

Implement Required Methods

All @abstractmethod methods must be implemented
3

Add to example_providers.py

Place your provider in the appropriate example_providers.py file
4

Register Provider

Update the plugin loader to include your provider
5

Configure in Config File

Set your provider name in the plugins section

Example: Custom Logging Provider

custom_telemetry_provider.py

Plugin Registry System

Each plugin type has a singleton registry:

Best Practices

Version Compatibility: Always specify provider version in get_version() for compatibility tracking.
Error Handling: Providers should handle errors gracefully and return appropriate status codes in result objects.
Testing: Test custom providers with the included test MCP servers in bad_mcps/ directory.