From 48603b993d77624fefe1f669a184dd002860d890 Mon Sep 17 00:00:00 2001
From: Anish Sarkar <104695310+AnishSarkar22@users.noreply.github.com>
Date: Mon, 19 Jan 2026 17:59:06 +0530
Subject: [PATCH 01/11] feat: Update MCP connector icon and UI styling
---
.../connect-forms/components/mcp-connect-form.tsx | 10 ++++++----
surfsense_web/contracts/enums/connectorIcons.tsx | 2 +-
.../public/connectors/modelcontextprotocol.svg | 1 +
3 files changed, 8 insertions(+), 5 deletions(-)
create mode 100644 surfsense_web/public/connectors/modelcontextprotocol.svg
diff --git a/surfsense_web/components/assistant-ui/connector-popup/connect-forms/components/mcp-connect-form.tsx b/surfsense_web/components/assistant-ui/connector-popup/connect-forms/components/mcp-connect-form.tsx
index a671c91e8..68ec12610 100644
--- a/surfsense_web/components/assistant-ui/connector-popup/connect-forms/components/mcp-connect-form.tsx
+++ b/surfsense_web/components/assistant-ui/connector-popup/connect-forms/components/mcp-connect-form.tsx
@@ -122,10 +122,12 @@ export const MCPConnectForm: FC = ({ onSubmit, isSubmitting })
return (
-
-
- Connect to an MCP (Model Context Protocol) server. Each MCP server is added as a separate connector.
-
+
+
+
+ Connect to an MCP (Model Context Protocol) server. Each MCP server is added as a separate connector.
+
+
-
- {testResult && (
-
- {testResult.status === "success" ? (
-
- ) : (
-
- )}
-
-
-
- {testResult.status === "success" ? "Connection Successful" : "Connection Failed"}
-
- {testResult.tools.length > 0 && (
-
- )}
-
-
- {testResult.message}
- {showDetails && testResult.tools.length > 0 && (
-
-
- Available tools:
-
-
- {testResult.tools.map((tool, i) => (
- - {tool.name}
- ))}
-
-
- )}
-
-
-
- )}
diff --git a/surfsense_web/components/assistant-ui/connector-popup/connector-configs/components/mcp-config.tsx b/surfsense_web/components/assistant-ui/connector-popup/connector-configs/components/mcp-config.tsx
index a0868e2f5..3e306f303 100644
--- a/surfsense_web/components/assistant-ui/connector-popup/connector-configs/components/mcp-config.tsx
+++ b/surfsense_web/components/assistant-ui/connector-popup/connector-configs/components/mcp-config.tsx
@@ -22,23 +22,6 @@ interface MCPConfigProps extends ConnectorConfigProps {
}
export const MCPConfig: FC = ({ connector, onConfigChange, onNameChange }) => {
- // Validate that this is an MCP connector
- if (connector.connector_type !== EnumConnectorName.MCP_CONNECTOR) {
- console.error(
- "MCPConfig received non-MCP connector:",
- connector.connector_type
- );
- return (
-
-
- Invalid Connector Type
-
- This component can only be used with MCP connectors.
-
-
- );
- }
-
const [name, setName] = useState("");
const [configJson, setConfigJson] = useState("");
const [jsonError, setJsonError] = useState(null);
@@ -63,8 +46,24 @@ export const MCPConfig: FC = ({ connector, onConfigChange, onNam
};
setConfigJson(JSON.stringify(configObj, null, 2));
}
- // eslint-disable-next-line react-hooks/exhaustive-deps
- }, []); // Only run on mount to preserve user edits
+ }, []);
+
+ // Validate that this is an MCP connector (after hooks)
+ if (connector.connector_type !== EnumConnectorName.MCP_CONNECTOR) {
+ console.error(
+ "MCPConfig received non-MCP connector:",
+ connector.connector_type
+ );
+ return (
+
+
+ Invalid Connector Type
+
+ This component can only be used with MCP connectors.
+
+
+ );
+ }
const handleNameChange = (value: string) => {
setName(value);
@@ -126,15 +125,21 @@ export const MCPConfig: FC = ({ connector, onConfigChange, onNam
return (
{/* Server Name */}
-
-
-
handleNameChange(e.target.value)}
- placeholder="e.g., Filesystem Server"
- required
- />
+
+
+
+
handleNameChange(e.target.value)}
+ placeholder="e.g., Filesystem Server"
+ className="border-slate-400/20 focus-visible:border-slate-400/40"
+ required
+ />
+
+ A friendly name to identify this connector.
+
+
{/* Server Configuration */}
@@ -168,8 +173,8 @@ export const MCPConfig: FC
= ({ connector, onConfigChange, onNam
type="button"
onClick={handleTestConnection}
disabled={isTesting}
- variant="outline"
- className="w-full"
+ variant="secondary"
+ className="w-full h-8 text-[13px] px-3 rounded-lg font-medium bg-white text-slate-700 hover:bg-slate-50 border-0 shadow-xs dark:bg-secondary dark:text-secondary-foreground dark:hover:bg-secondary/80"
>
{isTesting ? "Testing Connection..." : "Test Connection"}
@@ -228,8 +233,8 @@ export const MCPConfig: FC = ({ connector, onConfigChange, onNam
Available tools:
- {testResult.tools.map((tool, i) => (
- - {tool.name}
+ {testResult.tools.map((tool) => (
+ - {tool.name}
))}
diff --git a/surfsense_web/components/assistant-ui/connector-popup/connector-configs/views/connector-edit-view.tsx b/surfsense_web/components/assistant-ui/connector-popup/connector-configs/views/connector-edit-view.tsx
index 515a3a47b..80d364f27 100644
--- a/surfsense_web/components/assistant-ui/connector-popup/connector-configs/views/connector-edit-view.tsx
+++ b/surfsense_web/components/assistant-ui/connector-popup/connector-configs/views/connector-edit-view.tsx
@@ -151,7 +151,7 @@ export const ConnectorEditView: FC
= ({
- {connector.connector_type === "MCP_CONNECTOR" ? "MCP Server" : connector.name}
+ {connector.name}
Manage your connector settings and sync configuration
diff --git a/surfsense_web/components/assistant-ui/connector-popup/hooks/use-connector-dialog.ts b/surfsense_web/components/assistant-ui/connector-popup/hooks/use-connector-dialog.ts
index 7ac0d3e0f..b7fb9880a 100644
--- a/surfsense_web/components/assistant-ui/connector-popup/hooks/use-connector-dialog.ts
+++ b/surfsense_web/components/assistant-ui/connector-popup/hooks/use-connector-dialog.ts
@@ -645,7 +645,7 @@ export const useConnectorDialog = () => {
});
const successMessage = currentConnectorType === "MCP_CONNECTOR"
- ? `${connector.name} MCP server added successfully`
+ ? `${connector.name} added successfully`
: `${connectorTitle} connected and indexing started!`;
toast.success(successMessage, {
description: periodicEnabledForIndexing
@@ -709,7 +709,7 @@ export const useConnectorDialog = () => {
} else {
// Other non-indexable connectors - just show success message and close
const successMessage = currentConnectorType === "MCP_CONNECTOR"
- ? `${connector.name} MCP server added successfully`
+ ? `${connector.name} added successfully`
: `${connectorTitle} connected successfully!`;
toast.success(successMessage);
diff --git a/surfsense_web/components/assistant-ui/connector-popup/tabs/all-connectors-tab.tsx b/surfsense_web/components/assistant-ui/connector-popup/tabs/all-connectors-tab.tsx
index d358037c2..260d6c926 100644
--- a/surfsense_web/components/assistant-ui/connector-popup/tabs/all-connectors-tab.tsx
+++ b/surfsense_web/components/assistant-ui/connector-popup/tabs/all-connectors-tab.tsx
@@ -1,6 +1,7 @@
"use client";
import type { FC } from "react";
+import { EnumConnectorName } from "@/contracts/enums/connector";
import type { SearchSourceConnector } from "@/contracts/types/connector.types";
import { ConnectorCard } from "../components/connector-card";
import { CRAWLERS, OAUTH_CONNECTORS, OTHER_CONNECTORS } from "../constants/connector-constants";
@@ -162,6 +163,12 @@ export const AllConnectorsTab: FC = ({
);
const isIndexing = actualConnector && indexingConnectorIds?.has(actualConnector.id);
+ // For MCP connectors, count total MCP connectors instead of document count
+ const isMCP = connector.connectorType === EnumConnectorName.MCP_CONNECTOR;
+ const mcpConnectorCount = isMCP && allConnectors
+ ? allConnectors.filter((c: SearchSourceConnector) => c.connector_type === EnumConnectorName.MCP_CONNECTOR).length
+ : undefined;
+
const handleConnect = onConnectNonOAuth
? () => onConnectNonOAuth(connector.connectorType)
: () => {}; // Fallback - connector popup should handle all connector types
@@ -176,7 +183,7 @@ export const AllConnectorsTab: FC = ({
isConnected={isConnected}
isConnecting={isConnecting}
documentCount={documentCount}
-
+ connectorCount={mcpConnectorCount}
isIndexing={isIndexing}
onConnect={handleConnect}
onManage={
diff --git a/surfsense_web/components/assistant-ui/connector-popup/utils/mcp-config-validator.ts b/surfsense_web/components/assistant-ui/connector-popup/utils/mcp-config-validator.ts
index dea547be7..36afc44f0 100644
--- a/surfsense_web/components/assistant-ui/connector-popup/utils/mcp-config-validator.ts
+++ b/surfsense_web/components/assistant-ui/connector-popup/utils/mcp-config-validator.ts
@@ -131,19 +131,24 @@ export const parseMCPConfig = (configJson: string): MCPConfigValidationResult =>
// Replace technical error messages with user-friendly ones
if (errorMsg.includes("expected string, received undefined")) {
- errorMsg = "This field is required";
+ errorMsg = fieldPath
+ ? `The '${fieldPath}' field is required`
+ : "This field is required";
} else if (errorMsg.includes("Invalid input")) {
- errorMsg = "Invalid value";
+ errorMsg = fieldPath
+ ? `The '${fieldPath}' field has an invalid value`
+ : "Invalid value";
+ } else if (fieldPath && !errorMsg.toLowerCase().includes(fieldPath.toLowerCase())) {
+ // If error message doesn't mention the field name, prepend it
+ errorMsg = `The '${fieldPath}' field: ${errorMsg}`;
}
- const formattedError = fieldPath ? `${fieldPath}: ${errorMsg}` : errorMsg;
-
- console.error('[MCP Validator] ❌ Validation error:', formattedError);
+ console.error('[MCP Validator] ❌ Validation error:', errorMsg);
console.error('[MCP Validator] Full Zod errors:', result.error.issues);
return {
config: null,
- error: formattedError,
+ error: errorMsg,
};
}
diff --git a/surfsense_web/components/assistant-ui/connector-popup/views/connector-accounts-list-view.tsx b/surfsense_web/components/assistant-ui/connector-popup/views/connector-accounts-list-view.tsx
index 5f8c1f3ed..2ded83284 100644
--- a/surfsense_web/components/assistant-ui/connector-popup/views/connector-accounts-list-view.tsx
+++ b/surfsense_web/components/assistant-ui/connector-popup/views/connector-accounts-list-view.tsx
@@ -1,9 +1,10 @@
"use client";
import { differenceInDays, differenceInMinutes, format, isToday, isYesterday } from "date-fns";
-import { ArrowLeft, Loader2, Plus } from "lucide-react";
+import { ArrowLeft, Loader2, Plus, Server } from "lucide-react";
import type { FC } from "react";
import { Button } from "@/components/ui/button";
+import { EnumConnectorName } from "@/contracts/enums/connector";
import { getConnectorIcon } from "@/contracts/enums/connectorIcons";
import type { SearchSourceConnector } from "@/contracts/types/connector.types";
import { cn } from "@/lib/utils";
@@ -19,6 +20,7 @@ interface ConnectorAccountsListViewProps {
onManage: (connector: SearchSourceConnector) => void;
onAddAccount: () => void;
isConnecting?: boolean;
+ addButtonText?: string;
}
/**
@@ -70,6 +72,7 @@ export const ConnectorAccountsListView: FC = ({
onManage,
onAddAccount,
isConnecting = false,
+ addButtonText,
}) => {
// Get connector status
const { isConnectorEnabled, getConnectorStatusMessage } = useConnectorStatus();
@@ -79,6 +82,20 @@ export const ConnectorAccountsListView: FC = ({
// Filter connectors to only show those of this type
const typeConnectors = connectors.filter((c) => c.connector_type === connectorType);
+
+ // Determine button text - default to "Add Account" unless specified
+ const buttonText = addButtonText || (connectorType === EnumConnectorName.MCP_CONNECTOR ? "Add New MCP Server" : "Add Account");
+ const isMCP = connectorType === EnumConnectorName.MCP_CONNECTOR;
+
+ // Helper to get display name for connector (handles MCP server name extraction)
+ const getDisplayName = (connector: SearchSourceConnector): string => {
+ if (isMCP) {
+ // For MCP, extract server name from config if available
+ const serverName = connector.config?.server_config?.name || connector.name;
+ return serverName;
+ }
+ return getConnectorDisplayName(connector.name);
+ };
return (
@@ -130,7 +147,7 @@ export const ConnectorAccountsListView: FC = ({
)}
- {isConnecting ? "Connecting" : "Add Account"}
+ {isConnecting ? "Connecting" : buttonText}
@@ -139,8 +156,27 @@ export const ConnectorAccountsListView: FC = ({
{/* Content */}
{/* Connected Accounts Grid */}
-
- {typeConnectors.map((connector) => {
+ {typeConnectors.length === 0 ? (
+
+
+ {isMCP ? (
+
+ ) : (
+ getConnectorIcon(connectorType, "size-8")
+ )}
+
+
+ {isMCP ? "No MCP Servers" : `No ${connectorTitle} Accounts`}
+
+
+ {isMCP
+ ? "Get started by adding your first Model Context Protocol server"
+ : `Get started by connecting your first ${connectorTitle} account`}
+
+
+ ) : (
+
+ {typeConnectors.map((connector) => {
const isIndexing = indexingConnectorIds.has(connector.id);
return (
@@ -165,7 +201,7 @@ export const ConnectorAccountsListView: FC = ({
- {getConnectorDisplayName(connector.name)}
+ {getDisplayName(connector)}
{isIndexing ? (
@@ -193,7 +229,8 @@ export const ConnectorAccountsListView: FC = ({
);
})}
-
+
+ )}
);
diff --git a/surfsense_web/components/assistant-ui/connector-popup/views/mcp-connector-list-view.tsx b/surfsense_web/components/assistant-ui/connector-popup/views/mcp-connector-list-view.tsx
deleted file mode 100644
index c826e9fc4..000000000
--- a/surfsense_web/components/assistant-ui/connector-popup/views/mcp-connector-list-view.tsx
+++ /dev/null
@@ -1,145 +0,0 @@
-"use client";
-
-import { Plus, Server, XCircle } from "lucide-react";
-import type { FC } from "react";
-import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
-import { Button } from "@/components/ui/button";
-import { EnumConnectorName } from "@/contracts/enums/connector";
-import { getConnectorIcon } from "@/contracts/enums/connectorIcons";
-import type { SearchSourceConnector } from "@/contracts/types/connector.types";
-import { cn } from "@/lib/utils";
-
-interface MCPConnectorListViewProps {
- mcpConnectors: SearchSourceConnector[];
- onAddNew: () => void;
- onManageConnector: (connector: SearchSourceConnector) => void;
- onBack: () => void;
-}
-
-export const MCPConnectorListView: FC = ({
- mcpConnectors,
- onAddNew,
- onManageConnector,
- onBack,
-}) => {
- // Validate that all connectors are MCP connectors
- const invalidConnectors = mcpConnectors.filter(
- (c) => c.connector_type !== EnumConnectorName.MCP_CONNECTOR
- );
-
- if (invalidConnectors.length > 0) {
- console.error(
- "MCPConnectorListView received non-MCP connectors:",
- invalidConnectors.map((c) => c.connector_type)
- );
- return (
-
-
- Invalid Connector Type
-
- This view can only display MCP connectors. Found {invalidConnectors.length} invalid
- connector(s).
-
-
- );
- }
- return (
-
- {/* Header */}
-
-
-
-
-
MCP Connectors
-
- Manage your Model Context Protocol servers
-
-
-
-
-
- {/* Add New Button */}
-
-
-
-
- {/* MCP Connectors List */}
-
- {mcpConnectors.length === 0 ? (
-
-
-
-
-
No MCP Servers
-
- Get started by adding your first Model Context Protocol server
-
-
- ) : (
- mcpConnectors.map((connector) => {
- // Extract server name from config
- const serverName = connector.config?.server_config?.name || connector.name;
-
- return (
-
-
- {getConnectorIcon("MCP_CONNECTOR", "size-6")}
-
-
-
-
- );
- })
- )}
-
-
- );
-};
From 0f3e1b118d4b4b5f03dec7a7823ee1666226571f Mon Sep 17 00:00:00 2001
From: Anish Sarkar <104695310+AnishSarkar22@users.noreply.github.com>
Date: Mon, 19 Jan 2026 20:21:02 +0530
Subject: [PATCH 03/11] fix: revert back the alert when clicking "Test
Connection" button when adding an MCP, remove toast
---
.../components/mcp-connect-form.tsx | 96 +++++++++++++++----
.../components/mcp-config.tsx | 2 +-
2 files changed, 79 insertions(+), 19 deletions(-)
diff --git a/surfsense_web/components/assistant-ui/connector-popup/connect-forms/components/mcp-connect-form.tsx b/surfsense_web/components/assistant-ui/connector-popup/connect-forms/components/mcp-connect-form.tsx
index 17c6245bd..b619b84e1 100644
--- a/surfsense_web/components/assistant-ui/connector-popup/connect-forms/components/mcp-connect-form.tsx
+++ b/surfsense_web/components/assistant-ui/connector-popup/connect-forms/components/mcp-connect-form.tsx
@@ -1,9 +1,8 @@
"use client";
-import { Server } from "lucide-react";
+import { CheckCircle2, ChevronDown, ChevronUp, Server, XCircle } from "lucide-react";
import { type FC, useRef, useState } from "react";
-import { toast } from "sonner";
-import { Alert, AlertDescription } from "@/components/ui/alert";
+import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
import { Button } from "@/components/ui/button";
import { Label } from "@/components/ui/label";
import { Textarea } from "@/components/ui/textarea";
@@ -13,6 +12,7 @@ import {
extractServerName,
parseMCPConfig,
testMCPConnection,
+ type MCPConnectionTestResult,
} from "../../utils/mcp-config-validator";
export const MCPConnectForm: FC = ({ onSubmit, isSubmitting }) => {
@@ -20,6 +20,8 @@ export const MCPConnectForm: FC = ({ onSubmit, isSubmitting })
const [configJson, setConfigJson] = useState("");
const [jsonError, setJsonError] = useState(null);
const [isTesting, setIsTesting] = useState(false);
+ const [showDetails, setShowDetails] = useState(false);
+ const [testResult, setTestResult] = useState(null);
const DEFAULT_CONFIG = JSON.stringify(
{
@@ -65,26 +67,19 @@ export const MCPConnectForm: FC = ({ onSubmit, isSubmitting })
const handleTestConnection = async () => {
const serverConfig = parseConfig();
if (!serverConfig) {
- toast.error("Invalid configuration", {
- description: jsonError || "Please check your MCP server configuration JSON.",
+ setTestResult({
+ status: "error",
+ message: jsonError || "Invalid configuration",
+ tools: [],
});
return;
}
setIsTesting(true);
+ setTestResult(null);
const result = await testMCPConnection(serverConfig);
-
- if (result.status === "success") {
- toast.success("Connection Successful", {
- description: result.message,
- });
- } else {
- toast.error("Connection Failed", {
- description: result.message,
- });
- }
-
+ setTestResult(result);
setIsTesting(false);
};
@@ -153,17 +148,82 @@ export const MCPConnectForm: FC = ({ onSubmit, isSubmitting })
+ {/* Test Connection */}
+
+ {/* Test Result */}
+ {testResult && (
+
+ {testResult.status === "success" ? (
+
+ ) : (
+
+ )}
+
+
+
+ {testResult.status === "success" ? "Connection Successful" : "Connection Failed"}
+
+ {testResult.tools.length > 0 && (
+
+ )}
+
+
+ {testResult.message}
+ {showDetails && testResult.tools.length > 0 && (
+
+
+ Available tools:
+
+
+ {testResult.tools.map((tool) => (
+ - {tool.name}
+ ))}
+
+
+ )}
+
+
+
+ )}
diff --git a/surfsense_web/components/assistant-ui/connector-popup/connector-configs/components/mcp-config.tsx b/surfsense_web/components/assistant-ui/connector-popup/connector-configs/components/mcp-config.tsx
index 3e306f303..f7ca114ca 100644
--- a/surfsense_web/components/assistant-ui/connector-popup/connector-configs/components/mcp-config.tsx
+++ b/surfsense_web/components/assistant-ui/connector-popup/connector-configs/components/mcp-config.tsx
@@ -176,7 +176,7 @@ export const MCPConfig: FC = ({ connector, onConfigChange, onNam
variant="secondary"
className="w-full h-8 text-[13px] px-3 rounded-lg font-medium bg-white text-slate-700 hover:bg-slate-50 border-0 shadow-xs dark:bg-secondary dark:text-secondary-foreground dark:hover:bg-secondary/80"
>
- {isTesting ? "Testing Connection..." : "Test Connection"}
+ {isTesting ? "Testing Connection" : "Test Connection"}
From 5f672a07f2fab913894dfa4e52d3037831d20ca5 Mon Sep 17 00:00:00 2001
From: Anish Sarkar <104695310+AnishSarkar22@users.noreply.github.com>
Date: Mon, 19 Jan 2026 20:41:26 +0530
Subject: [PATCH 04/11] refactor: enhance MCP connection forms and account list
styling
- Updated MCPConnectForm and MCPConfig to improve layout and responsiveness.
- Adjusted text sizes and spacing for better readability across different screen sizes.
- Enhanced button labels for clarity when showing or hiding details.
- Improved styling for the ConnectorAccountsListView to ensure consistent appearance and user experience.
---
.../components/mcp-connect-form.tsx | 18 ++++++++++--------
.../components/mcp-config.tsx | 10 ++++++----
.../views/connector-accounts-list-view.tsx | 12 ++++++------
3 files changed, 22 insertions(+), 18 deletions(-)
diff --git a/surfsense_web/components/assistant-ui/connector-popup/connect-forms/components/mcp-connect-form.tsx b/surfsense_web/components/assistant-ui/connector-popup/connect-forms/components/mcp-connect-form.tsx
index b619b84e1..d67b9b49c 100644
--- a/surfsense_web/components/assistant-ui/connector-popup/connect-forms/components/mcp-connect-form.tsx
+++ b/surfsense_web/components/assistant-ui/connector-popup/connect-forms/components/mcp-connect-form.tsx
@@ -176,8 +176,8 @@ export const MCPConnectForm: FC = ({ onSubmit, isSubmitting })
)}
-
-
+
+
{testResult.status === "success" ? "Connection Successful" : "Connection Failed"}
{testResult.tools.length > 0 && (
@@ -185,7 +185,7 @@ export const MCPConnectForm: FC
= ({ onSubmit, isSubmitting })
type="button"
variant="ghost"
size="sm"
- className="h-6 px-2"
+ className="h-6 px-2 self-start sm:self-auto text-xs"
onClick={(e) => {
e.preventDefault();
e.stopPropagation();
@@ -195,25 +195,27 @@ export const MCPConnectForm: FC = ({ onSubmit, isSubmitting })
{showDetails ? (
<>
- Hide Details
+ Hide Details
+ Hide
>
) : (
<>
- Show Details
+ Show Details
+ Show
>
)}
)}
-
+
{testResult.message}
{showDetails && testResult.tools.length > 0 && (
-
+
Available tools:
-
+
{testResult.tools.map((tool) => (
- {tool.name}
))}
diff --git a/surfsense_web/components/assistant-ui/connector-popup/connector-configs/components/mcp-config.tsx b/surfsense_web/components/assistant-ui/connector-popup/connector-configs/components/mcp-config.tsx
index f7ca114ca..94696581b 100644
--- a/surfsense_web/components/assistant-ui/connector-popup/connector-configs/components/mcp-config.tsx
+++ b/surfsense_web/components/assistant-ui/connector-popup/connector-configs/components/mcp-config.tsx
@@ -195,7 +195,7 @@ export const MCPConfig: FC = ({ connector, onConfigChange, onNam
)}
-
+
{testResult.status === "success" ? "Connection Successful" : "Connection Failed"}
@@ -204,7 +204,7 @@ export const MCPConfig: FC
= ({ connector, onConfigChange, onNam
type="button"
variant="ghost"
size="sm"
- className="h-6 px-2"
+ className="h-6 px-2 self-start sm:self-auto text-xs"
onClick={(e) => {
e.preventDefault();
e.stopPropagation();
@@ -214,12 +214,14 @@ export const MCPConfig: FC = ({ connector, onConfigChange, onNam
{showDetails ? (
<>
- Hide Details
+ Hide Details
+ Hide
>
) : (
<>
- Show Details
+ Show Details
+ Show
>
)}
diff --git a/surfsense_web/components/assistant-ui/connector-popup/views/connector-accounts-list-view.tsx b/surfsense_web/components/assistant-ui/connector-popup/views/connector-accounts-list-view.tsx
index 2ded83284..fc1f76f66 100644
--- a/surfsense_web/components/assistant-ui/connector-popup/views/connector-accounts-list-view.tsx
+++ b/surfsense_web/components/assistant-ui/connector-popup/views/connector-accounts-list-view.tsx
@@ -132,21 +132,21 @@ export const ConnectorAccountsListView: FC = ({
onClick={onAddAccount}
disabled={isConnecting || !isEnabled}
className={cn(
- "flex items-center gap-1.5 sm:gap-2 px-2 sm:px-3 py-1.5 sm:py-2 rounded-lg border-2 border-dashed text-left transition-all duration-200 shrink-0 self-center sm:self-auto sm:w-auto",
+ "flex items-center justify-center gap-1.5 h-8 px-3 rounded-md border-2 border-dashed text-xs sm:text-sm transition-all duration-200 shrink-0 w-full sm:w-auto",
!isEnabled
? "border-border/30 opacity-50 cursor-not-allowed"
- : "border-primary/50 hover:bg-primary/5",
+ : "border-slate-400/20 dark:border-white/20 hover:bg-primary/5",
isConnecting && "opacity-50 cursor-not-allowed"
)}
>
-
+
{isConnecting ? (
-
+
) : (
-
+
)}
-
+
{isConnecting ? "Connecting" : buttonText}
From f0997b0a30a1da7e66bbf0deb83f61d809560a0a Mon Sep 17 00:00:00 2001
From: Anish Sarkar <104695310+AnishSarkar22@users.noreply.github.com>
Date: Mon, 19 Jan 2026 21:23:22 +0530
Subject: [PATCH 05/11] chore: ran frontend linting
---
.../assistant-ui/connector-popup.tsx | 6 +-
.../components/mcp-connect-form.tsx | 36 ++---
.../components/mcp-config.tsx | 34 ++---
.../views/connector-connect-view.tsx | 11 +-
.../views/connector-edit-view.tsx | 3 +-
.../hooks/use-connector-dialog.ts | 130 +++++++++---------
.../tabs/active-connectors-tab.tsx | 7 +-
.../tabs/all-connectors-tab.tsx | 11 +-
.../utils/mcp-config-validator.ts | 48 +++----
.../views/connector-accounts-list-view.tsx | 96 ++++++-------
.../lib/apis/connectors-api.service.ts | 10 +-
11 files changed, 199 insertions(+), 193 deletions(-)
diff --git a/surfsense_web/components/assistant-ui/connector-popup.tsx b/surfsense_web/components/assistant-ui/connector-popup.tsx
index a366bd37f..5ad520b05 100644
--- a/surfsense_web/components/assistant-ui/connector-popup.tsx
+++ b/surfsense_web/components/assistant-ui/connector-popup.tsx
@@ -101,7 +101,8 @@ export const ConnectorIndicator: FC = () => {
// Fallback to API if Electric is not available or fails
// Use Electric data if: 1) we have data, or 2) still loading without error
// Use API data if: Electric failed (has error) or finished loading with no data
- const useElectricData = connectorsFromElectric.length > 0 || (connectorsLoading && !connectorsError);
+ const useElectricData =
+ connectorsFromElectric.length > 0 || (connectorsLoading && !connectorsError);
const connectors = useElectricData ? connectorsFromElectric : allConnectors || [];
// Manual refresh function that works with both Electric and API
@@ -129,7 +130,7 @@ export const ConnectorIndicator: FC = () => {
const hasConnectors = connectors.length > 0;
const hasSources = hasConnectors || activeDocumentTypes.length > 0;
const totalSourceCount = connectors.length + activeDocumentTypes.length;
-
+
const activeConnectorsCount = connectors.length;
// Check which connectors are already connected
@@ -226,7 +227,6 @@ export const ConnectorIndicator: FC = () => {
isDisconnecting={isDisconnecting}
isIndexing={indexingConnectorIds.has(editingConnector.id)}
searchSpaceId={searchSpaceId?.toString()}
-
onStartDateChange={setStartDate}
onEndDateChange={setEndDate}
onPeriodicEnabledChange={setPeriodicEnabled}
diff --git a/surfsense_web/components/assistant-ui/connector-popup/connect-forms/components/mcp-connect-form.tsx b/surfsense_web/components/assistant-ui/connector-popup/connect-forms/components/mcp-connect-form.tsx
index d67b9b49c..92b87f124 100644
--- a/surfsense_web/components/assistant-ui/connector-popup/connect-forms/components/mcp-connect-form.tsx
+++ b/surfsense_web/components/assistant-ui/connector-popup/connect-forms/components/mcp-connect-form.tsx
@@ -49,12 +49,12 @@ export const MCPConnectForm: FC = ({ onSubmit, isSubmitting })
const handleConfigChange = (value: string) => {
setConfigJson(value);
-
+
// Clear previous error
if (jsonError) {
setJsonError(null);
}
-
+
// Validate immediately to show errors as user types (with debouncing via parseMCPConfig cache)
if (value.trim()) {
const result = parseMCPConfig(value);
@@ -120,13 +120,14 @@ export const MCPConnectForm: FC = ({ onSubmit, isSubmitting })
return (
-
-
-
- Connect to an MCP (Model Context Protocol) server. Each MCP server is added as a separate connector.
-
-
-
+
+
+
+ Connect to an MCP (Model Context Protocol) server. Each MCP server is added as a
+ separate connector.
+
+
+