Skip to content

Conversation

@edis-uipath
Copy link
Collaborator

@edis-uipath edis-uipath commented Dec 9, 2025

This PR updates the uipath-mcp package to align with the new UiPath 2.2 runtime model. The changes refactor the codebase to use the new runtime protocol-based architecture instead of the previous middleware-based approach.

Key changes:

  • Migrates from middleware-based execution to runtime factory patter
  • Refactors runtime to implement UiPathRuntimeProtocol with execute() and stream() methods
  • Updates import paths from uipath._cli to uipath.platform and uipath.runtime

Development Package

  • Add this package as a dependency in your pyproject.toml:
[project]
dependencies = [
  # Exact version:
  "uipath-mcp==0.0.107.dev1001590198",

  # Any version from PR
  "uipath-mcp>=0.0.107.dev1001590000,<0.0.107.dev1001600000"
]

[[tool.uv.index]]
name = "testpypi"
url = "https://test.pypi.org/simple/"
publish-url = "https://test.pypi.org/legacy/"
explicit = true

[tool.uv.sources]
uipath-mcp = { index = "testpypi" }

@edis-uipath edis-uipath self-assigned this Dec 9, 2025
@edis-uipath edis-uipath force-pushed the feature/update_uipath_2.2 branch 2 times, most recently from 1f6de07 to 33c8807 Compare December 11, 2025 13:15
@edis-uipath edis-uipath marked this pull request as ready for review December 11, 2025 13:16
Copilot AI review requested due to automatic review settings December 11, 2025 13:16
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the uipath-mcp package to align with the new UiPath 2.2 runtime model. The changes refactor the codebase to use the new runtime protocol-based architecture instead of the previous middleware-based approach.

Key changes:

  • Migrates from middleware-based execution to runtime factory pattern
  • Refactors runtime to implement UiPathRuntimeProtocol with execute() and stream() methods
  • Updates import paths from uipath._cli to uipath.platform and uipath.runtime

Reviewed changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/uipath_mcp/middlewares.py Removes init and run middleware registrations
src/uipath_mcp/_cli/cli_run.py Deletes entire run middleware implementation
src/uipath_mcp/_cli/cli_init.py Deletes entire init middleware implementation
src/uipath_mcp/_cli/_utils/_config.py Adds type annotation for command field
src/uipath_mcp/_cli/_templates/server.py.template Simplifies template by removing many example tool functions
src/uipath_mcp/_cli/_runtime/_session.py Updates imports and adds type cast for command parameter
src/uipath_mcp/_cli/_runtime/_runtime.py Major refactor to implement runtime protocol, adds factory pattern support, and streaming capabilities
src/uipath_mcp/_cli/_runtime/_factory.py Adds new factory class for creating MCP runtime instances
src/uipath_mcp/_cli/_runtime/_exception.py Updates import path for error classes
src/uipath_mcp/_cli/_runtime/_context.py Removes UiPathMcpRuntimeContext class, keeps only UiPathServerType enum
src/uipath_mcp/_cli/_runtime/init.py Adds factory registration and exports
pyproject.toml Updates uipath dependency version and adds local development source
.vscode/settings.json Adds new VS Code workspace configuration

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


def _validate_auth(self) -> None:
"""Validate authentication-related configuration.
TODO: do we still need this?
Copy link

Copilot AI Dec 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO comment suggests uncertainty about whether authentication validation is still needed. Either confirm it's required and remove the TODO, or refactor if it's obsolete.

Suggested change
TODO: do we still need this?

Copilot uses AI. Check for mistakes.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we do, the check is not done in any other place

@edis-uipath edis-uipath force-pushed the feature/update_uipath_2.2 branch 2 times, most recently from 90495a9 to e7df223 Compare December 11, 2025 13:32
@edis-uipath edis-uipath requested a review from Copilot December 11, 2025 13:33
@edis-uipath edis-uipath force-pushed the feature/update_uipath_2.2 branch from e7df223 to 80f2f3b Compare December 11, 2025 13:34
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@edis-uipath edis-uipath force-pushed the feature/update_uipath_2.2 branch from 80f2f3b to 6c8f026 Compare December 11, 2025 13:56
@edis-uipath edis-uipath added the build:dev Create a dev build from the pr label Dec 11, 2025
@edis-uipath edis-uipath force-pushed the feature/update_uipath_2.2 branch from 6c8f026 to ce27d27 Compare December 11, 2025 14:48
@edis-uipath edis-uipath force-pushed the feature/update_uipath_2.2 branch from ce27d27 to 141dd08 Compare December 11, 2025 15:23
"""
Load fps context from uipath.json for server registration.
"""
config_path = self.context.config_path or "uipath.json"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
config_path = self.context.config_path or "uipath.json"
config_path = self.context.config_path or UiPathConfig.config_file_path()

ref: https://github.com/UiPath/uipath-python/blob/b2eed6e5d8322855144db0d3b71d2c219d1bdb71/src/uipath/platform/common/_config.py#L27

self.trace_provider = TracerProvider()
trace.set_tracer_provider(self.trace_provider)
self.trace_provider.add_span_processor(
async def emit_state(node_name: str, payload: dict[str, Any]) -> None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's remove streaming events, it complicates things unnecessarily

with open(config_path, "r") as f:
config: dict[str, Any] = json.load(f)

config_runtime = config.get("runtime", {})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be a part of the UiPathRuntimeContext, let's do something similar to what we did for conversational agents: https://github.com/UiPath/uipath-runtime-python/blob/main/src/uipath/runtime/context.py#L319

await event_queue.put(event)

try:
if self._job_id:
Copy link
Member

@cristipufu cristipufu Dec 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's remove this, is automatically handled by the CLI now (the tracing/llm ops exporter part)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build:dev Create a dev build from the pr

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants