diff --git a/libs/mcp-server/README.md b/libs/mcp-server/README.md index 899d1c58..aa05e2a3 100644 --- a/libs/mcp-server/README.md +++ b/libs/mcp-server/README.md @@ -31,6 +31,33 @@ This will install: - CUA agent and computer dependencies - An executable `cua-mcp-server` script in your PATH +## Easy Setup Script + +If you want to simplify installation, you can use this one-liner to download and run a setup script: + +```bash +/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/trycua/cua/main/libs/mcp-server/scripts/run_mcp_server.sh)" +``` + +Or use the script directly in your MCP configuration like this: + +```json +"mcpServers": { + "cua-agent": { + "command": "/bin/bash", + "args": ["-c", "$(curl -fsSL https://raw.githubusercontent.com/trycua/cua/main/libs/mcp-server/scripts/run_mcp_server.sh)"], + "env": { + "CUA_AGENT_LOOP": "OMNI", + "CUA_MODEL_PROVIDER": "ANTHROPIC", + "CUA_MODEL_NAME": "claude-3-opus-20240229", + "ANTHROPIC_API_KEY": "your-api-key" + } + } +} +``` + +This script will automatically check if cua-mcp-server is installed, install it if needed, and run it. + ## Claude Desktop Integration To use with Claude Desktop, add an entry to your Claude Desktop configuration (`claude_desktop_config.json`, typically found in `~/.config/claude-desktop/`): @@ -38,8 +65,8 @@ To use with Claude Desktop, add an entry to your Claude Desktop configuration (` ```json "mcpServers": { "cua-agent": { - "command": "cua-mcp-server", - "args": [], + "command": "/bin/bash", + "args": ["-c", "$(curl -fsSL https://raw.githubusercontent.com/trycua/cua/main/libs/mcp-server/scripts/run_mcp_server.sh)"], "env": { "CUA_AGENT_LOOP": "OMNI", "CUA_MODEL_PROVIDER": "ANTHROPIC", @@ -66,8 +93,8 @@ The configuration format is similar to Claude Desktop's: { "mcpServers": { "cua-agent": { - "command": "cua-mcp-server", - "args": [], + "command": "/bin/bash", + "args": ["-c", "$(curl -fsSL https://raw.githubusercontent.com/trycua/cua/main/libs/mcp-server/scripts/run_mcp_server.sh)"], "env": { "CUA_AGENT_LOOP": "OMNI", "CUA_MODEL_PROVIDER": "ANTHROPIC", diff --git a/libs/mcp-server/scripts/run_mcp_server.sh b/libs/mcp-server/scripts/run_mcp_server.sh new file mode 100755 index 00000000..f86bec09 --- /dev/null +++ b/libs/mcp-server/scripts/run_mcp_server.sh @@ -0,0 +1,56 @@ +#!/bin/bash + +set -e + +# Function to check if a command exists +command_exists() { + command -v "$1" >/dev/null 2>&1 +} + +# Function to check if a Python package is installed +package_installed() { + python3 -c "import importlib.util; print(importlib.util.find_spec('$1') is not None)" | grep -q "True" +} + +echo "🚀 CUA MCP Server Setup Script" +echo "=============================" + +# Check if Python is installed +if ! command_exists python3; then + echo "❌ Python 3 is not installed. Please install Python 3 and try again." + exit 1 +fi + +echo "✅ Python 3 is installed" + +# Check if pip is installed +if ! command_exists pip3; then + echo "❌ pip3 is not installed. Please install pip and try again." + exit 1 +fi + +echo "✅ pip3 is installed" + +# Check if cua-mcp-server is installed +if ! package_installed mcp_server || ! command_exists cua-mcp-server; then + echo "🔄 cua-mcp-server is not installed. Installing now..." + pip3 install --user cua-mcp-server + + if [ $? -ne 0 ]; then + echo "❌ Failed to install cua-mcp-server. Please check the error messages above." + exit 1 + fi + + echo "✅ cua-mcp-server installed successfully" +else + echo "✅ cua-mcp-server is already installed" +fi + +# Create scripts directory if it doesn't exist +mkdir -p ~/.cua/scripts + +# Update PATH to include user's local bin directory where pip might have installed the script +export PATH="$HOME/.local/bin:$PATH" + +echo "🚀 Starting cua-mcp-server..." +exec cua-mcp-server \ No newline at end of file