🔐 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:
Dev 2025-09-09 00:59:10 +05:30 committed by GitHub
parent c46e0d3ecc
commit 920966f895
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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;
}