Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 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
41 changes: 40 additions & 1 deletion src/uipath_mcp/_cli/_runtime/_context.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Optional
from enum import Enum
from typing import Optional, Dict

from uipath._cli._runtime._contracts import UiPathRuntimeContext

Expand All @@ -8,3 +9,41 @@
class UiPathMcpRuntimeContext(UiPathRuntimeContext):
"""Context information passed throughout the runtime execution."""
config: Optional[McpConfig] = None


class UiPathServerType(Enum):
"""Defines the different types of UiPath servers used in the MCP ecosystem.

This enum is used to identify and configure the behavior of different server types
during runtime registration and execution. Using these enum values instead of
magic numbers improves code readability and maintainability.

Attributes:
UiPath (0): Standard UiPath server for Processes, Agents, and Activities
External (1): External server types like npx, uvx
Local (2): Local MCP server (PackageType.MCPServer)
Hosted (3): Tunnel to externally hosted server
"""
UiPath = 0 # type: int - Processes, Agents, Activities
External = 1 # type: int - npx, uvx
Local = 2 # type: int - PackageType.MCPServer
Hosted = 3 # type: int - tunnel to externally hosted server

@classmethod
def from_string(cls, name: str) -> 'UiPathServerType':
"""Get enum value from string name."""
try:
return cls[name]
except KeyError:
raise ValueError(f"Unknown server type: {name}")

@classmethod
def get_description(cls, server_type: 'UiPathServerType') -> str:
"""Get description for a server type."""
descriptions = {
cls.UiPath: "Standard UiPath server for Processes, Agents, and Activities",
cls.External: "External server types like npx, uvx",
cls.Local: "Local MCP server (PackageType.MCPServer)",
cls.Hosted: "Tunnel to externally hosted server"
}
return descriptions.get(server_type, "Unknown server type")
Loading