From 920966f895428a0f53c94178190cc833fe261921 Mon Sep 17 00:00:00 2001 From: Dev Date: Tue, 9 Sep 2025 00:59:10 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=90=20fix:=20Resolve=20Env.=20Variable?= =?UTF-8?q?s=20for=20MCP=20OAuth=20Manual=20Config=20(#9501)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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. --- packages/api/src/utils/env.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/api/src/utils/env.ts b/packages/api/src/utils/env.ts index d9f29fddc..767d95101 100644 --- a/packages/api/src/utils/env.ts +++ b/packages/api/src/utils/env.ts @@ -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 = {}; + 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; }