|
| 1 | +# Quickstart Guide: UiPath LangChain Agents |
| 2 | + |
| 3 | +## Introduction |
| 4 | + |
| 5 | +This guide provides step-by-step instructions for setting up, creating, publishing, and running your first UiPath coded MCP Server. |
| 6 | + |
| 7 | +## Prerequisites |
| 8 | + |
| 9 | +Before proceeding, ensure you have the following installed: |
| 10 | + |
| 11 | +- Python 3.11 or higher |
| 12 | +- `pip` or `uv` package manager |
| 13 | +- A UiPath Automation Cloud account with appropriate permissions |
| 14 | +- A [UiPath Personal Access Token](https://docs.uipath.com/automation-cloud/automation-cloud/latest/api-guide/personal-access-tokens) with _Orchestrator API Access scopes_ |
| 15 | +- A folder in Orchestrator with a serverless runtime (machine) assigned to it |
| 16 | + |
| 17 | +## Creating a New Project |
| 18 | + |
| 19 | +We recommend using `uv` for package management. To create a new project: |
| 20 | + |
| 21 | +//// tab | Linux, macOS, Windows Bash |
| 22 | + |
| 23 | +<!-- termynal --> |
| 24 | + |
| 25 | +```shell |
| 26 | +> mkdir example |
| 27 | +> cd example |
| 28 | +``` |
| 29 | + |
| 30 | +//// |
| 31 | + |
| 32 | +//// tab | Windows PowerShell |
| 33 | + |
| 34 | +<!-- termynal --> |
| 35 | + |
| 36 | +```powershell |
| 37 | +> New-Item -ItemType Directory -Path example |
| 38 | +> Set-Location example |
| 39 | +``` |
| 40 | + |
| 41 | +//// |
| 42 | + |
| 43 | +//// tab | uv |
| 44 | + new: true |
| 45 | + |
| 46 | +<!-- termynal --> |
| 47 | + |
| 48 | +```shell |
| 49 | +# Initialize a new uv project in the current directory |
| 50 | +> uv init . --python 3.10 |
| 51 | + |
| 52 | +# Create a new virtual environment |
| 53 | +# By default, uv creates a virtual environment in a directory called .venv |
| 54 | +> uv venv |
| 55 | +Using CPython 3.10.16 interpreter at: [PATH] |
| 56 | +Creating virtual environment at: .venv |
| 57 | +Activate with: source .venv/bin/activate |
| 58 | + |
| 59 | +# Activate the virtual environment |
| 60 | +# For Windows PowerShell/ Windows CMD: .venv\Scripts\activate |
| 61 | +# For Windows Bash: source .venv/Scripts/activate |
| 62 | +> source .venv/bin/activate |
| 63 | + |
| 64 | +# Install the uipath package |
| 65 | +> uv add uipath-mcp |
| 66 | +``` |
| 67 | + |
| 68 | +//// |
| 69 | + |
| 70 | +//// tab | pip |
| 71 | + |
| 72 | +<!-- termynal --> |
| 73 | + |
| 74 | +```shell |
| 75 | +# Create a new virtual environment |
| 76 | +> python -m venv .venv |
| 77 | + |
| 78 | +# Activate the virtual environment |
| 79 | +# For Windows PowerShell: .venv\Scripts\Activate.ps1 |
| 80 | +# For Windows Bash: source .venv/Scripts/activate |
| 81 | +> source .venv/bin/activate |
| 82 | + |
| 83 | +# Upgrade pip to the latest version |
| 84 | +> python -m pip install --upgrade pip |
| 85 | + |
| 86 | +# Install the uipath package |
| 87 | +> pip install uipath-mcp |
| 88 | +``` |
| 89 | + |
| 90 | +//// |
| 91 | + |
| 92 | +## Create Your First UiPath Coded MCP Server |
| 93 | + |
| 94 | +Generate your first UiPath LangChain agent: |
| 95 | + |
| 96 | +<!-- termynal --> |
| 97 | + |
| 98 | +```shell |
| 99 | +> uipath new math-server |
| 100 | +⠋ Creating new mcp server 'math-server' in current directory ... |
| 101 | +✓ Created 'server.py' file. |
| 102 | +✓ Created 'mcp.json' file. |
| 103 | +✓ Created 'pyproject.toml' file. |
| 104 | +💡 Initialize project: uipath init |
| 105 | +════════════════════════════════════════════════════════════ |
| 106 | +Start 'math-server' as a self-hosted MCP server |
| 107 | +════════════════════════════════════════════════════════════ |
| 108 | +💡 1. Set UIPATH_FOLDER_PATH environment variable |
| 109 | +💡 2. Start the server locally: uipath run math-server |
| 110 | +``` |
| 111 | + |
| 112 | +This command creates the following files: |
| 113 | + |
| 114 | +| File Name | Description | |
| 115 | +|------------------|----------------------------------------------------------------------------------------| |
| 116 | +| `server.py` | A sample MCP math server using FastMCP | |
| 117 | +| `mcp.json` | Configuration file needed for coded UiPath MCP Servers. | |
| 118 | +| `pyproject.toml` | Project metadata and dependencies as per [PEP 518](https://peps.python.org/pep-0518/). | |
| 119 | + |
| 120 | +/// warning |
| 121 | +_uipath new_ command will delete all previous `.py` files in the current directory. |
| 122 | + |
| 123 | +## Initialize Project |
| 124 | + |
| 125 | +<!-- termynal --> |
| 126 | + |
| 127 | +```shell |
| 128 | +> uipath init |
| 129 | +⠋ Initializing UiPath project ... |
| 130 | +✓ Created '.env' file. |
| 131 | +✓ Created 'uipath.json' file. |
| 132 | +``` |
| 133 | + |
| 134 | +This command creates the following files: |
| 135 | + |
| 136 | +| File Name | Description | |
| 137 | +| ---------------- | --------------------------------------------------------------------------------------------------------------------------------- | |
| 138 | +| `.env` | Environment variables and secrets (this file will not be packed & published). | |
| 139 | +| `uipath.json` | Input/output JSON schemas and bindings. | |
| 140 | + |
| 141 | +## Authenticate With UiPath |
| 142 | + |
| 143 | +<!-- termynal --> |
| 144 | + |
| 145 | +```shell |
| 146 | +> uipath auth |
| 147 | +⠋ Authenticating with UiPath ... |
| 148 | +🔗 If a browser window did not open, please open the following URL in your browser: [LINK] |
| 149 | +👇 Select tenant: |
| 150 | + 0: Tenant1 |
| 151 | + 1: Tenant2 |
| 152 | +Select tenant number: 0 |
| 153 | +Selected tenant: Tenant1 |
| 154 | +✓ Authentication successful. |
| 155 | +``` |
| 156 | +# Run the MCP Server |
| 157 | + |
| 158 | +There are two ways to run your coded MCP server: |
| 159 | + |
| 160 | +## 1. Running Locally (On-Prem) |
| 161 | + |
| 162 | +When running the server locally, JSON-RPC requests are tunneled from UiPath servers to your local server. During startup, the local server automatically registers itself with UiPath. |
| 163 | + |
| 164 | +Since MCP servers are folder-scoped in Orchestrator, you need to set the `UIPATH_FOLDER_PATH` environment variable. To do this: |
| 165 | + |
| 166 | +1. Copy the folder path from your Orchestrator interface |
| 167 | + |
| 168 | +<picture data-light="../quick_start_images/copy-folder-light.png" data-dark="../quick_start_images/copy-folder-dark.png"> |
| 169 | + <source |
| 170 | + media="(prefers-color-scheme: dark)" |
| 171 | + srcset="../quick_start_images/copy-folder-dark.png" |
| 172 | + /> |
| 173 | + <img |
| 174 | + src="../quick_start_images/copy-folder-light.png" |
| 175 | + /> |
| 176 | +</picture> |
| 177 | + |
| 178 | +2. Add it to the `.env` file (created during [`uipath init`](#initialize-project)) as: |
| 179 | + ``` |
| 180 | + UIPATH_FOLDER_PATH=<Copied folder path> |
| 181 | + ``` |
| 182 | + |
| 183 | +<!-- termynal --> |
| 184 | +```shell |
| 185 | +# Start the server |
| 186 | +> uipath run math-server |
| 187 | +Initializing tracer instance. This should only be done once per process. |
| 188 | +HTTP Request: GET https://***/orchestrator_/api/FoldersNavigation/GetFoldersForCurrentUser?searchText=Agents&skip=0&take=20 "HTTP/1.1 200 OK" |
| 189 | +Folder key: *** |
| 190 | +Initializing client session... |
| 191 | +Initialization successful |
| 192 | +Registering server runtime ... |
| 193 | +... |
| 194 | +``` |
| 195 | + |
| 196 | +### Verifying the Server |
| 197 | + |
| 198 | +Once started successfully, your MCP server will appear in Orchestrator. Navigate to the MCP Servers tab in your configured folder: |
| 199 | + |
| 200 | +<picture data-light="../quick_start_images/self-hosted-light.png" data-dark="../quick_start_images/self-hosted-dark.png"> |
| 201 | + <source |
| 202 | + media="(prefers-color-scheme: dark)" |
| 203 | + srcset="../quick_start_images/self-hosted-dark.png" |
| 204 | + /> |
| 205 | + <img |
| 206 | + src="../quick_start_images/self-hosted-light.png" |
| 207 | + /> |
| 208 | +</picture> |
| 209 | + |
| 210 | +You can inspect the available tools by clicking on the server: |
| 211 | + |
| 212 | +<picture data-light="../quick_start_images/tools-light.png" data-dark="../quick_start_images/tools-dark.png"> |
| 213 | + <source |
| 214 | + media="(prefers-color-scheme: dark)" |
| 215 | + srcset="../quick_start_images/tools-dark.png" |
| 216 | + /> |
| 217 | + <img |
| 218 | + src="../quick_start_images/tools-light.png" |
| 219 | + /> |
| 220 | +</picture> |
| 221 | + |
| 222 | +Now we can connect to the server using any MCP client. See the [Connecting to the MCP Server](#connecting-to-the-mcp-server) section. |
| 223 | + |
| 224 | +/// warning |
| 225 | +Before running the MCP server, ensure that a serverless runtime (machine) is assigned to your folder in Orchestrator. |
| 226 | + |
| 227 | +## 2. Running on UiPath Cloud Platform |
| 228 | + |
| 229 | +To deploy your MCP server to UiPath Cloud Platform, follow these steps: |
| 230 | + |
| 231 | +### (Optional) Customize the Package |
| 232 | + |
| 233 | +Update author details in `pyproject.toml`: |
| 234 | + |
| 235 | +```toml |
| 236 | +authors = [{ name = "Your Name", email = "[email protected]" }] |
| 237 | +``` |
| 238 | + |
| 239 | +### Package Your Project |
| 240 | + |
| 241 | +<!-- termynal --> |
| 242 | +```shell |
| 243 | +> uipath pack |
| 244 | +⠹ Packaging project ... |
| 245 | +Name : math-server |
| 246 | +Version : 0.0.1 |
| 247 | +Description: Description for math-server project |
| 248 | +Authors : John Doe |
| 249 | +✓ Project successfully packaged. |
| 250 | +``` |
| 251 | + |
| 252 | +### Publish The Mcp Server Package |
| 253 | + |
| 254 | +<!-- termynal --> |
| 255 | +```shell |
| 256 | +> uipath publish |
| 257 | +⠏ Fetching available package feeds... |
| 258 | +👇 Select package feed: |
| 259 | + 0: Orchestrator Tenant Processes Feed |
| 260 | + 1: Folder Feed 1 |
| 261 | + 2: Folder Feed 2 |
| 262 | + ... |
| 263 | +Select feed number: 0 |
| 264 | +Selected feed: Orchestrator Tenant Processes Feed |
| 265 | +⠸ Publishing most recent package: math-server.0.0.1.nupkg ... |
| 266 | +✓ Package published successfully! |
| 267 | +``` |
| 268 | + |
| 269 | +After publishing, you can configure and manage your MCP server through the UiPath Cloud interface: |
| 270 | + |
| 271 | +### Configure in UiPath Cloud |
| 272 | + |
| 273 | +1. In Orchestrator, create a new Process using your published MCP Server package as the template |
| 274 | +2. In the folder where you want to deploy the server, navigate to the MCP Servers tab and click **Add MCP Server** |
| 275 | + |
| 276 | +<picture data-light="../quick_start_images/add-mcp-light.png" data-dark="../quick_start_images/add-mcp-dark.png"> |
| 277 | + <source |
| 278 | + media="(prefers-color-scheme: dark)" |
| 279 | + srcset="../quick_start_images/add-mcp-dark.png" |
| 280 | + /> |
| 281 | + <img |
| 282 | + src="../quick_start_images/add-mcp-light.png" |
| 283 | + /> |
| 284 | +</picture> |
| 285 | + |
| 286 | +3. In the configuration dialog: |
| 287 | + - Select `Coded` as the server type |
| 288 | + - Choose the Process you created earlier |
| 289 | + - Click **Add** to deploy the server |
| 290 | + |
| 291 | +<picture data-light="../quick_start_images/configure-mcp-light.png" data-dark="../quick_start_images/configure-mcp-dark.png"> |
| 292 | + <source |
| 293 | + media="(prefers-color-scheme: dark)" |
| 294 | + srcset="../quick_start_images/configure-mcp-dark.png" |
| 295 | + /> |
| 296 | + <img |
| 297 | + src="../quick_start_images/configure-mcp-light.png" |
| 298 | + /> |
| 299 | +</picture> |
| 300 | + |
| 301 | +Once deployed, the server will automatically start and register its available tools. You can monitor the job status in the MCP Server side panel. |
| 302 | + |
| 303 | +## Connecting to the MCP Server |
| 304 | + |
| 305 | +You can connect to your MCP server using any MCP client. Here's what you'll need: |
| 306 | + |
| 307 | +1. **MCP Server URL**: Copy this from the UiPath MCP Servers page in Orchestrator |
| 308 | + |
| 309 | +<picture data-light="../quick_start_images/copy-link-light.png" data-dark="../quick_start_images/copy-link-dark.png"> |
| 310 | + <source |
| 311 | + media="(prefers-color-scheme: dark)" |
| 312 | + srcset="../quick_start_images/copy-link-dark.png" |
| 313 | + /> |
| 314 | + <img |
| 315 | + src="../quick_start_images/copy-link-light.png" |
| 316 | + /> |
| 317 | +</picture> |
| 318 | + |
| 319 | +2. **Authentication**: Use your [Personal Access Token (PAT)](#prerequisites) as an authorization header |
| 320 | +3. **Transport**: Configure the client to use HTTP Streamable transport |
| 321 | + |
| 322 | +## Next Steps |
| 323 | + |
| 324 | +Congratulations! You have successfully set up, created, published, and run a Coded UiPath MCP Server. 🚀 |
| 325 | + |
| 326 | +For more coded MCP samples, please refer to our [samples section](https://github.com/UiPath/uipath-mcp-python/tree/main/samples) in GitHub. |
0 commit comments