Skip to content

Commit 8cb3415

Browse files
authored
Merge pull request #122 from UiPath/feat/cli-new
Feat/cli new
2 parents b02fbea + fb01de6 commit 8cb3415

File tree

7 files changed

+621
-10
lines changed

7 files changed

+621
-10
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
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"servers": {
3+
"$server_name": {
4+
"transport": "stdio",
5+
"command": "python",
6+
"args": ["server.py"]
7+
}
8+
}
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[project]
2+
name = "$project_name"
3+
version = "0.0.1"
4+
description = "Description for '$project_name' project"
5+
authors = [{ name = "John Doe", email = "[email protected]" }]
6+
dependencies = [
7+
"uipath-mcp>=0.0.96",
8+
]
9+
requires-python = ">=3.11"

0 commit comments

Comments
 (0)