Skip to content

Commit 202733b

Browse files
committed
chore: accept folder path for self-hosted servers
1 parent b02fbea commit 202733b

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/uipath_mcp/_cli/_runtime/_runtime.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
from opentelemetry.sdk.trace import TracerProvider
1515
from opentelemetry.sdk.trace.export import BatchSpanProcessor
1616
from pysignalr.client import CompletionMessage, SignalRClient
17-
from uipath import UiPath
1817
from uipath._cli._runtime._contracts import (
1918
UiPathBaseRuntime,
2019
UiPathErrorCategory,
@@ -26,6 +25,7 @@
2625
from ._context import UiPathMcpRuntimeContext, UiPathServerType
2726
from ._exception import UiPathMcpRuntimeError
2827
from ._session import SessionServer
28+
from uipath import UiPath
2929

3030
logger = logging.getLogger(__name__)
3131
tracer = trace.get_tracer(__name__)
@@ -274,13 +274,18 @@ async def _register(self) -> None:
274274
"""Register the MCP server with UiPath."""
275275

276276
folder_key = os.environ.get("UIPATH_FOLDER_KEY")
277-
if not folder_key:
277+
folder_path = os.environ.get("UIPATH_FOLDER_PATH")
278+
if not folder_key and not folder_path:
278279
raise UiPathMcpRuntimeError(
279280
"REGISTRATION_ERROR",
280-
"No UIPATH_FOLDER_KEY environment variable set.",
281-
"Please set the UIPATH_FOLDER_KEY environment variable.",
281+
"No UIPATH_FOLDER_PATH or UIPATH_FOLDER_KEY environment variable set.",
282+
"Please set the UIPATH_FOLDER_PATH or UIPATH_FOLDER_KEY environment variable.",
282283
UiPathErrorCategory.USER,
283284
)
285+
if not folder_key:
286+
uipath = UiPath()
287+
folder_key = uipath.folders.retrieve_key(folder_path=folder_path)
288+
284289
logger.info(f"Folder key: {folder_key}")
285290

286291
initialization_successful = False

0 commit comments

Comments
 (0)