Load MCP server config from environment variables
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
|
import os
|
||||||
from datetime import datetime, timedelta, timezone
|
from datetime import datetime, timedelta, timezone
|
||||||
from zoneinfo import ZoneInfo
|
from zoneinfo import ZoneInfo
|
||||||
|
|
||||||
@@ -11,7 +12,9 @@ from .schemes import ScheduleSchema
|
|||||||
|
|
||||||
|
|
||||||
TIMEZONE = "America/Bogota"
|
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)
|
_MCP_CLIENT = Client(MCP_SERVER_URL)
|
||||||
|
|
||||||
|
|
||||||
@@ -37,7 +40,7 @@ def check_mcp_connection(self) -> str:
|
|||||||
async with _MCP_CLIENT:
|
async with _MCP_CLIENT:
|
||||||
result = await _MCP_CLIENT.ping()
|
result = await _MCP_CLIENT.ping()
|
||||||
logger.info(f"MCP connection status: {result}")
|
logger.info(f"MCP connection status: {result}")
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
is_connected = asyncio.run(call_tool())
|
is_connected = asyncio.run(call_tool())
|
||||||
|
|||||||
Reference in New Issue
Block a user