Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

753 B
Raw Blame
import { getServerFeatureFlagsStateFromRuntimeConfig } from '@/server/featureFlags';

/**
 * Whether MCP Apps are on for this user (runtime flag `mcp_apps`, off by
 * default). Off: MCP sessions don't advertise the extension and tool calls
 * don't look up a `ui://` view, so servers answer exactly as they did before.
 *
 * Never fails the tool call it gates: a flag that can't be read counts as off.
 */
export const isMcpAppsEnabled = async (userId?: string | null): Promise<boolean> => {
  try {
    return (
      (await getServerFeatureFlagsStateFromRuntimeConfig(userId ?? undefined)).enableMcpApps ===
      true
    );
  } catch (error) {
    console.error('[MCPApp] Failed to read the mcp_apps feature flag:', error);
    return false;
  }
};