Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[project]
name = "uipath-mcp"
version = "0.1.4"
version = "0.2.0"
description = "UiPath MCP SDK"
readme = { file = "README.md", content-type = "text/markdown" }
requires-python = ">=3.11"
dependencies = [
"mcp==1.26.0",
"pysignalr==1.3.0",
"uipath>=2.8.23, <2.9.0",
"uipath-runtime>=0.8.0, <0.9.0",
"uipath>=2.10.40, <2.11.0",
"uipath-runtime>=0.10.0, <0.11.0",
]
classifiers = [
"Development Status :: 3 - Alpha",
Expand Down
15 changes: 9 additions & 6 deletions src/uipath_mcp/_cli/_runtime/_token_refresh.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from enum import Enum

import httpx
from uipath._cli._auth._portal_service import PortalService
from uipath._cli._auth._oidc_utils import OidcUtils
from uipath._cli._auth._url_utils import build_service_url, resolve_domain
from uipath._cli._auth._utils import get_auth_data, update_auth_file
from uipath._utils._auth import parse_access_token
Expand All @@ -14,6 +14,7 @@
from uipath.platform import UiPath
from uipath.platform.common import TokenData
from uipath.platform.common._config import UiPathApiConfig
from uipath.platform.identity import IdentityService

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -172,12 +173,14 @@ async def _refresh_oauth(self) -> TokenData:
if not refresh_token:
raise ValueError("No refresh_token found in .uipath/.auth.json")

def _do_refresh() -> TokenData:
with PortalService(domain=self._domain) as portal:
return portal.refresh_access_token(refresh_token)
auth_config = await OidcUtils.get_auth_config(self._domain)
client_id = auth_config["client_id"]

# run in a thread to avoid blocking
token_data = await asyncio.to_thread(_do_refresh)
identity_service = IdentityService(self._domain)
token_data = await identity_service.refresh_access_token_async(
refresh_token=refresh_token,
client_id=client_id,
)

try:
update_auth_file(token_data)
Expand Down
57 changes: 42 additions & 15 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading