mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-10 22:41:41 +00:00
fix: dont require mcp pip for proxy (#11282)
This commit is contained in:
parent
c698cc24aa
commit
2f8eb1dcc3
2 changed files with 20 additions and 0 deletions
12
litellm/proxy/_experimental/mcp_server/utils.py
Normal file
12
litellm/proxy/_experimental/mcp_server/utils.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import importlib
|
||||
|
||||
|
||||
def is_mcp_available() -> bool:
|
||||
"""
|
||||
Returns True if the MCP module is available, False otherwise
|
||||
"""
|
||||
try:
|
||||
importlib.import_module("mcp")
|
||||
return True
|
||||
except ImportError:
|
||||
return False
|
||||
|
|
@ -2786,6 +2786,14 @@ class ProxyConfig:
|
|||
)
|
||||
|
||||
async def _init_mcp_servers_in_db(self):
|
||||
from litellm.proxy._experimental.mcp_server.utils import is_mcp_available
|
||||
|
||||
if not is_mcp_available():
|
||||
verbose_proxy_logger.debug(
|
||||
"MCP module not available, skipping MCP server initialization"
|
||||
)
|
||||
return
|
||||
|
||||
from litellm.proxy._experimental.mcp_server.mcp_server_manager import (
|
||||
global_mcp_server_manager,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue