mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-20 02:10:15 +01:00
feat: add OAuth servers to conditional rendering logic for MCPPanel in SideNav
This commit is contained in:
parent
ef9d9b1276
commit
49f87016a8
4 changed files with 8 additions and 2 deletions
|
|
@ -5,6 +5,7 @@ const { getCustomConfig } = require('~/server/services/Config/getCustomConfig');
|
||||||
const { getLdapConfig } = require('~/server/services/Config/ldap');
|
const { getLdapConfig } = require('~/server/services/Config/ldap');
|
||||||
const { getProjectByName } = require('~/models/Project');
|
const { getProjectByName } = require('~/models/Project');
|
||||||
const { isEnabled } = require('~/server/utils');
|
const { isEnabled } = require('~/server/utils');
|
||||||
|
const { getMCPManager } = require('~/config');
|
||||||
const { getLogStores } = require('~/cache');
|
const { getLogStores } = require('~/cache');
|
||||||
|
|
||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
|
|
@ -102,11 +103,14 @@ router.get('/', async function (req, res) {
|
||||||
payload.mcpServers = {};
|
payload.mcpServers = {};
|
||||||
const config = await getCustomConfig();
|
const config = await getCustomConfig();
|
||||||
if (config?.mcpServers != null) {
|
if (config?.mcpServers != null) {
|
||||||
|
const mcpManager = getMCPManager();
|
||||||
|
const oauthServers = mcpManager.getOAuthServers();
|
||||||
for (const serverName in config.mcpServers) {
|
for (const serverName in config.mcpServers) {
|
||||||
const serverConfig = config.mcpServers[serverName];
|
const serverConfig = config.mcpServers[serverName];
|
||||||
payload.mcpServers[serverName] = {
|
payload.mcpServers[serverName] = {
|
||||||
customUserVars: serverConfig?.customUserVars || {},
|
customUserVars: serverConfig?.customUserVars || {},
|
||||||
chatMenu: serverConfig?.chatMenu,
|
chatMenu: serverConfig?.chatMenu,
|
||||||
|
isOAuth: oauthServers.has(serverName),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -155,7 +155,9 @@ export default function useSideNavLinks({
|
||||||
if (
|
if (
|
||||||
startupConfig?.mcpServers &&
|
startupConfig?.mcpServers &&
|
||||||
Object.values(startupConfig.mcpServers).some(
|
Object.values(startupConfig.mcpServers).some(
|
||||||
(server) => server.customUserVars && Object.keys(server.customUserVars).length > 0,
|
(server: any) =>
|
||||||
|
(server.customUserVars && Object.keys(server.customUserVars).length > 0) ||
|
||||||
|
server.isOAuth,
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
links.push({
|
links.push({
|
||||||
|
|
|
||||||
|
|
@ -851,7 +851,6 @@
|
||||||
"com_ui_mcp_authenticated_success": "MCP server '{{0}}' authenticated successfully",
|
"com_ui_mcp_authenticated_success": "MCP server '{{0}}' authenticated successfully",
|
||||||
"com_ui_mcp_dialog_desc": "Please enter the necessary information below.",
|
"com_ui_mcp_dialog_desc": "Please enter the necessary information below.",
|
||||||
"com_ui_mcp_enter_var": "Enter value for {{0}}",
|
"com_ui_mcp_enter_var": "Enter value for {{0}}",
|
||||||
"com_ui_mcp_init_cancelled": "MCP server '{{0}}' initialization was cancelled due to simultaneous request",
|
|
||||||
"com_ui_mcp_init_failed": "Failed to initialize MCP server",
|
"com_ui_mcp_init_failed": "Failed to initialize MCP server",
|
||||||
"com_ui_mcp_initialize": "Initialize",
|
"com_ui_mcp_initialize": "Initialize",
|
||||||
"com_ui_mcp_initialized_success": "MCP server '{{0}}' initialized successfully",
|
"com_ui_mcp_initialized_success": "MCP server '{{0}}' initialized successfully",
|
||||||
|
|
|
||||||
|
|
@ -613,6 +613,7 @@ export type TStartupConfig = {
|
||||||
}
|
}
|
||||||
>;
|
>;
|
||||||
chatMenu?: boolean;
|
chatMenu?: boolean;
|
||||||
|
isOAuth?: boolean;
|
||||||
}
|
}
|
||||||
>;
|
>;
|
||||||
mcpPlaceholder?: string;
|
mcpPlaceholder?: string;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue