feat(mcp): operators can switch MCP (and OAuth) off

Admin switch in the system settings, MCP_ENABLED fixes it. Off: the
endpoint answers 404, OAuth is off, the API key settings hide the MCP tab.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
sandrodachandClaude Opus 5.5 committed 2026-11-01 21:11:53 +01:00
1 parent 39a04082fc
commit c6f28aa816
17 files changed
+197 -30

No files matched your search

+32 -25
View File
@@ -37,6 +37,8 @@ export const ApiKeysPanel: React.FC<ApiKeysPanelProps> = ({ onIngested }) => {
const [connectorUrl, setConnectorUrl] = useState('');
const [copiedConnector, setCopiedConnector] = useState(false);
const [access, setAccess] = useState<Access>('rest');
// The operator can switch MCP off; then only the curl / smart home access is shown
const [mcpEnabled, setMcpEnabled] = useState(true);
// Live Webhook Simulator State
const [simTitle, setSimTitle] = useState('Waschmaschine im Keller ist fertig!');
@@ -59,7 +61,10 @@ export const ApiKeysPanel: React.FC<ApiKeysPanelProps> = ({ onIngested }) => {
api.getTaskLists().then(setTaskLists).catch(() => {});
api
.getAuthStatus()
.then((st) => setConnectorUrl(st.mcpConnectorUrl || ''))
.then((st) => {
setConnectorUrl(st.mcpConnectorUrl || '');
setMcpEnabled(st.mcpEnabled !== false);
})
.catch(() => {});
}, []);
@@ -358,30 +363,32 @@ http_headers = { "X-API-Key" = "${exampleToken}" }`
{/* How to connect: one API, two accesses */}
<div className="pt-4 border-t border-border space-y-4">
<div className="flex flex-wrap gap-1.5" role="tablist" aria-label="Zugang">
{(
[
['rest', 'curl / Smart Home', Terminal],
['mcp', 'KI-Agenten (MCP)', Bot],
] as const
).map(([value, label, Icon]) => (
<button
key={value}
type="button"
role="tab"
aria-selected={access === value}
onClick={() => setAccess(value)}
className={`h-11 sm:h-8 px-3 rounded-btn border text-xs flex items-center gap-1.5 transition-colors ${
access === value ? 'border-accent bg-accent/10 text-main' : 'border-border text-muted hover:text-main'
}`}
>
<Icon className="w-3.5 h-3.5 text-accent" />
{label}
</button>
))}
</div>
{mcpEnabled && (
<div className="flex flex-wrap gap-1.5" role="tablist" aria-label="Zugang">
{(
[
['rest', 'curl / Smart Home', Terminal],
['mcp', 'KI-Agenten (MCP)', Bot],
] as const
).map(([value, label, Icon]) => (
<button
key={value}
type="button"
role="tab"
aria-selected={access === value}
onClick={() => setAccess(value)}
className={`h-11 sm:h-8 px-3 rounded-btn border text-xs flex items-center gap-1.5 transition-colors ${
access === value ? 'border-accent bg-accent/10 text-main' : 'border-border text-muted hover:text-main'
}`}
>
<Icon className="w-3.5 h-3.5 text-accent" />
{label}
</button>
))}
</div>
)}
{access === 'rest' && (
{(access === 'rest' || !mcpEnabled) && (
<div className="space-y-5">
{/* Reading: e.g. a smart home sensor for what is due today */}
<div>
@@ -547,7 +554,7 @@ http_headers = { "X-API-Key" = "${exampleToken}" }`
</div>
)}
{access === 'mcp' && (
{access === 'mcp' && mcpEnabled && (
<div>
<div className="flex items-center gap-3 mb-3">
<div className="w-7 h-7 bg-accent text-on-accent flex items-center justify-center flex-shrink-0">