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
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[project]
name = "uipath-mcp"
version = "0.0.91"
version = "0.0.92"
description = "UiPath MCP SDK"
readme = { file = "README.md", content-type = "text/markdown" }
requires-python = ">=3.10"
dependencies = [
"mcp==1.9.0",
"pysignalr==1.3.0",
"uipath>=2.0.59",
"uipath>=2.0.71",
]
classifiers = [
"Development Status :: 3 - Alpha",
Expand Down
40 changes: 33 additions & 7 deletions src/uipath_mcp/_cli/cli_init.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
import asyncio
import json
from typing import Any, Callable, overload
import uuid

from uipath._cli.middlewares import MiddlewareResult

from ._utils._config import McpConfig


async def mcp_init_middleware_async(entrypoint: str) -> MiddlewareResult:
async def mcp_init_middleware_async(
entrypoint: str,
options: dict[str, Any] | None = None,
write_config: Callable[[Any], str] | None = None,
) -> MiddlewareResult:
"""Middleware to check for mcp.json and create uipath.json with schemas"""
options = options or {}

config = McpConfig()
if not config.exists:
return MiddlewareResult(
Expand Down Expand Up @@ -39,10 +46,13 @@ async def mcp_init_middleware_async(entrypoint: str) -> MiddlewareResult:
"entryPoints": entrypoints
}

config_path = "uipath.json"

with open(config_path, "w") as f:
json.dump(uipath_data, f, indent=4)
if write_config:
config_path = write_config(uipath_data)
else:
# Save the uipath.json file
config_path = "uipath.json"
with open(config_path, "w") as f:
json.dump(uipath_data, f, indent=2)

return MiddlewareResult(
should_continue=False,
Expand All @@ -56,7 +66,23 @@ async def mcp_init_middleware_async(entrypoint: str) -> MiddlewareResult:
should_include_stacktrace=True,
)

@overload
def mcp_init_middleware(entrypoint: str) -> MiddlewareResult: ...


@overload
def mcp_init_middleware(
entrypoint: str,
options: dict[str, Any],
write_config: Callable[[Any], str],
) -> MiddlewareResult: ...



def mcp_init_middleware(entrypoint: str) -> MiddlewareResult:
def mcp_init_middleware(
entrypoint: str,
options: dict[str, Any] | None = None,
write_config: Callable[[Any], str] | None = None,
) -> MiddlewareResult:
"""Middleware to check for mcp.json and create uipath.json with schemas"""
return asyncio.run(mcp_init_middleware_async(entrypoint))
return asyncio.run(mcp_init_middleware_async(entrypoint, options, write_config))
Loading