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
Add configuration-based feature flags to enable/disable MCP capabilities (tools, resources, prompts, servers, gateways, roots) and additional system endpoints (REST API tools, metrics, version, docs). Features are toggled via environment variables, and the UI/version endpoint shows which features are enabled.
Why Now?
Security Hardening: Disable unused capabilities to reduce attack surface
Compliance: Some deployments may require certain features disabled
Performance: Skip initialization of unused features
Customization: Different deployments have different needs
Gradual Rollout: Enable experimental features selectively
Current State
Existing Flags (implemented):
MCPGATEWAY_UI_ENABLED - Admin UI interface
MCPGATEWAY_ADMIN_API_ENABLED - Admin API endpoints
System feature flags (version, metrics, docs, redoc)
REST API tools conversion flag
Connection tester flag
Tags router flag
📖 User Stories
US-1: Operator - Disable Unused Capabilities
As a platform operator I want to disable MCP capabilities we don't use So that the attack surface is minimized
Acceptance Criteria:
Scenario: Disable resources capabilityGiven FEATURES_RESOURCES_ENABLED=false
When a client calls resources/list
Then a 404 or "capability not available" error should be returned
And the /resources router should not be mounted
Scenario: Disable prompts capabilityGiven FEATURES_PROMPTS_ENABLED=false
When a client calls prompts/list
Then a 404 or "capability not available" error should be returned
Scenario: All capabilities enabled by defaultGiven no feature flags are set
Then all MCP capabilities should be enabled
And all routers should be mounted
As a platform operator I want to control which system endpoints are exposed So that I can hide internal information in production
Acceptance Criteria:
Scenario: Disable metrics endpointGiven FEATURES_METRICS_ENABLED=false
When a client calls GET /metrics
Then a 404 should be returned
Scenario: Disable OpenAPI docsGiven FEATURES_DOCS_ENABLED=false
When a client navigates to /docs
Then a 404 should be returned
And /openapi.json should also return 404
Scenario: Disable version endpointGiven FEATURES_VERSION_ENABLED=false
When a client calls GET /version
Then a 404 should be returned
As a user of the gateway I want to see which features are enabled So that I know what capabilities are available
Acceptance Criteria:
Scenario: Version endpoint shows featuresGiven various feature flags are configured
When I call GET /version
Then the response should include a "features" object
And each feature should show enabled/disabled status
Scenario: Initialize shows capabilitiesGiven FEATURES_RESOURCES_ENABLED=false
When I send initialize request
Then the capabilities response should NOT include "resources"
Technical Requirements:
Add features map to /version response
Update ServerCapabilities based on flags
Show feature status in Admin UI
US-4: Developer - Configure REST API Tools
As a developer I want to enable/disable REST API tool conversion So that I can control how REST endpoints are exposed
Acceptance Criteria:
Scenario: Disable REST API toolsGiven FEATURES_REST_API_TOOLS_ENABLED=false
When gateways are loaded
Then REST endpoints should NOT be converted to tools
And only native MCP tools should be available
Scenario: Enable REST API toolsGiven FEATURES_REST_API_TOOLS_ENABLED=true
When a gateway with REST API specification is loaded
Then REST endpoints should be converted to callable tools
Technical Requirements:
Add FEATURES_REST_API_TOOLS_ENABLED flag
Conditionally load REST-to-tool converter
Skip REST API parsing when disabled
🏗 Architecture
Feature Flag Decision Flow
flowchart TD
A[Application Startup] --> B{Read Feature Flags}
B --> C{FEATURES_TOOLS_ENABLED?}
C -->|true| D[Mount /tools router]
C -->|false| E[Skip /tools router]
B --> F{FEATURES_DOCS_ENABLED?}
F -->|true| G[Enable OpenAPI docs]
F -->|false| H[Disable docs endpoints]
B --> I{Update Capabilities}
I --> J[Build ServerCapabilities]
J --> K[Include only enabled capabilities]
[FEATURE][CONFIG]: Enhanced Endpoint Feature Flags
Goal
Add configuration-based feature flags to enable/disable MCP capabilities (tools, resources, prompts, servers, gateways, roots) and additional system endpoints (REST API tools, metrics, version, docs). Features are toggled via environment variables, and the UI/version endpoint shows which features are enabled.
Why Now?
Current State
Existing Flags (implemented):
MCPGATEWAY_UI_ENABLED- Admin UI interfaceMCPGATEWAY_ADMIN_API_ENABLED- Admin API endpointsMCPGATEWAY_BULK_IMPORT_ENABLED- Bulk import endpointMCP_CLIENT_AUTH_ENABLED- JWT auth for MCP clientsCORS_ENABLED- CORS middlewareSECURITY_HEADERS_ENABLED- Security headers middlewareFEDERATION_ENABLED- Gateway federationSSE_KEEPALIVE_ENABLED- SSE keepalive eventsPLUGINS_ENABLED- Plugin frameworkMissing Flags:
📖 User Stories
US-1: Operator - Disable Unused Capabilities
As a platform operator
I want to disable MCP capabilities we don't use
So that the attack surface is minimized
Acceptance Criteria:
Technical Requirements:
FEATURES_TOOLS_ENABLED,FEATURES_RESOURCES_ENABLED,FEATURES_PROMPTS_ENABLEDFEATURES_SERVERS_ENABLED,FEATURES_GATEWAYS_ENABLED,FEATURES_ROOTS_ENABLEDUS-2: Operator - Control System Endpoints
As a platform operator
I want to control which system endpoints are exposed
So that I can hide internal information in production
Acceptance Criteria:
Technical Requirements:
FEATURES_VERSION_ENABLED,FEATURES_METRICS_ENABLEDFEATURES_DOCS_ENABLED,FEATURES_REDOC_ENABLEDUS-3: User - See Enabled Features
As a user of the gateway
I want to see which features are enabled
So that I know what capabilities are available
Acceptance Criteria:
Technical Requirements:
US-4: Developer - Configure REST API Tools
As a developer
I want to enable/disable REST API tool conversion
So that I can control how REST endpoints are exposed
Acceptance Criteria:
Technical Requirements:
FEATURES_REST_API_TOOLS_ENABLEDflag🏗 Architecture
Feature Flag Decision Flow
flowchart TD A[Application Startup] --> B{Read Feature Flags} B --> C{FEATURES_TOOLS_ENABLED?} C -->|true| D[Mount /tools router] C -->|false| E[Skip /tools router] B --> F{FEATURES_DOCS_ENABLED?} F -->|true| G[Enable OpenAPI docs] F -->|false| H[Disable docs endpoints] B --> I{Update Capabilities} I --> J[Build ServerCapabilities] J --> K[Include only enabled capabilities]Feature Flags Configuration
classDiagram class FeatureFlags { +tools_enabled: bool +resources_enabled: bool +prompts_enabled: bool +servers_enabled: bool +gateways_enabled: bool +roots_enabled: bool +version_enabled: bool +metrics_enabled: bool +docs_enabled: bool +redoc_enabled: bool +rest_api_tools_enabled: bool +tags_enabled: bool +get_enabled_features(): Dict +get_capabilities(): ServerCapabilities }📋 Implementation Tasks
Phase 1: MCP Capability Flags
FEATURES_TOOLS_ENABLED(default: true)FEATURES_RESOURCES_ENABLED(default: true)FEATURES_PROMPTS_ENABLED(default: true)FEATURES_SERVERS_ENABLED(default: true)FEATURES_GATEWAYS_ENABLED(default: true)FEATURES_ROOTS_ENABLED(default: true)Phase 2: System Feature Flags
FEATURES_VERSION_ENABLED(default: true)FEATURES_METRICS_ENABLED(default: true)FEATURES_DOCS_ENABLED(default: true)FEATURES_REDOC_ENABLED(default: true)Phase 3: Additional Flags
FEATURES_REST_API_TOOLS_ENABLED(default: true)FEATURES_CONNECTION_TESTER_ENABLED(default: true)FEATURES_TAGS_ENABLED(default: true)FEATURES_A2A_AGENTS_ENABLED(default: true)Phase 4: Capability Updates
Phase 5: Documentation
.env.examplePhase 6: Testing
⚙️ Configuration Example
✅ Success Criteria
🏁 Definition of Done
make verify🔗 Related Issues