Feature-flagged resources and prompts remain directly accessible in @frontmcp/plugin-feature-flags
Description
@frontmcp/plugin-feature-flags hides disabled resources and prompts from MCP discovery responses but does not enforce the same feature flags when those capabilities are accessed directly.
The plugin correctly filters disabled capabilities from:
tools/list
resources/list
prompts/listand it also contains an execution-time gate for tools.
However, there is no equivalent execution gate for:
resources/read
prompts/getAs a result, a client that knows the URI of a disabled resource or the name of a disabled prompt can access it directly even when its feature flag evaluates to false.
This was reproduced end-to-end against released @frontmcp/plugin-feature-flags@1.7.2 and @frontmcp/sdk@1.7.2.
In the reproduced configuration:
premium-reports = false
experimental-agent = falsethe following behavior occurred:
resources/list
-> premium resource hidden
prompts/list
-> experimental prompt hidden
resources/read premium resource
-> full resource returned
prompts/get experimental prompt
-> full prompt returned
tools/call experimental tool
-> correctly blocked by the same feature-flag systemThe server-side resource and prompt handlers executed during the bypass, confirming that this is not merely a metadata or discovery issue.
Details
The Feature Flags plugin supports feature-gating MCP capabilities through metadata such as:
featureFlag: 'premium-reports'or:
featureFlag: 'experimental-agent'For resources, the plugin correctly filters disabled entries from discovery through the resource-list hook.
Conceptually:
resource has featureFlag
-> flag evaluates false
-> resources/list removes resourceThe same behavior exists for prompts and tools.
For tools, the plugin additionally performs an execution-time check before the tool runs.
The relevant design is equivalent to:
@ToolHook.Will(
'execute',
{
priority: 50
}
)
async gateToolExecution(
flowCtx
) {
const tool =
flowCtx.state.tool;
const featureFlag =
tool?.metadata
?.featureFlag;
if (!featureFlag) {
return;
}
const enabled =
await this.evaluateFlag(
featureFlag
);
if (!enabled) {
throw new Error(
`Tool "${tool.name}" is disabled by feature flag "${featureFlag}"`
);
}
}This prevents a client from bypassing tools/list filtering simply by invoking a hidden tool directly.
No corresponding enforcement hook exists for resource reads or prompt retrieval.
The resulting resource flow is therefore:
resource metadata:
featureFlag = "premium-reports"
|
v
resources/list
|
+--> plugin evaluates flag = false
|
+--> resource hidden
but:
resources/read
|
v
SDK locates resource
|
v
normal authority checks
|
v
NO feature-flag execution check
|
v
resource handler executes
|
v
disabled content returnedThe prompt path has the same issue:
prompt metadata:
featureFlag = "experimental-agent"
|
v
prompts/list
|
+--> hidden
but:
prompts/get
|
v
prompt resolved
|
v
NO feature-flag execution check
|
v
prompt handler executes
|
v
disabled prompt returnedThe SDK already exposes separate flows for direct resource and prompt access, so discovery filtering alone cannot provide access control.
This is especially significant because the plugin's documented behavior states that disabled capabilities are not only hidden from list responses but also blocked from direct invocation.
PoC
Install the released packages:
npm install \
@frontmcp/sdk@1.7.2 \
@frontmcp/plugin-feature-flags@1.7.2Configure the Feature Flags plugin with disabled resource and prompt flags:
FeatureFlagPlugin.init({
adapter:
'static',
flags: {
'beta-search':
true,
'experimental-agent':
false,
'premium-reports':
false
},
defaultValue:
false
})Register a resource whose feature flag is disabled:
class PremiumStatusResource
extends ResourceContext {
async execute(uri) {
return {
contents: [
{
uri:
'report://premium-status',
mimeType:
'text/plain',
text:
'PREMIUM-SECRET-7f3a'
}
]
};
}
}
FrontMcpResource({
uri:
'report://premium-status',
name:
'Premium Status Report',
featureFlag:
'premium-reports'
})(
PremiumStatusResource
);Register a disabled prompt:
class ExperimentalPrompt
extends PromptContext {
async execute() {
return {
messages: [
{
role:
'user',
content: {
type:
'text',
text:
'EXPERIMENTAL-PROMPT-TEMPLATE-9c21'
}
}
]
};
}
}
FrontMcpPrompt({
name:
'experimental-analysis',
description:
'Experimental analysis prompt',
featureFlag:
'experimental-agent'
})(
ExperimentalPrompt
);Also register a tool using the same disabled flag as a positive control:
FrontMcpTool({
name:
'experimental-tool',
featureFlag:
'experimental-agent',
inputSchema: {}
})(
ExperimentalTool
);Initialize a normal MCP session.
First query discovery.
For:
resources/listthe result does not contain:
report://premium-statusFor:
prompts/listthe result does not contain:
experimental-analysisThis confirms the feature flags are being evaluated and discovery filtering is active.
Now directly request the hidden resource:
{
"jsonrpc": "2.0",
"id": 10,
"method": "resources/read",
"params": {
"uri": "report://premium-status"
}
}Observed:
HTTP 200with the response containing:
PREMIUM-SECRET-7f3aThe resource's server-side handler executed.
Next directly request the hidden prompt:
{
"jsonrpc": "2.0",
"id": 11,
"method": "prompts/get",
"params": {
"name": "experimental-analysis"
}
}Observed:
HTTP 200with the response containing:
EXPERIMENTAL-PROMPT-TEMPLATE-9c21The prompt's server-side handler also executed.
As a positive control, invoke a tool protected by the same disabled feature flag:
{
"jsonrpc": "2.0",
"id": 12,
"method": "tools/call",
"params": {
"name": "experimental-tool",
"arguments": {}
}
}Observed:
Tool "experimental-tool" is disabled by feature flag "experimental-agent"The reproduced behavior was therefore:
premium-reports = false
resources/list
-> premium resource hidden
resources/read
-> premium resource RETURNED
experimental-agent = false
prompts/list
-> experimental prompt hidden
prompts/get
-> experimental prompt RETURNED
experimental-agent = false
tools/call
-> experimental tool BLOCKEDThe tool and prompt use the same disabled flag value in the same session, but only the tool has an execution-time gate.
This isolates the vulnerability to missing enforcement on direct resource and prompt access.
Suggested fix
Feature flags must be enforced at execution time for every gated capability, not only during discovery.
Add resource and prompt execution hooks equivalent to the existing tool gate.
For resources:
@ResourceHook.Will(
'execute',
{
priority: 50
}
)
async gateReadResource(
flowCtx:
FlowCtxOf<
'resources:read-resource'
>
) {
const resource =
flowCtx.state.resource;
if (!resource) {
return;
}
const featureFlag =
resource.metadata
?.featureFlag;
if (!featureFlag) {
return;
}
const enabled =
await this.evaluateRef(
featureFlag
);
if (!enabled) {
throw new Error(
`Resource "${resource.metadata.name}" is disabled by feature flag`
);
}
}For prompts:
@FlowHooksOf(
'prompts:get-prompt'
).Will(
'execute',
{
priority: 50
}
)
async gateGetPrompt(
flowCtx:
FlowCtxOf<
'prompts:get-prompt'
>
) {
const prompt =
flowCtx.state.prompt;
if (!prompt) {
return;
}
const featureFlag =
prompt.metadata
?.featureFlag;
if (!featureFlag) {
return;
}
const enabled =
await this.evaluateRef(
featureFlag
);
if (!enabled) {
throw new Error(
`Prompt "${prompt.metadata.name}" is disabled by feature flag`
);
}
}The same flag-evaluation helper should be shared by:
discovery filtering
tool execution
resource execution
prompt execution
skill executionso that all capability types have identical semantics.
Regression tests should verify:
disabled tool
-> hidden from list
-> direct call blocked
disabled resource
-> hidden from list
-> direct read blocked
disabled prompt
-> hidden from list
-> direct get blocked
enabled capabilities
-> list and direct access both succeedFeature flags intended as access controls must always be checked at the execution/read boundary. Discovery filtering should remain only a presentation and discoverability mechanism.
Impact
A client can directly access resources and prompts that the server operator has disabled for that client through the Feature Flags plugin.
This bypasses the plugin's capability-gating policy while leaving discovery responses appearing correctly restricted.
For feature flags used as entitlement or authorization boundaries, a user whose flag evaluates to false can retrieve the full protected resource by knowing its URI.
The demonstrated resource returned protected content even though it was absent from resources/list.
Similarly, disabled prompts can be retrieved in full through prompts/get, potentially exposing internal prompt templates, unreleased functionality, or other content intentionally restricted by the feature flag.
The failure is particularly misleading because execution-time enforcement works correctly for tools using the same flag state, causing operators to reasonably expect identical behavior for resources and prompts.