Skip to content
Open
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ cython_debug/

**/samples/**/.agent/
**/samples/**/.claude/
.claude/
**/samples/**/AGENTS.md
**/samples/**/CLAUDE.md
**/samples/**/entry-points.json
Expand Down
13 changes: 8 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
[project]
name = "uipath-mcp"
version = "0.1.4"
version = "0.1.5"
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.8.23, <2.9.0",
"uipath==2.10.12.dev1014315285",
"uipath-runtime>=0.9.1, <0.10.0",
]
classifiers = [
"Development Status :: 3 - Alpha",
Expand Down Expand Up @@ -42,14 +43,13 @@ dev = [
"mypy>=1.14.1",
"ruff>=0.9.4",
"pytest>=7.4.0",
"pytest-asyncio>=0.23.0",
"pytest-asyncio>=1.3.0",
"pytest-cov>=4.1.0",
"pytest-mock>=3.11.1",
"pre-commit>=4.5.1",
"filelock>=3.20.3",
"virtualenv>=20.36.1",
"numpy>=1.24.0",
"pytest-asyncio>=1.3.0",
]

[tool.ruff]
Expand Down Expand Up @@ -93,3 +93,6 @@ name = "testpypi"
url = "https://test.pypi.org/simple/"
publish-url = "https://test.pypi.org/legacy/"
explicit = true

[tool.uv.sources]
uipath = { index = "testpypi" }
7 changes: 0 additions & 7 deletions src/uipath_mcp/_cli/_utils/_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,7 @@ def get_servers(self) -> list[McpServer]:
def get_server(self, name: str) -> McpServer | None:
"""
Get a server model by name.
If there's only one server available, return that one regardless of name.
Otherwise, look up the server by the provided name.
"""
# If there's only one server, return it
if len(self._servers) == 1:
return next(iter(self._servers.values()))

# Otherwise, fall back to looking up by name
return self._servers.get(name)

def get_server_names(self) -> list[str]:
Expand Down
62 changes: 62 additions & 0 deletions tests/cli/test_factory.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import json
from unittest.mock import MagicMock, patch

import pytest

from uipath_mcp._cli._runtime._exception import UiPathMcpRuntimeError
from uipath_mcp._cli._runtime._factory import UiPathMcpRuntimeFactory

# Patch UiPath() constructor which requires auth env vars
_UIPATH_PATCH = patch("uipath_mcp._cli._runtime._runtime.UiPath")


@pytest.fixture
def mcp_json_single(tmp_path):
"""Create a temporary mcp.json with a single server."""
config = {
"servers": {
"math-server": {
"transport": "stdio",
"command": "python",
"args": ["server.py"],
}
}
}
config_path = tmp_path / "mcp.json"
config_path.write_text(json.dumps(config))
return str(config_path)


@pytest.fixture
def factory(tmp_path):
context = MagicMock()
context.config_path = str(tmp_path / "uipath.json")
context.folder_key = "test-folder-key"
context.mcp_server_id = "test-server-id"
return UiPathMcpRuntimeFactory(context=context)


@pytest.mark.asyncio
async def test_exact_match_works(factory, mcp_json_single):
"""Server found by exact name match."""
factory._mcp_config = None
with _UIPATH_PATCH, patch.object(factory, "_load_mcp_config") as mock_load:
from uipath_mcp._cli._utils._config import McpConfig

mock_load.return_value = McpConfig(mcp_json_single)
runtime = await factory.new_runtime(
"math-server", "00000000-0000-0000-0000-000000000001"
)
assert runtime._entrypoint == "math-server"


@pytest.mark.asyncio
async def test_wrong_name_raises(factory, mcp_json_single):
"""Wrong entrypoint raises SERVER_NOT_FOUND."""
with patch.object(factory, "_load_mcp_config") as mock_load:
from uipath_mcp._cli._utils._config import McpConfig

mock_load.return_value = McpConfig(mcp_json_single)
with pytest.raises(UiPathMcpRuntimeError) as exc_info:
await factory.new_runtime("my-mcp2", "00000000-0000-0000-0000-000000000001")
assert "not found" in str(exc_info.value).lower()
50 changes: 33 additions & 17 deletions uv.lock

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

Loading