|
| 1 | +# SETUP.MD |
| 2 | + |
| 3 | +This file documents how to provision a clean development environment for `uipath-mcp`, run the build, execute the tests, and validate a sample code change end-to-end. It is intended both as a quick reference for human contributors and as a structured guide for automated environment-setup tooling. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +- Python 3.11+ |
| 8 | +- [uv](https://docs.astral.sh/uv/) 0.5+ |
| 9 | + |
| 10 | +### Supported platforms |
| 11 | + |
| 12 | +`uv` is shell- and OS-agnostic, so the commands below run unchanged on every supported platform: |
| 13 | + |
| 14 | +- [x] Linux |
| 15 | +- [x] Windows |
| 16 | +- [x] macOS |
| 17 | + |
| 18 | +## Environment Variables |
| 19 | + |
| 20 | +### Standard |
| 21 | + |
| 22 | +None required for environment setup, build, or unit tests. |
| 23 | + |
| 24 | +### Project-specific |
| 25 | + |
| 26 | +None. The unit-test suite under the `Test` section below runs fully offline and requires no external authentication. |
| 27 | + |
| 28 | +> **All commands below must be run from the repository root.** The `uv` invocations resolve `pyproject.toml`, `src/`, and `tests/` relative to the current working directory. The first line of `## Setup` enforces this by `cd`-ing to the git root. |
| 29 | +
|
| 30 | +## Setup |
| 31 | + |
| 32 | +```bash |
| 33 | +cd "$(git rev-parse --show-toplevel)" |
| 34 | +python3 -m pip install --upgrade uv |
| 35 | +uv sync --all-extras |
| 36 | +``` |
| 37 | + |
| 38 | +## Verify Setup |
| 39 | + |
| 40 | +```bash |
| 41 | +uv --version |
| 42 | +uv run python --version |
| 43 | +uv run python -c "import uipath_mcp; print('uipath_mcp ok')" |
| 44 | +``` |
| 45 | + |
| 46 | +## Build |
| 47 | + |
| 48 | +N/A |
| 49 | + |
| 50 | +## Test |
| 51 | + |
| 52 | +```bash |
| 53 | +uv run pytest |
| 54 | +``` |
| 55 | + |
| 56 | +## Sample Code Change |
| 57 | + |
| 58 | +### The change |
| 59 | + |
| 60 | +Add a new `server_count` property to `McpConfig` in `src/uipath_mcp/_cli/_utils/_config.py`, immediately after the existing `get_server_names` method: |
| 61 | + |
| 62 | +```python |
| 63 | +@property |
| 64 | +def server_count(self) -> int: |
| 65 | + """Number of MCP servers currently loaded from configuration.""" |
| 66 | + return len(self._servers) |
| 67 | +``` |
| 68 | + |
| 69 | +Then create `tests/test_config_server_count.py` with two pytest tests: |
| 70 | + |
| 71 | +```python |
| 72 | +"""Tests for McpConfig.server_count.""" |
| 73 | + |
| 74 | +import json |
| 75 | +from pathlib import Path |
| 76 | + |
| 77 | +from uipath_mcp._cli._utils._config import McpConfig |
| 78 | + |
| 79 | + |
| 80 | +def test_server_count_empty(tmp_path: Path) -> None: |
| 81 | + config_path = tmp_path / "mcp.json" |
| 82 | + config_path.write_text(json.dumps({"servers": {}})) |
| 83 | + cfg = McpConfig(str(config_path)) |
| 84 | + assert cfg.server_count == 0 |
| 85 | + |
| 86 | + |
| 87 | +def test_server_count_multiple(tmp_path: Path) -> None: |
| 88 | + config_path = tmp_path / "mcp.json" |
| 89 | + config_path.write_text( |
| 90 | + json.dumps( |
| 91 | + { |
| 92 | + "servers": { |
| 93 | + "alpha": {"command": "node", "args": ["alpha.js"]}, |
| 94 | + "beta": {"command": "node", "args": ["beta.js"]}, |
| 95 | + } |
| 96 | + } |
| 97 | + ) |
| 98 | + ) |
| 99 | + cfg = McpConfig(str(config_path)) |
| 100 | + assert cfg.server_count == 2 |
| 101 | +``` |
| 102 | + |
| 103 | +### Verification |
| 104 | + |
| 105 | +```bash |
| 106 | +uv run pytest tests/test_config_server_count.py -v |
| 107 | +``` |
| 108 | + |
| 109 | +## Test with a real UiPath Coded MCP |
| 110 | + |
| 111 | +The unit tests above are necessary but not sufficient — they don't exercise the package end-to-end. The flow below validates changes against a live runtime: |
| 112 | + |
| 113 | +1. Apply the code changes locally. |
| 114 | +2. Run the unit tests (see the `Sample Code Change` section above). |
| 115 | +3. Scaffold a coded UiPath MCP that exercises the changed code path. |
| 116 | +4. In the downstream project's `pyproject.toml`, add this local library as an editable dependency: |
| 117 | + |
| 118 | + ```toml |
| 119 | + [tool.uv.sources] |
| 120 | + uipath-mcp = { path = "../path/to/uipath-mcp-python", editable = true } |
| 121 | + ``` |
| 122 | + |
| 123 | +5. Exercise the new behavior end-to-end: |
| 124 | + |
| 125 | + ```bash |
| 126 | + uv run uipath run <mcp-name> --input '{...}' |
| 127 | + ``` |
| 128 | + |
| 129 | +6. (Optional) Open a PR and apply the `build:dev` label — this publishes the development version to Test PyPI. |
| 130 | +7. The PR description is updated automatically with instructions for pointing the downstream MCP at the Test PyPI dev version. |
| 131 | +8. Deploy the MCP to Orchestrator / Studio Web and run it in cloud to confirm the changes behave correctly against the real platform. |
0 commit comments