🔌 refactor: MCP UI with Improved Accessibility and Reusable Components (#11118)

* feat: enhance MCP server selection UI with new components and improved accessibility

* fix(i18n): add missing com_ui_mcp_servers translation key

The MCP server menu aria-label was referencing a non-existent translation
key. Added the missing key for accessibility.

* feat(MCP): enhance MCP components with improved accessibility and focus management

* fix(i18n): remove outdated MCP server translation keys

* fix(MCPServerList): improve color contrast by updating text color for no MCP servers message

* refactor(MCP): Server status components and improve user action handling
Updated MCPServerStatusIcon to use a unified icon system for better clarity
Introduced new MCPCardActions component for standardized action buttons on server cards
Created MCPServerCard component to encapsulate server display logic and actions
Enhanced MCPServerList to render MCPServerCard components, improving code organization
Added MCPStatusBadge for consistent status representation in dialogs
Updated utility functions for status color and text retrieval to align with new design
Improved localization keys for better clarity and consistency in user messages

* style(MCP): update button and card background styles for improved UI consistency

* feat(MCP): implement global server initialization state management using Jotai

* refactor(MCP): modularize MCPServerDialog into structured component architecture

- Split monolithic dialog into dedicated section components (Auth, BasicInfo, Connection, Transport, Trust)
- Extract form logic into useMCPServerForm custom hook
- Add utility modules for JSON import and URL handling
- Introduce reusable SecretInput component in @librechat/client
- Remove deprecated MCPAuth component

* style(MCP): update button styles for improved layout and adjust empty state background color

* refactor(Radio): enhance component mounting logic and background style updates

* refactor(translation): remove unused keys and streamline localization strings
This commit is contained in:
Marco Beretta 2025-12-28 18:20:15 +01:00 committed by GitHub
parent 0b8e0fcede
commit e4870ed0b0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
32 changed files with 2594 additions and 1646 deletions

View file

@ -1,3 +1,4 @@
import { atom } from 'jotai';
import { atomFamily, atomWithStorage } from 'jotai/utils';
import { Constants, LocalStorageKeys } from 'librechat-data-provider';
@ -18,3 +19,39 @@ export const mcpValuesAtomFamily = atomFamily((conversationId: string | null) =>
export const mcpPinnedAtom = atomWithStorage<boolean>(LocalStorageKeys.PIN_MCP_, true, undefined, {
getOnInit: true,
});
/**
* Server initialization state - shared globally so chat dropdown and settings panel
* both see the same OAuth/initialization state.
*
* This enables canceling OAuth from either location.
*/
export interface MCPServerInitState {
isInitializing: boolean;
isCancellable: boolean;
oauthUrl: string | null;
oauthStartTime: number | null;
}
const defaultServerInitState: MCPServerInitState = {
isInitializing: false,
isCancellable: false,
oauthUrl: null,
oauthStartTime: null,
};
/**
* Global atom for MCP server initialization states.
* Keyed by server name.
*/
export const mcpServerInitStatesAtom = atom<Record<string, MCPServerInitState>>({});
/**
* Helper to get or create a server's init state
*/
export const getServerInitState = (
states: Record<string, MCPServerInitState>,
serverName: string,
): MCPServerInitState => {
return states[serverName] || defaultServerInitState;
};