Skip to content

🔑 refactor: MCP Settings Rendering Logic for OAuth Servers #8718

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jul 29, 2025

Conversation

dustinhealy
Copy link
Collaborator

@dustinhealy dustinhealy commented Jul 28, 2025

Summary

This pull request enhances the MCP Settings panel rendering logic to show when servers need user interaction for configuration, authentication, or initialization. The panel will now render if a server is detected that:

  • has CustomUserVars
  • was detected as an OAuth server during startup
  • has startup: false configured in librechat.yaml

This replaces the previous filtering logic which only checked for customUserVars.

Server-side changes:

  • api/server/routes/config.js: Added dependency on getMCPManager and updated the route handler to include three new properties in the payload:
    • isOAuth: Determines if server requires OAuth by checking getMCPManager().getOAuthServers()
    • startup: Includes the startup configuration flag from server config

Client-side changes:

Configuration updates:

  • packages/data-provider/src/config.ts: Added new optional properties to TStartupConfig type:
    • isOAuth: Boolean indicating OAuth requirement detection
    • startup: Boolean reflecting server startup configuration

UX/UI Improvements:

  • Enhanced empty state handling: CustomUserVarsSection now displays "No custom user variables set for {serverName}" instead of rendering nothing when no variables are configured.

  • Improved section organization: Reordered MCP panel sections to show Custom User Variables first, followed by Server Initialization, creating a more logical user flow.

  • Better visual design: Updated ServerInitializationSection styling:

    • Changed from red-themed alert styling to amber background (better semantic meaning)
    • Updated action buttons from blue to green (follows app design patterns)
    • Improved contrast and accessibility in light / dark modes
  • Smarter initialization controls: The subtle reinitialize button now only appears for connected servers that actually need it (servers with OAuth requirements or custom user variables), preventing unnecessary UI clutter.

Bug Fixes:

  • Fixed reinitialize endpoint: Corrected improper handling of failure states in the MCP server reinitialize endpoint to prevent misleading success toasts.

  • Enhanced component props: Added hasCustomUserVars prop to ServerInitializationSection to enable conditional rendering of initialization controls.

Change Type

  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • This change requires a documentation update

Testing

Manual verification of MCP Settings Panel presence/absence in SideNav with various MCP server configurations:

  • Servers with customUserVars
  • OAuth-required servers
  • Servers with startup: false
  • Servers without any configuration needs
  • Mixed combinations of the above
  • Empty state handling for servers without custom variables
  • Visual styling across light and dark modes

Checklist

  • My code adheres to this project's style guidelines
  • I have performed a self-review of my own code
  • I have commented in any complex areas of my code
  • I have made pertinent documentation changes
  • My changes do not introduce new warnings
  • A pull request for updating the documentation has been submitted.

@danny-avila danny-avila changed the title 🔑 feat: Enhance MCP Settings Rendering Logic for OAuth Servers 🔑 refactor: MCP Settings Rendering Logic for OAuth Servers Jul 29, 2025
@danny-avila danny-avila merged commit c4677ab into dev Jul 29, 2025
7 checks passed
@danny-avila danny-avila deleted the feat/mcp-vars-filter branch July 29, 2025 13:08
jhrozek pushed a commit to StacklokLabs/LibreChat that referenced this pull request Jul 31, 2025
…la#8718)

* feat: add OAuth servers to conditional rendering logic for MCPPanel in SideNav

* feat: add startup flag check to conditional rendering logic

* fix: correct improper handling of failure state in reinitialize endpoint

* fix: change MCP config components to better handle servers without customUserVars

- removes the subtle reinitialize button from config components of servers without customUserVars or OAuth
- adds a placeholder message for components where servers have no customUserVars configured

* style: swap CustomUserVarsSection and ServerInitializationSection positions

* style: fix coloring for light mode and align more with existing design patterns

* chore: remove extraneous comments

* chore: reorder imports and `isEnabled` from api package

---------

Co-authored-by: Danny Avila <[email protected]>
xycjscs pushed a commit to xycjscs/LibreChat that referenced this pull request Aug 9, 2025
…la#8718)

* feat: add OAuth servers to conditional rendering logic for MCPPanel in SideNav

* feat: add startup flag check to conditional rendering logic

* fix: correct improper handling of failure state in reinitialize endpoint

* fix: change MCP config components to better handle servers without customUserVars

- removes the subtle reinitialize button from config components of servers without customUserVars or OAuth
- adds a placeholder message for components where servers have no customUserVars configured

* style: swap CustomUserVarsSection and ServerInitializationSection positions

* style: fix coloring for light mode and align more with existing design patterns

* chore: remove extraneous comments

* chore: reorder imports and `isEnabled` from api package

---------

Co-authored-by: Danny Avila <[email protected]>
miguelwon pushed a commit to miguelwon/LibreChat that referenced this pull request Aug 10, 2025
…la#8718)

* feat: add OAuth servers to conditional rendering logic for MCPPanel in SideNav

* feat: add startup flag check to conditional rendering logic

* fix: correct improper handling of failure state in reinitialize endpoint

* fix: change MCP config components to better handle servers without customUserVars

- removes the subtle reinitialize button from config components of servers without customUserVars or OAuth
- adds a placeholder message for components where servers have no customUserVars configured

* style: swap CustomUserVarsSection and ServerInitializationSection positions

* style: fix coloring for light mode and align more with existing design patterns

* chore: remove extraneous comments

* chore: reorder imports and `isEnabled` from api package

---------

Co-authored-by: Danny Avila <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants