Load MCP server config from environment variables

This commit is contained in:
2026-04-05 10:47:56 -05:00
parent e10b7f1dec
commit 2bae089e80

View File

@@ -1,4 +1,5 @@
import asyncio
import os
from datetime import datetime, timedelta, timezone
from zoneinfo import ZoneInfo
@@ -11,7 +12,9 @@ from .schemes import ScheduleSchema
TIMEZONE = "America/Bogota"
MCP_SERVER_URL = "http://192.168.58.109:3001/mcp"
MCP_SERVER_HOST = os.getenv("MCP_SERVER_HOST", "localhost")
MCP_SERVER_PORT = os.getenv("MCP_SERVER_PORT", "3001")
MCP_SERVER_URL = f"http://{MCP_SERVER_HOST}:{MCP_SERVER_PORT}/mcp"
_MCP_CLIENT = Client(MCP_SERVER_URL)
@@ -37,7 +40,7 @@ def check_mcp_connection(self) -> str:
async with _MCP_CLIENT:
result = await _MCP_CLIENT.ping()
logger.info(f"MCP connection status: {result}")
return True
is_connected = asyncio.run(call_tool())