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]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix(mcp_server_manager.py): ensure only allowed params sent to MCP server
Krrish Dholakiaecb6c0e8147e
diff --git a/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py b/litellm/proxy/_experimental/mcp_server/mcp_server_manager.pyindex 129a756e4f5..8070bedbc79 100644--- a/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py+++ b/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py@@ -603,9 +603,9 @@ class MCPServerManager:return tool_name not in server.disallowed_toolsreturn True- def filter_allowed_params(+ def validate_allowed_params(self, tool_name: str, arguments: Dict[str, Any], server: MCPServer- ) -> Dict[str, Any]:+ ) -> None:"""Filter arguments to only include allowed parameters for the given tool.@@ -626,7 +626,7 @@ class MCPServerManager:# If no allowed_params configured, return all argumentsif not server.allowed_params:- return arguments+ return# Get the unprefixed tool name to match against configunprefixed_tool_name, _ = get_server_name_prefix_tool_mcp(tool_name)@@ -638,7 +638,7 @@ class MCPServerManager:# If this tool doesn't have allowed_params specified, allow all paramsif allowed_params_list is None:- return arguments+ return None# Filter arguments to only include allowed parametersdisallowed_params = [@@ -655,8 +655,6 @@ class MCPServerManager:},)- return {k: v for k, v in arguments.items() if k in allowed_params_list}-async def check_tool_permission_for_key_team(self,tool_name: str,@@ -725,14 +723,11 @@ class MCPServerManager:)## filter parameters based on allowed_params configuration- filtered_arguments = self.filter_allowed_params(+ self.validate_allowed_params(tool_name=name,arguments=arguments,server=server,)- # Update arguments with filtered version- arguments.clear()- arguments.update(filtered_arguments)pre_hook_kwargs = {"name": name,