UiPath MCP SDK
The UiPath MCP (Managed Cloud Platform) SDK for Python enables developers to build custom activities that integrate with the UiPath ecosystem. It provides the necessary interfaces and tools for creating and exposing automations as discoverable services within UiPath Orchestrator. The current version is 0.2.2, with releases typically aligned with the core `uipath` Python SDK.
Common errors
-
ModuleNotFoundError: No module named 'uipath_mcp'
cause The `uipath-mcp` package is not installed in the current Python environment.fixRun `pip install uipath-mcp` to install the library. -
RuntimeError: Missing environment variable: UIPATH_MCP_CLIENT_ID (or similar for CLIENT_SECRET, SERVER_URL)
cause The `uipath-mcp` SDK requires specific environment variables for authentication and endpoint configuration, which were not found.fixSet the necessary environment variables before running your application: `export UIPATH_MCP_CLIENT_ID='your_id'`, `export UIPATH_MCP_CLIENT_SECRET='your_secret'`, `export UIPATH_MCP_SERVER_URL='your_orchestrator_url'`. -
AttributeError: 'YourOldClass' object has no attribute 'run' (or similar errors related to internal UiPath SDK components)
cause This often indicates a mismatch between your `uipath-mcp` version and its core dependencies (`uipath`, `uipath-runtime`), or that your MCP service is built on an outdated architectural pattern (e.g., pre-0.1.0 middleware pattern).fixFirst, ensure all dependencies are up-to-date: `pip install --upgrade uipath-mcp uipath uipath-runtime`. If the issue persists, review the breaking changes for `uipath-mcp` v0.1.0 and v0.2.0, and update your code to match the current `UiPathRuntimeProtocol` pattern as shown in the quickstart.
Warnings
- breaking Version 0.2.0 introduced breaking changes by bumping minimum dependency versions for `uipath` to `>=2.10.40` and `uipath-runtime` to `>=0.10.0`. Projects using older versions of these dependencies will fail until upgraded.
- breaking Version 0.1.0 aligned with UiPath Python SDK v2.2.0, adopting a new `UiPathRuntimeProtocol` pattern and replacing the previous middleware-based approach. Existing MCP implementations built with pre-0.1.0 versions will require refactoring to conform to the new protocol.
- gotcha The `uipath-mcp` service requires specific environment variables (`UIPATH_MCP_CLIENT_ID`, `UIPATH_MCP_CLIENT_SECRET`, `UIPATH_MCP_SERVER_URL`) to be set for authentication and to locate the UiPath Orchestrator endpoint. Missing these will prevent the service from starting or connecting.
Install
-
pip install uipath-mcp
Imports
- UiPathMCP
from uipath_mcp.mcp import UiPathMCP
- GetHealthResponse, ProcessRequest
from uipath_mcp.models import GetHealthResponse, ProcessRequest
Quickstart
import os
from uipath_mcp.mcp import UiPathMCP
from uipath_mcp.models import GetHealthResponse, ProcessRequest
class MyMCP(UiPathMCP):
async def GetHealth(self) -> GetHealthResponse:
print("Health check requested.")
return GetHealthResponse(status="HEALTHY")
async def Process(self, request: ProcessRequest) -> None:
print(f"Received process request: {request.input}")
# Implement your automation logic here based on request.input
# For example, calling another UiPath process or external API
# Ensure these environment variables are set for authentication and server URL
# UIPATH_MCP_CLIENT_ID, UIPATH_MCP_CLIENT_SECRET, UIPATH_MCP_SERVER_URL
if __name__ == "__main__":
# Basic check for required env vars for quickstart to avoid immediate failure
if not all(os.environ.get(var) for var in ['UIPATH_MCP_CLIENT_ID', 'UIPATH_MCP_CLIENT_SECRET', 'UIPATH_MCP_SERVER_URL']):
print("Warning: Please set UIPATH_MCP_CLIENT_ID, UIPATH_MCP_CLIENT_SECRET, UIPATH_MCP_SERVER_URL environment variables to run this example.")
print("Example: export UIPATH_MCP_CLIENT_ID='your_client_id'")
try:
mcp = MyMCP()
mcp.run() # This will start the server and listen for requests
except Exception as e:
print(f"An error occurred: {e}")
print("Ensure all required environment variables are set and dependencies are correct.")