From 9d875276710cf06506b4bc9c03d2548eb42348e5 Mon Sep 17 00:00:00 2001 From: Tin Chi Lo Date: Fri, 10 Jul 2026 15:21:17 -0700 Subject: [PATCH] fix(mcp): include scrypt p factor in the maxmem ceiling so it scales with every work factor --- .../mcp_server/outbound_credentials/bridge_credentials.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/litellm/proxy/_experimental/mcp_server/outbound_credentials/bridge_credentials.py b/litellm/proxy/_experimental/mcp_server/outbound_credentials/bridge_credentials.py index 46038d1d531..2fc1bc99939 100644 --- a/litellm/proxy/_experimental/mcp_server/outbound_credentials/bridge_credentials.py +++ b/litellm/proxy/_experimental/mcp_server/outbound_credentials/bridge_credentials.py @@ -38,7 +38,9 @@ _BEARER_PREFIX = "bearer " _SCRYPT_N = 2**15 _SCRYPT_R = 8 _SCRYPT_P = 1 -_SCRYPT_MAXMEM = 128 * _SCRYPT_N * _SCRYPT_R * 2 +# scrypt's working-set is ~128 * N * r * p bytes; cap at twice that so the maxmem ceiling scales +# with every work factor and a future p or r bump does not trip "memory limit exceeded". +_SCRYPT_MAXMEM = 128 * _SCRYPT_N * _SCRYPT_R * _SCRYPT_P * 2 _DERIVED_KEY_BYTES = 32