From b20f32b5051172e819edc36b10bb102769870a05 Mon Sep 17 00:00:00 2001 From: f-trycua Date: Sun, 6 Apr 2025 17:52:37 -0700 Subject: [PATCH] Fix mcp install script --- libs/mcp-server/README.md | 8 +++--- libs/mcp-server/scripts/run_mcp_server.sh | 30 +++++++++++++---------- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/libs/mcp-server/README.md b/libs/mcp-server/README.md index aa05e2a30..ae3e4ec31 100644 --- a/libs/mcp-server/README.md +++ b/libs/mcp-server/README.md @@ -36,7 +36,7 @@ This will install: 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)" +curl -fsSL https://raw.githubusercontent.com/trycua/cua/main/libs/mcp-server/scripts/run_mcp_server.sh | bash ``` Or use the script directly in your MCP configuration like this: @@ -45,7 +45,7 @@ Or use the script directly in your MCP configuration like this: "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)"], + "args": ["-c", "curl -fsSL https://raw.githubusercontent.com/trycua/cua/main/libs/mcp-server/scripts/run_mcp_server.sh | bash"], "env": { "CUA_AGENT_LOOP": "OMNI", "CUA_MODEL_PROVIDER": "ANTHROPIC", @@ -66,7 +66,7 @@ To use with Claude Desktop, add an entry to your Claude Desktop configuration (` "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)"], + "args": ["-c", "curl -fsSL https://raw.githubusercontent.com/trycua/cua/main/libs/mcp-server/scripts/run_mcp_server.sh | bash"], "env": { "CUA_AGENT_LOOP": "OMNI", "CUA_MODEL_PROVIDER": "ANTHROPIC", @@ -94,7 +94,7 @@ The configuration format is similar to Claude Desktop's: "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)"], + "args": ["-c", "curl -fsSL https://raw.githubusercontent.com/trycua/cua/main/libs/mcp-server/scripts/run_mcp_server.sh | bash"], "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 index f86bec099..e3556b166 100755 --- a/libs/mcp-server/scripts/run_mcp_server.sh +++ b/libs/mcp-server/scripts/run_mcp_server.sh @@ -31,26 +31,30 @@ 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 +# Check if mcp_server package is installed +if ! package_installed mcp_server; then + echo "🔄 mcp_server package is not installed. Installing now..." + pip3 install --user -e . if [ $? -ne 0 ]; then - echo "❌ Failed to install cua-mcp-server. Please check the error messages above." + echo "❌ Failed to install mcp_server. Please check the error messages above." exit 1 fi - echo "✅ cua-mcp-server installed successfully" + echo "✅ mcp_server installed successfully" else - echo "✅ cua-mcp-server is already installed" + echo "✅ mcp_server is already installed" fi -# Create scripts directory if it doesn't exist -mkdir -p ~/.cua/scripts +# Run the Python module directly +echo "🚀 Starting MCP server..." -# Update PATH to include user's local bin directory where pip might have installed the script -export PATH="$HOME/.local/bin:$PATH" +# Get the directory of this script +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +PROJECT_ROOT="$(dirname "$(dirname "$SCRIPT_DIR")")" -echo "🚀 Starting cua-mcp-server..." -exec cua-mcp-server \ No newline at end of file +# Add the necessary paths to PYTHONPATH +export PYTHONPATH="$PROJECT_ROOT:$PYTHONPATH" + +# Run the server module directly +python3 -m mcp_server.server \ No newline at end of file