Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix(mcp): include scrypt p factor in the maxmem ceiling so it scales with every work factor

Tin Chi Lo9d875276710c
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