From 1d5ac4293d3866dc4bcceb35e5e59275495b9b75 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Tue, 5 May 2026 10:21:35 -0700 Subject: [PATCH] fix(mcp): inherit stored credentials in test/tools/list for edit flow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When editing an existing MCP server, the Tool Configuration preview calls POST /mcp-rest/test/tools/list with server_id but no credentials (management API redacts them). The endpoint now calls _inherit_credentials_from_existing_server() so stored bearer tokens and OAuth2 M2M credentials are loaded from global_mcp_server_manager automatically — tools load without re-entering credentials. New servers (no server_id) and requests with explicit credentials are unaffected (function is a no-op in both cases). Co-Authored-By: Claude Sonnet 4.6 --- litellm/proxy/_experimental/mcp_server/rest_endpoints.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/litellm/proxy/_experimental/mcp_server/rest_endpoints.py b/litellm/proxy/_experimental/mcp_server/rest_endpoints.py index 5395142eb9a..56aeb31984a 100644 --- a/litellm/proxy/_experimental/mcp_server/rest_endpoints.py +++ b/litellm/proxy/_experimental/mcp_server/rest_endpoints.py @@ -857,6 +857,7 @@ if MCP_AVAILABLE: ######################################################## from litellm.proxy.management_endpoints.mcp_management_endpoints import ( NewMCPServerRequest, + _inherit_credentials_from_existing_server, ) def _extract_credentials( @@ -1074,6 +1075,10 @@ if MCP_AVAILABLE: }, ) + new_mcp_server_request = _inherit_credentials_from_existing_server( + new_mcp_server_request + ) + # For OpenAPI spec servers, generate tools from the spec directly if new_mcp_server_request.spec_path: return await _preview_openapi_tools(new_mcp_server_request.spec_path)