mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-09-21 21:50:49 +02:00
🔐 fix: Resolve Env. Variables for MCP OAuth Manual Config (#9501)
* Added functionality to process OAuth configuration within the MCP environment. * Implemented handling for string values in OAuth settings, ensuring proper processing of environment variables. * Maintained original structure for non-string values to preserve existing configurations.
This commit is contained in:
parent
c46e0d3ecc
commit
920966f895
1 changed files with 15 additions and 0 deletions
|
@ -191,6 +191,21 @@ export function processMCPEnv(params: {
|
|||
newObj.url = processSingleValue({ originalValue: newObj.url, customUserVars, user, body });
|
||||
}
|
||||
|
||||
// Process OAuth configuration if it exists (for all transport types)
|
||||
if ('oauth' in newObj && newObj.oauth) {
|
||||
const processedOAuth: Record<string, string | string[] | undefined> = {};
|
||||
for (const [key, originalValue] of Object.entries(newObj.oauth)) {
|
||||
// Only process string values for environment variables
|
||||
// token_exchange_method is an enum and shouldn't be processed
|
||||
if (typeof originalValue === 'string') {
|
||||
processedOAuth[key] = processSingleValue({ originalValue, customUserVars, user, body });
|
||||
} else {
|
||||
processedOAuth[key] = originalValue;
|
||||
}
|
||||
}
|
||||
newObj.oauth = processedOAuth;
|
||||
}
|
||||
|
||||
return newObj;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue