mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-19 08:46:11 +01:00
🧹 fix: MCP Panel Regressions after UI refactor (#11312)
* fix: Revoke OAuth and Vars. Config Regressions in MCP Panel - Introduced a new Trash2 icon button in MCPCardActions for revoking OAuth access on connected OAuth servers. - Updated MCPServerCard to handle the revoke action, allowing users to revoke OAuth for specific servers. - Enhanced user experience by ensuring the revoke option is available regardless of the server's connection state. * refactor: Reorganize Revoke Button Logic in MCPCardActions and Update Toast Messages - Moved the Revoke button for OAuth servers to a new position in MCPCardActions for improved visibility. - Updated the success message logic in useMCPServerManager to differentiate between uninstall and variable update actions, enhancing user feedback. * i18n: Add new translation for MCP server access revocation message * refactor: Centralize Deselection Logic in updateUserPluginsMutation - Updated the success handler in useUpdateUserPluginsMutation to manage deselection of MCP server values when revoking access, improving code clarity and reducing redundancy. - Simplified message assignment logic for user feedback during plugin updates.
This commit is contained in:
parent
fc6f127b21
commit
90521bfb4e
4 changed files with 48 additions and 9 deletions
|
|
@ -30,7 +30,7 @@ export default function MCPServerCard({
|
|||
}: MCPServerCardProps) {
|
||||
const localize = useLocalize();
|
||||
const triggerRef = useRef<HTMLDivElement>(null);
|
||||
const { initializeServer } = useMCPServerManager();
|
||||
const { initializeServer, revokeOAuthForServer } = useMCPServerManager();
|
||||
const [dialogOpen, setDialogOpen] = useState(false);
|
||||
|
||||
const statusIconProps = getServerStatusIconProps(server.serverName);
|
||||
|
|
@ -50,9 +50,20 @@ export default function MCPServerCard({
|
|||
const canEdit = canCreateEditMCPs && canEditThisServer;
|
||||
|
||||
const handleInitialize = () => {
|
||||
/** If server has custom user vars and is not already connected, show config dialog first
|
||||
* This ensures users can enter credentials before initialization attempts
|
||||
*/
|
||||
if (hasCustomUserVars && serverStatus?.connectionState !== 'connected') {
|
||||
onConfigClick({ stopPropagation: () => {}, preventDefault: () => {} } as React.MouseEvent);
|
||||
return;
|
||||
}
|
||||
initializeServer(server.serverName);
|
||||
};
|
||||
|
||||
const handleRevoke = () => {
|
||||
revokeOAuthForServer(server.serverName);
|
||||
};
|
||||
|
||||
const handleEditClick = (e: React.MouseEvent) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
|
|
@ -130,6 +141,7 @@ export default function MCPServerCard({
|
|||
onConfigClick={onConfigClick}
|
||||
onInitialize={handleInitialize}
|
||||
onCancel={onCancel}
|
||||
onRevoke={handleRevoke}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue