diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index f638454..c37daeb 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -4,24 +4,9 @@ on: workflow_call jobs: - # Job that runs when custom version testing is enabled - just completes successfully - skip-lint: - name: Skip Lint (Custom Version Testing) - runs-on: ubuntu-latest - if: contains(github.event.pull_request.labels.*.name, 'test-core-dev-version') - permissions: - contents: read - steps: - - name: Skip lint for custom version testing - run: | - echo "Custom version testing enabled - skipping normal lint process" - echo "This job completes successfully to allow PR merging" - - # Job that runs normal lint process when custom version testing is NOT enabled lint: name: Lint runs-on: ubuntu-latest - if: "!contains(github.event.pull_request.labels.*.name, 'test-core-dev-version')" permissions: contents: read diff --git a/README.md b/README.md index c4d6b10..7b8af93 100644 --- a/README.md +++ b/README.md @@ -6,11 +6,7 @@ A Python SDK that enables hosting local MCP servers on UiPath Platform. -Check out these sample projects to get started: - -- [GitHub MCP Server (Go)](https://github.com/UiPath/uipath-mcp-python/tree/main/samples/github-helper-agent) - Build, pack and publish executable MCP Servers created in Go -- [Math MCP Server (Python)](https://github.com/UiPath/uipath-mcp-python/tree/main/samples/mcp-math-server) - Pack and publish custom Python code MCP Server - +Check out our [samples directory](https://github.com/UiPath/uipath-mcp-python/tree/main/samples) to explore various MCP server implementations. You can also learn how to [pack and host binary servers](https://github.com/UiPath/uipath-mcp-python/blob/main/docs/how_to_pack_binary.md) written in languages like Go within UiPath. ## Installation diff --git a/docs/quick_start.md b/docs/quick_start.md new file mode 100644 index 0000000..750876e --- /dev/null +++ b/docs/quick_start.md @@ -0,0 +1,326 @@ +# Quickstart Guide: UiPath LangChain Agents + +## Introduction + +This guide provides step-by-step instructions for setting up, creating, publishing, and running your first UiPath coded MCP Server. + +## Prerequisites + +Before proceeding, ensure you have the following installed: + +- Python 3.11 or higher +- `pip` or `uv` package manager +- A UiPath Automation Cloud account with appropriate permissions +- A [UiPath Personal Access Token](https://docs.uipath.com/automation-cloud/automation-cloud/latest/api-guide/personal-access-tokens) with _Orchestrator API Access scopes_ +- A folder in Orchestrator with a serverless runtime (machine) assigned to it + +## Creating a New Project + +We recommend using `uv` for package management. To create a new project: + +//// tab | Linux, macOS, Windows Bash + + + +```shell +> mkdir example +> cd example +``` + +//// + +//// tab | Windows PowerShell + + + +```powershell +> New-Item -ItemType Directory -Path example +> Set-Location example +``` + +//// + +//// tab | uv + new: true + + + +```shell +# Initialize a new uv project in the current directory +> uv init . --python 3.10 + +# Create a new virtual environment +# By default, uv creates a virtual environment in a directory called .venv +> uv venv +Using CPython 3.10.16 interpreter at: [PATH] +Creating virtual environment at: .venv +Activate with: source .venv/bin/activate + +# Activate the virtual environment +# For Windows PowerShell/ Windows CMD: .venv\Scripts\activate +# For Windows Bash: source .venv/Scripts/activate +> source .venv/bin/activate + +# Install the uipath package +> uv add uipath-mcp +``` + +//// + +//// tab | pip + + + +```shell +# Create a new virtual environment +> python -m venv .venv + +# Activate the virtual environment +# For Windows PowerShell: .venv\Scripts\Activate.ps1 +# For Windows Bash: source .venv/Scripts/activate +> source .venv/bin/activate + +# Upgrade pip to the latest version +> python -m pip install --upgrade pip + +# Install the uipath package +> pip install uipath-mcp +``` + +//// + +## Create Your First UiPath Coded MCP Server + +Generate your first UiPath LangChain agent: + + + +```shell +> uipath new math-server +⠋ Creating new mcp server 'math-server' in current directory ... +✓ Created 'server.py' file. +✓ Created 'mcp.json' file. +✓ Created 'pyproject.toml' file. +💡 Initialize project: uipath init +════════════════════════════════════════════════════════════ +Start 'math-server' as a self-hosted MCP server +════════════════════════════════════════════════════════════ +💡 1. Set UIPATH_FOLDER_PATH environment variable +💡 2. Start the server locally: uipath run math-server +``` + +This command creates the following files: + +| File Name | Description | +|------------------|----------------------------------------------------------------------------------------| +| `server.py` | A sample MCP math server using FastMCP | +| `mcp.json` | Configuration file needed for coded UiPath MCP Servers. | +| `pyproject.toml` | Project metadata and dependencies as per [PEP 518](https://peps.python.org/pep-0518/). | + +/// warning +_uipath new_ command will delete all previous `.py` files in the current directory. + +## Initialize Project + + + +```shell +> uipath init +⠋ Initializing UiPath project ... +✓ Created '.env' file. +✓ Created 'uipath.json' file. +``` + +This command creates the following files: + +| File Name | Description | +| ---------------- | --------------------------------------------------------------------------------------------------------------------------------- | +| `.env` | Environment variables and secrets (this file will not be packed & published). | +| `uipath.json` | Input/output JSON schemas and bindings. | + +## Authenticate With UiPath + + + +```shell +> uipath auth +⠋ Authenticating with UiPath ... +🔗 If a browser window did not open, please open the following URL in your browser: [LINK] +👇 Select tenant: + 0: Tenant1 + 1: Tenant2 +Select tenant number: 0 +Selected tenant: Tenant1 +✓ Authentication successful. +``` +# Run the MCP Server + +There are two ways to run your coded MCP server: + +## 1. Running Locally (On-Prem) + +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. + +Since MCP servers are folder-scoped in Orchestrator, you need to set the `UIPATH_FOLDER_PATH` environment variable. To do this: + +1. Copy the folder path from your Orchestrator interface + + + + + + +2. Add it to the `.env` file (created during [`uipath init`](#initialize-project)) as: + ``` + UIPATH_FOLDER_PATH= + ``` + + +```shell +# Start the server +> uipath run math-server +Initializing tracer instance. This should only be done once per process. +HTTP Request: GET https://***/orchestrator_/api/FoldersNavigation/GetFoldersForCurrentUser?searchText=Agents&skip=0&take=20 "HTTP/1.1 200 OK" +Folder key: *** +Initializing client session... +Initialization successful +Registering server runtime ... +... +``` + +### Verifying the Server + +Once started successfully, your MCP server will appear in Orchestrator. Navigate to the MCP Servers tab in your configured folder: + + + + + + +You can inspect the available tools by clicking on the server: + + + + + + +Now we can connect to the server using any MCP client. See the [Connecting to the MCP Server](#connecting-to-the-mcp-server) section. + +/// warning +Before running the MCP server, ensure that a serverless runtime (machine) is assigned to your folder in Orchestrator. + +## 2. Running on UiPath Cloud Platform + +To deploy your MCP server to UiPath Cloud Platform, follow these steps: + +### (Optional) Customize the Package + +Update author details in `pyproject.toml`: + +```toml +authors = [{ name = "Your Name", email = "your.name@example.com" }] +``` + +### Package Your Project + + +```shell +> uipath pack +⠹ Packaging project ... +Name : math-server +Version : 0.0.1 +Description: Description for math-server project +Authors : John Doe +✓ Project successfully packaged. +``` + +### Publish The Mcp Server Package + + +```shell +> uipath publish +⠏ Fetching available package feeds... +👇 Select package feed: + 0: Orchestrator Tenant Processes Feed + 1: Folder Feed 1 + 2: Folder Feed 2 + ... +Select feed number: 0 +Selected feed: Orchestrator Tenant Processes Feed +⠸ Publishing most recent package: math-server.0.0.1.nupkg ... +✓ Package published successfully! +``` + +After publishing, you can configure and manage your MCP server through the UiPath Cloud interface: + +### Configure in UiPath Cloud + +1. In Orchestrator, create a new Process using your published MCP Server package as the template +2. In the folder where you want to deploy the server, navigate to the MCP Servers tab and click **Add MCP Server** + + + + + + +3. In the configuration dialog: + - Select `Coded` as the server type + - Choose the Process you created earlier + - Click **Add** to deploy the server + + + + + + +Once deployed, the server will automatically start and register its available tools. You can monitor the job status in the MCP Server side panel. + +## Connecting to the MCP Server + +You can connect to your MCP server using any MCP client. Here's what you'll need: + +1. **MCP Server URL**: Copy this from the UiPath MCP Servers page in Orchestrator + + + + + + +2. **Authentication**: Use your [Personal Access Token (PAT)](#prerequisites) as an authorization header +3. **Transport**: Configure the client to use HTTP Streamable transport + +## Next Steps + +Congratulations! You have successfully set up, created, published, and run a Coded UiPath MCP Server. 🚀 + +For more coded MCP samples, please refer to our [samples section](https://github.com/UiPath/uipath-mcp-python/tree/main/samples) in GitHub. diff --git a/docs/quick_start_images/add-mcp-dark.png b/docs/quick_start_images/add-mcp-dark.png new file mode 100644 index 0000000..102d880 Binary files /dev/null and b/docs/quick_start_images/add-mcp-dark.png differ diff --git a/docs/quick_start_images/add-mcp-light.png b/docs/quick_start_images/add-mcp-light.png new file mode 100644 index 0000000..af164a3 Binary files /dev/null and b/docs/quick_start_images/add-mcp-light.png differ diff --git a/docs/quick_start_images/configure-mcp-dark.png b/docs/quick_start_images/configure-mcp-dark.png new file mode 100644 index 0000000..573e634 Binary files /dev/null and b/docs/quick_start_images/configure-mcp-dark.png differ diff --git a/docs/quick_start_images/configure-mcp-light.png b/docs/quick_start_images/configure-mcp-light.png new file mode 100644 index 0000000..0da0c3e Binary files /dev/null and b/docs/quick_start_images/configure-mcp-light.png differ diff --git a/docs/quick_start_images/copy-folder-dark.png b/docs/quick_start_images/copy-folder-dark.png new file mode 100644 index 0000000..24547c3 Binary files /dev/null and b/docs/quick_start_images/copy-folder-dark.png differ diff --git a/docs/quick_start_images/copy-folder-light.png b/docs/quick_start_images/copy-folder-light.png new file mode 100644 index 0000000..3efb686 Binary files /dev/null and b/docs/quick_start_images/copy-folder-light.png differ diff --git a/docs/quick_start_images/copy-link-dark.png b/docs/quick_start_images/copy-link-dark.png new file mode 100644 index 0000000..da08248 Binary files /dev/null and b/docs/quick_start_images/copy-link-dark.png differ diff --git a/docs/quick_start_images/copy-link-white.png b/docs/quick_start_images/copy-link-white.png new file mode 100644 index 0000000..ea4761d Binary files /dev/null and b/docs/quick_start_images/copy-link-white.png differ diff --git a/docs/quick_start_images/self-hosted-dark.png b/docs/quick_start_images/self-hosted-dark.png new file mode 100644 index 0000000..2566017 Binary files /dev/null and b/docs/quick_start_images/self-hosted-dark.png differ diff --git a/docs/quick_start_images/self-hosted-light.png b/docs/quick_start_images/self-hosted-light.png new file mode 100644 index 0000000..f57b3c9 Binary files /dev/null and b/docs/quick_start_images/self-hosted-light.png differ diff --git a/docs/quick_start_images/tools-dark.png b/docs/quick_start_images/tools-dark.png new file mode 100644 index 0000000..436a100 Binary files /dev/null and b/docs/quick_start_images/tools-dark.png differ diff --git a/docs/quick_start_images/tools-light.png b/docs/quick_start_images/tools-light.png new file mode 100644 index 0000000..a3844e3 Binary files /dev/null and b/docs/quick_start_images/tools-light.png differ diff --git a/pyproject.toml b/pyproject.toml index 64641c4..345d1e2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "uipath-mcp" -version = "0.0.98" +version = "0.0.99" description = "UiPath MCP SDK" readme = { file = "README.md", content-type = "text/markdown" } requires-python = ">=3.11" diff --git a/samples/README.md b/samples/README.md new file mode 100644 index 0000000..58e878c --- /dev/null +++ b/samples/README.md @@ -0,0 +1,28 @@ +# Project Samples + +## [GitHub Helper Agent](github-helper-agent) +A sample MCP server that demonstrates how to build, pack, and publish executable MCP Servers created in Go, showcasing integration with GitHub APIs. + +## [GitHub Slack Agent](github-slack-agent) +An agent that integrates GitHub with Slack, demonstrating how to build cross-platform automation workflows using MCP servers. + +## [Math MCP Server](mcp-math-server) +A simple example showing how to create a custom Python MCP server that provides mathematical operations. + +## [MCP Dynamic Server](mcp-dynamic-server) +Demonstrates how to create a dynamic MCP server that can adapt its behavior and tools based on runtime conditions. + +## [MCP Functions Agent](mcp-functions-agent) +Shows how to create an agent that can execute custom functions through the MCP protocol. + +## [MCP Functions Server](mcp-functions-server) +A companion server implementation showcasing how to expose custom functions as MCP tools. + +## [MCP SDK Server](mcp-sdk-server) +An MCP server that exposes UiPath SDK functionality, enabling AI agents to interact with UiPath Platform features using natural language. + +## [Financial Reconciliation Agent](financial-reconciliation-agent) +An example of how to build a specialized agent for financial data reconciliation tasks. + +## [MCP Insights](mcp-insights) +Tools and utilities for gathering insights and metrics from MCP server operations. diff --git a/samples/github-helper-agent/pyproject.toml b/samples/github-helper-agent/pyproject.toml index c98ccbb..cf05cd3 100644 --- a/samples/github-helper-agent/pyproject.toml +++ b/samples/github-helper-agent/pyproject.toml @@ -8,4 +8,4 @@ dependencies = [ "langgraph>=0.3.34", "langchain-mcp-adapters>=0.0.9" ] -requires-python = ">=3.10" +requires-python = ">=3.11" diff --git a/samples/github-slack-agent/README.md b/samples/github-slack-agent/README.md new file mode 100644 index 0000000..a2db8c3 --- /dev/null +++ b/samples/github-slack-agent/README.md @@ -0,0 +1,52 @@ +# GitHub-Slack Integration Agent + +An advanced integration agent that connects GitHub and Slack, providing automated code review notifications and insights. This agent demonstrates cross-platform automation using multiple MCP servers. + +## Features +- Automated PR reviews posted to Slack +- Detailed code analysis and feedback +- Threaded discussions in Slack +- Integration with both GitHub and Slack MCP servers +- Professional formatting for Slack messages + +## Requirements +- Python >=3.11 +- `langchain-mcp-adapters` +- `langgraph` +- `uipath-langchain` +- Access to GitHub and Slack MCP servers + +## Configuration +Set the following environment variables in `.env`: +```bash +GITHUB_MCP_SERVER_URL=your_github_mcp_url +SLACK_MCP_SERVER_URL=your_slack_mcp_url +SLACK_CHANNEL_ID=your_channel_id +UIPATH_ACCESS_TOKEN=your_access_token +``` + +## Usage +The agent automatically: +1. Monitors GitHub pull requests +2. Performs code review analysis +3. Posts formatted messages to Slack +4. Creates threaded discussions for detailed feedback + +## Message Format +Messages in Slack follow this structure: +``` +🧠 Summary: +Brief explanation of the PR + +✅ Pros: +• Code strengths +• Architecture improvements + +❌ Issues: +• Specific file and line references +• Detailed problem descriptions + +💡 Suggestions: +• Improvement recommendations +• Code examples +``` diff --git a/samples/github-slack-agent/pyproject.toml b/samples/github-slack-agent/pyproject.toml index adbe256..858087f 100644 --- a/samples/github-slack-agent/pyproject.toml +++ b/samples/github-slack-agent/pyproject.toml @@ -8,4 +8,4 @@ dependencies = [ "langgraph>=0.3.34", "langchain-mcp-adapters>=0.0.9" ] -requires-python = ">=3.10" +requires-python = ">=3.11" diff --git a/samples/mcp-dynamic-server/README.md b/samples/mcp-dynamic-server/README.md new file mode 100644 index 0000000..36e3cfc --- /dev/null +++ b/samples/mcp-dynamic-server/README.md @@ -0,0 +1,14 @@ +# Dynamic MCP Server + +A self-extending MCP server that can dynamically add new tools at runtime. + +## Features +- Dynamic tool addition at runtime +- Self-extending capabilities +- Tool validation and registration +- Runtime code evaluation +- Secure tool execution environment + +## Requirements +- Python >=3.11 +- UiPath MCP SDK diff --git a/samples/mcp-dynamic-server/pyproject.toml b/samples/mcp-dynamic-server/pyproject.toml index deb747d..581db09 100644 --- a/samples/mcp-dynamic-server/pyproject.toml +++ b/samples/mcp-dynamic-server/pyproject.toml @@ -6,4 +6,4 @@ authors = [{ name = "John Doe" }] dependencies = [ "uipath-mcp>=0.0.78", ] -requires-python = ">=3.10" +requires-python = ">=3.11" diff --git a/samples/mcp-functions-agent/README.md b/samples/mcp-functions-agent/README.md new file mode 100644 index 0000000..01a5a54 --- /dev/null +++ b/samples/mcp-functions-agent/README.md @@ -0,0 +1,37 @@ +# MCP Functions Agent + +An agent that works with the MCP Functions Server to create, test, and execute Python functions dynamically. + +## Features +- AI-powered function generation +- Automated test creation +- Dynamic code validation +- Integration with MCP Functions Server +- Smart error handling and debugging + +## Requirements +- Python >=3.11 +- `uipath-langchain` +- `langgraph` +- `langchain-mcp-adapters` +- Access to MCP Functions Server + +## Configuration +Set up your environment variables in `.env`: +```bash +FUNCTIONS_MCP_SERVER_URL=your_functions_server_url +UIPATH_ACCESS_TOKEN=your_access_token +``` + +## Usage +The agent can: +1. Analyze natural language function requests +2. Generate appropriate Python code +3. Create comprehensive test cases +4. Validate and execute the functions +5. Provide detailed feedback on results + +## Example +```bash +uipath run agent '{"query": "Create a function that calculates the factorial of a number"}' +``` diff --git a/samples/mcp-functions-agent/pyproject.toml b/samples/mcp-functions-agent/pyproject.toml index ea56863..07427c6 100644 --- a/samples/mcp-functions-agent/pyproject.toml +++ b/samples/mcp-functions-agent/pyproject.toml @@ -8,4 +8,4 @@ dependencies = [ "langgraph>=0.3.34", "langchain-mcp-adapters>=0.0.9" ] -requires-python = ">=3.10" +requires-python = ">=3.11" diff --git a/samples/mcp-functions-server/README.md b/samples/mcp-functions-server/README.md new file mode 100644 index 0000000..1958bb7 --- /dev/null +++ b/samples/mcp-functions-server/README.md @@ -0,0 +1,14 @@ +# MCP Functions Server + +An MCP server that enables dynamic creation and execution of Python functions. + +## Features +- Dynamic function creation +- Runtime code evaluation +- Function validation and security checks +- Flexible input/output schema handling +- Integration with MCP Functions Agent + +## Requirements +- Python >=3.11 +- UiPath MCP SDK diff --git a/samples/mcp-functions-server/pyproject.toml b/samples/mcp-functions-server/pyproject.toml index fe53efe..74a46a5 100644 --- a/samples/mcp-functions-server/pyproject.toml +++ b/samples/mcp-functions-server/pyproject.toml @@ -6,4 +6,4 @@ authors = [{ name = "John Doe" }] dependencies = [ "uipath-mcp>=0.0.78", ] -requires-python = ">=3.10" +requires-python = ">=3.11" diff --git a/samples/mcp-math-server/README.md b/samples/mcp-math-server/README.md new file mode 100644 index 0000000..81e3303 --- /dev/null +++ b/samples/mcp-math-server/README.md @@ -0,0 +1,14 @@ +# Math MCP Server + +A simple example demonstrating how to create a custom Python MCP server that provides mathematical operations. + +## Features +- Basic arithmetic operations +- Advanced mathematical functions +- Example of proper tool documentation +- Clean implementation of MCP server tools + +## Requirements +- Python >=3.11 +- UiPath MCP SDK + diff --git a/samples/mcp-math-server/pyproject.toml b/samples/mcp-math-server/pyproject.toml index c973710..1b2369f 100644 --- a/samples/mcp-math-server/pyproject.toml +++ b/samples/mcp-math-server/pyproject.toml @@ -6,4 +6,4 @@ authors = [{ name = "John Doe" }] dependencies = [ "uipath-mcp>=0.0.78", ] -requires-python = ">=3.10" +requires-python = ">=3.11" diff --git a/samples/mcp-sdk-server/README.md b/samples/mcp-sdk-server/README.md new file mode 100644 index 0000000..6193135 --- /dev/null +++ b/samples/mcp-sdk-server/README.md @@ -0,0 +1,15 @@ +# MCP SDK Server + +A sample MCP server that exposes UiPath SDK functionality through the MCP protocol. This enables AI agents to interact with UiPath Platform features using natural language. + +## Features +- Access to UiPath SDK capabilities via MCP +- Integration with UiPath Platform services +- Automation operations through MCP tools +- Platform authentication and authorization +- Secure SDK access management + +## Requirements +- Python >=3.11 +- UiPath MCP SDK +- UiPath Platform access diff --git a/samples/mcp-sdk-server/pyproject.toml b/samples/mcp-sdk-server/pyproject.toml index 595edea..bd36036 100644 --- a/samples/mcp-sdk-server/pyproject.toml +++ b/samples/mcp-sdk-server/pyproject.toml @@ -6,4 +6,4 @@ authors = [{ name = "John Doe" }] dependencies = [ "uipath-mcp>=0.0.78", ] -requires-python = ">=3.10" +requires-python = ">=3.11" diff --git a/src/uipath_mcp/_cli/_runtime/_runtime.py b/src/uipath_mcp/_cli/_runtime/_runtime.py index af7f465..e6f4218 100644 --- a/src/uipath_mcp/_cli/_runtime/_runtime.py +++ b/src/uipath_mcp/_cli/_runtime/_runtime.py @@ -399,7 +399,7 @@ async def _register(self) -> None: # Only proceed if initialization was successful tools_result = await session.list_tools() - logger.info(tools_result) + # logger.info(tools_result) except asyncio.TimeoutError: logger.error("Initialization timed out") # Capture stderr output here, after the timeout