Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
117 changes: 117 additions & 0 deletions .github/workflows/build-github-mcp-server.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: Build and Publish GitHub MCP Server

on:
workflow_dispatch:
inputs:
version:
description: 'Package version (e.g. 0.0.1)'
required: true
default: '0.0.1'
type: string
uipath_access_token:
description: 'UiPath Access Token'
required: true
type: string
uipath_url:
description: 'UiPath URL'
required: true
default: 'https://alpha.uipath.com/ada/byoa'
type: string

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
repository: github/github-mcp-server

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'

- name: Build MCP Server
run: |
cd cmd/github-mcp-server
go build

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install UV
run: pip install uv

- name: Prepare package directory
run: |
mkdir -p temp
cp cmd/github-mcp-server/github-mcp-server temp
chmod +x temp/github-mcp-server

- name: Create MCP config file
run: |
cat > temp/mcp.json << EOF
{
"servers": {
"github": {
"command": "/bin/sh",
"args": ["-c", "chmod +x github-mcp-server && ./github-mcp-server stdio"],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "x"
}
}
}
}
EOF

- name: Create pyproject.toml
run: |
cat > temp/pyproject.toml << EOF
[project]
name = "mcp-github-server"
version = "${{ github.event.inputs.version }}"
description = "Official GitHub MCP Server"
authors = [{ name = "John Doe" }]
dependencies = [
"uipath-mcp==0.0.74",
]
requires-python = ">=3.10"
EOF

- name: Create .env file
run: |
cat > temp/.env << EOF
UIPATH_ACCESS_TOKEN=${{ github.event.inputs.uipath_access_token }}
UIPATH_URL=${{ github.event.inputs.uipath_url }}
EOF

- name: Setup Python environment and package
working-directory: ./temp
run: |
# Create and activate virtual environment
uv venv -p 3.10 .venv
source .venv/bin/activate

# Install dependencies
uv sync

# Initialize uipath
uipath init

# Modify uipath.json to add settings
python -c "import json; f=open('uipath.json','r'); data=json.load(f); f.close(); data['settings']={'filesIncluded':['github-mcp-server']}; f=open('uipath.json','w'); json.dump(data,f,indent=4); f.close(); print('Updated uipath.json')"

# Show the modified file
cat uipath.json

# Continue with packing
uipath pack

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: mcp-github-server-${{ github.event.inputs.version }}
path: temp/.uipath/mcp-github-server.${{ github.event.inputs.version }}.nupkg
16 changes: 16 additions & 0 deletions .github/workflows/trigger-reviewer-agent.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: PR Review Bot

on:
pull_request:
types: [opened, reopened]

jobs:
trigger-uipath-review:
runs-on: ubuntu-latest
steps:
- name: Install Python dependencies
run: pip install requests

- name: Trigger UiPath PR Review
run: |
python -c "import requests; import json; resp = requests.post('${{ secrets.UIPATH_URL }}/orchestrator_/odata/Jobs/UiPath.Server.Configuration.OData.StartJobs', headers={'Authorization': 'Bearer ${{ secrets.UIPATH_ACCESS_TOKEN }}', 'Content-Type': 'application/json', 'X-UiPath-FolderPath': 'MCP Folder'}, json={'startInfo': {'releaseName': 'github-reviewer-agent', 'inputArguments': json.dumps({'messages': [{'role': 'user', 'content': 'Review this PR and provide detailed feedback'}], 'owner': '${{ github.repository_owner }}', 'repo': '${{ github.event.repository.name }}', 'pullNumber': ${{ github.event.pull_request.number }}})}}); print(f'Status code: {resp.status_code}'); print(f'Response: {resp.text}')"
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[project]
name = "uipath-mcp"
version = "0.0.68"
version = "0.0.74"
description = "UiPath MCP SDK"
readme = { file = "README.md", content-type = "text/markdown" }
requires-python = ">=3.10"
dependencies = [
"mcp==1.6.0",
"pysignalr==1.2.0",
"uipath==2.0.16",
"uipath==2.0.20",
]
classifiers = [
"Development Status :: 3 - Alpha",
Expand Down
3 changes: 3 additions & 0 deletions samples/github-reviewer-agent/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
UIPATH_MCP_SERVER_URL=***
ANTHROPIC_API_KEY=***
UIPATH_MCP_SERVER_URL=<server_url>
66 changes: 66 additions & 0 deletions samples/github-reviewer-agent/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# LangGraph GitHub Reviewer Agent with Claude and GitHub MCP Server

This project demonstrates how to create a GitHub Reviewer Agent using LangGraph with Claude 3.5 Sonnet which connects to the GitHub MCP Server.

## Overview

The agent uses:
- Claude 3.5 Sonnet as the language model
- LangGraph for orchestration
- Connects to a Remote MCP server

## Architecture

```mermaid
---
config:
flowchart:
curve: linear
---
graph TD;
__start__([<p>__start__</p>]):::first
agent(agent)
tools(tools)
__end__([<p>__end__</p>]):::last
__start__ --> agent;
tools --> agent;
agent -.-> tools;
agent -.-> __end__;
classDef default fill:#f2f0ff,line-height:1.2
classDef first fill-opacity:0
classDef last fill:#bfb6fc
```

## Prerequisites

- Python 3.10+
- `langchain-anthropic`
- `langchain-mcp-adapters`
- `langgraph`
- Anthropic API key set as an environment variable

## Installation

```bash
uv venv -p 3.11 .venv
.venv\Scripts\activate
uv sync
```

Set your API keys and MCP Remote Server URL as environment variables in .env

```bash
ANTHROPIC_API_KEY=your_anthropic_api_key
UIPATH_MCP_SERVER_URL=https://alpha.uipath.com/account/tenant/mcp_/mcp/server_slug/sse
```

## Debugging

For debugging issues:

1. Check logs for any connection or runtime errors:
```bash
uipath run '{"messages": [{"role": "user", "content": "Review this PR and provide detailed feedback"}], "owner": "anthropic", "repo": "claude", "pullNumber": 123}'
```


17 changes: 17 additions & 0 deletions samples/github-reviewer-agent/agent.mermaid
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
config:
flowchart:
curve: linear
---
graph TD;
__start__([<p>__start__</p>]):::first
agent(agent)
tools(tools)
__end__([<p>__end__</p>]):::last
__start__ --> agent;
tools --> agent;
agent -.-> tools;
agent -.-> __end__;
classDef default fill:#f2f0ff,line-height:1.2
classDef first fill-opacity:0
classDef last fill:#bfb6fc
7 changes: 7 additions & 0 deletions samples/github-reviewer-agent/langgraph.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"dependencies": ["."],
"graphs": {
"agent": "./main.py:make_graph"
},
"env": ".env"
}
46 changes: 46 additions & 0 deletions samples/github-reviewer-agent/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import os
from contextlib import asynccontextmanager

import dotenv
from langchain_anthropic import ChatAnthropic
from langchain_mcp_adapters.client import MultiServerMCPClient
from langgraph.prebuilt import create_react_agent
from langgraph.prebuilt.chat_agent_executor import AgentState

dotenv.load_dotenv()


class PullRequestState(AgentState):
owner: str
repo: str
pullNumber: int


@asynccontextmanager
async def make_graph():
async with MultiServerMCPClient() as client:
await client.connect_to_server_via_sse(
server_name="github-mcp-server",
url=os.getenv("UIPATH_MCP_SERVER_URL"),
headers={"Authorization": f"Bearer {os.getenv('UIPATH_ACCESS_TOKEN')}"},
timeout=60,
)

tools = client.get_tools()
print(tools)
model = ChatAnthropic(model="claude-3-5-sonnet-latest")

def pr_prompt(state: PullRequestState):
"""Create a prompt that incorporates PR data."""
system_message = f"""You are a professional Python developer with experience in code reviews.
You are reviewing a PR for repo: {state["owner"]}/{state["repo"]}, PR #{state["pullNumber"]}.
Your task is to analyze the code changes in the PR and provide feedback.
Use the available tools to fetch PR details and provide a thorough code review."""

return [{"role": "system", "content": system_message}] + state["messages"]

graph = create_react_agent(
model, tools=tools, state_schema=PullRequestState, prompt=pr_prompt
)

yield graph
16 changes: 16 additions & 0 deletions samples/github-reviewer-agent/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[project]
name = "github-reviewer-agent"
version = "0.0.3"
description = "An automated agent that reviews GitHub pull requests and provides feedback"
authors = [{ name = "Cristi Pufu", email = "[email protected]" }]
dependencies = [
"uipath-langchain==0.0.93",
"langchain>=0.1.0",
"langchain-anthropic>=0.0.1",
"langgraph>=0.3.21",
"python-dotenv>=1.0.0",
"requests>=2.31.0",
"anthropic>=0.8.0",
"langchain-mcp-adapters>=0.0.3"
]
requires-python = ">=3.10"
Loading