chore: import upstream snapshot with attribution
CI: cua-driver distro-compat matrix / debian:12 (glibc 2.36) (push) Has been cancelled
CI: SPDX Headers / Check SPDX headers (warn-only) (push) Has been cancelled
CD: Docs MCP Server / build (linux/amd64) (push) Has been cancelled
CD: Docs MCP Server / build (linux/arm64) (push) Has been cancelled
CD: Docs MCP Server / merge (push) Has been cancelled
CI: cua-driver distro-compat matrix / Resolve release version (push) Has been cancelled
CI: cua-driver distro-compat matrix / fedora:41 (glibc 2.40) (push) Has been cancelled
CI: cua-driver distro-compat matrix / rockylinux:9 (glibc 2.34) (push) Has been cancelled
CI: cua-driver distro-compat matrix / ubuntu:22.04 (glibc 2.35) (push) Has been cancelled
CI: cua-driver distro-compat matrix / ubuntu:24.04 (glibc 2.39) (push) Has been cancelled
CI: cua-driver distro-compat matrix / Distro compat summary (push) Has been cancelled
CI: Rust Linux unit / Rust Linux unit and compile (push) Has been cancelled
CI: Rust Windows unit / Rust Windows unit and compile (push) Has been cancelled
CI: Nix Linux Rust source / Nix / compositor build (push) Has been cancelled
CI: Nix Linux Rust source / Nix / driver package (push) Has been cancelled
CI: Nix Linux Rust source / Nix / Rust unit tests (push) Has been cancelled

This commit is contained in:
wehub-resource-sync
2026-07-13 13:03:19 +08:00
commit 91e75e620b
3227 changed files with 1307078 additions and 0 deletions
+73
View File
@@ -0,0 +1,73 @@
#!/bin/bash
set -e
# Create the ~/.cua directory if it doesn't exist
mkdir -p "$HOME/.cua"
# Create start_mcp_server.sh script in ~/.cua directory
cat > "$HOME/.cua/start_mcp_server.sh" << 'EOF'
#!/bin/bash
set -e
# Function to check if a directory is writable
is_writable() {
[ -w "$1" ]
}
# Function to check if a command exists (silent)
command_exists() {
command -v "$1" >/dev/null 2>&1
}
# Find a writable directory for the virtual environment
if is_writable "$HOME"; then
VENV_DIR="$HOME/.cua-mcp-venv"
elif is_writable "/tmp"; then
VENV_DIR="/tmp/.cua-mcp-venv"
else
# Try to create a directory in the current working directory
TEMP_DIR="$(pwd)/.cua-mcp-venv"
if is_writable "$(pwd)"; then
VENV_DIR="$TEMP_DIR"
else
echo "Error: Cannot find a writable directory for the virtual environment." >&2
exit 1
fi
fi
# Check if Python is installed
if ! command_exists python3; then
echo "Error: Python 3 is not installed." >&2
exit 1
fi
# Check if pip is installed
if ! command_exists pip3; then
echo "Error: pip3 is not installed." >&2
exit 1
fi
# Create virtual environment if it doesn't exist
if [ ! -d "$VENV_DIR" ]; then
# Redirect output to prevent JSON parsing errors in Claude
python3 -m venv "$VENV_DIR" >/dev/null 2>&1
fi
# Activate virtual environment
source "$VENV_DIR/bin/activate"
# Always install/upgrade the latest version of cua-mcp-server
pip install --upgrade "cua-mcp-server"
# Run the MCP server with isolation from development paths
cd "$VENV_DIR" # Change to venv directory to avoid current directory in path
python3 -c "from mcp_server.server import main; main()"
EOF
# Make the script executable
chmod +x "$HOME/.cua/start_mcp_server.sh"
echo "MCP server startup script created at $HOME/.cua/start_mcp_server.sh"
+43
View File
@@ -0,0 +1,43 @@
#!/usr/bin/env bash
set -Eeuo pipefail
# --- Resolve repo root from this script's location ---
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
CUA_REPO_DIR="$( cd "$SCRIPT_DIR/../../../.." &> /dev/null && pwd )"
# --- Choose a Python interpreter (prefer repo-root venv) ---
CANDIDATES=(
"$CUA_REPO_DIR/.venv/bin/python"
"$CUA_REPO_DIR/libs/.venv/bin/python"
"$(command -v python3 || true)"
"$(command -v python || true)"
)
PYTHON_PATH=""
for p in "${CANDIDATES[@]}"; do
if [[ -n "$p" && -x "$p" ]]; then
PYTHON_PATH="$p"
break
fi
done
if [[ -z "${PYTHON_PATH}" ]]; then
>&2 echo "[cua-mcp] ERROR: No suitable Python found. Tried:"
for p in "${CANDIDATES[@]}"; do >&2 echo " - $p"; done
>&2 echo "[cua-mcp] Tip: create venv: python3 -m venv $CUA_REPO_DIR/.venv && \"$CUA_REPO_DIR/.venv/bin/pip\" install -e \"$CUA_REPO_DIR/libs/python/mcp-server\""
exit 127
fi
# --- Export PYTHONPATH so module imports work during dev ---
export PYTHONPATH="$CUA_REPO_DIR/libs/python/mcp-server:$CUA_REPO_DIR/libs/python/agent:$CUA_REPO_DIR/libs/python/computer:$CUA_REPO_DIR/libs/python/core"
# --- Helpful startup log for Claude's mcp.log ---
>&2 echo "[cua-mcp] using python: $PYTHON_PATH"
>&2 echo "[cua-mcp] repo dir : $CUA_REPO_DIR"
>&2 echo "[cua-mcp] PYTHONPATH : $PYTHONPATH"
if [[ -n "${CUA_MODEL_NAME:-}" ]]; then
>&2 echo "[cua-mcp] CUA_MODEL_NAME=$CUA_MODEL_NAME"
fi
# --- Run the MCP server module ---
exec "$PYTHON_PATH" -m mcp_server.server
+46
View File
@@ -0,0 +1,46 @@
#!/usr/bin/env bash
# Test script to run the MCP server and see all errors
# This is for LOCAL DEVELOPMENT ONLY - helps debug issues before connecting from Claude
set -e # Exit on error, but we'll see the error
echo "=========================================="
echo "CUA MCP Server - Development Test"
echo "=========================================="
echo ""
# Get the repo root
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
CUA_REPO_DIR="$( cd "$SCRIPT_DIR/../../../.." &> /dev/null && pwd )"
echo "Repo directory: $CUA_REPO_DIR"
# Find Python
if [ -f "$CUA_REPO_DIR/.venv/bin/python" ]; then
PYTHON="$CUA_REPO_DIR/.venv/bin/python"
elif [ -f "$CUA_REPO_DIR/libs/.venv/bin/python" ]; then
PYTHON="$CUA_REPO_DIR/libs/.venv/bin/python"
else
PYTHON="python3"
fi
echo "Using Python: $PYTHON"
$PYTHON --version
echo ""
# Set up environment
export PYTHONPATH="$CUA_REPO_DIR/libs/python/mcp-server:$CUA_REPO_DIR/libs/python/agent:$CUA_REPO_DIR/libs/python/computer:$CUA_REPO_DIR/libs/python/core"
export CUA_MODEL_NAME="${CUA_MODEL_NAME:-anthropic/claude-sonnet-4-5-20250929}"
echo "Environment:"
echo " PYTHONPATH: $PYTHONPATH"
echo " CUA_MODEL_NAME: $CUA_MODEL_NAME"
echo ""
echo "=========================================="
echo "Starting MCP server..."
echo "Press Ctrl+C to stop"
echo "=========================================="
echo ""
# Run the server WITHOUT redirecting stderr, so we can see all errors
exec "$PYTHON" -m mcp_server.server