refactor: consolidate MCP connector handling in UI components

- Replaced MCPConnectorListView with ConnectorAccountsListView for better integration and UI consistency.
- Updated ConnectorCard to display connector counts for MCP connectors.
- Enhanced MCPConnectForm to improve connection testing feedback and error handling.
- Streamlined MCPConfig validation logic and improved user feedback for configuration errors.
- Adjusted AllConnectorsTab to count and display MCP connectors accurately.
- Removed redundant MCP-specific components to simplify the codebase.
This commit is contained in:
Anish Sarkar 2026-01-19 19:50:07 +05:30
parent 48603b993d
commit 72ad558240
10 changed files with 148 additions and 290 deletions

View file

@ -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,
};
}