From 3ec479368b6af825eeff9a5b35f797fdb6b762da Mon Sep 17 00:00:00 2001 From: Dillon DuPont Date: Thu, 1 May 2025 15:04:20 -0700 Subject: [PATCH] changed dev guide to use a .sh script --- libs/mcp-server/README.md | 22 +++++++++++---------- libs/mcp-server/scripts/start_mcp_server.sh | 14 +++++++++++++ 2 files changed, 26 insertions(+), 10 deletions(-) create mode 100755 libs/mcp-server/scripts/start_mcp_server.sh diff --git a/libs/mcp-server/README.md b/libs/mcp-server/README.md index 86430e95..736ab364 100644 --- a/libs/mcp-server/README.md +++ b/libs/mcp-server/README.md @@ -83,10 +83,9 @@ If you want to develop with the cua-mcp-server directly without installation, yo { "mcpServers": { "cua-agent": { - "command": "/Users/YOURUSERNAME/cua/.venv/bin/python", - "args": ["-m", "mcp_server.server"], + "command": "/bin/bash", + "args": ["~/cua/libs/mcp-server/scripts/start_mcp_server.sh"], "env": { - "PYTHONPATH": "/Users/YOURUSERNAME/cua/libs/mcp-server:/Users/YOURUSERNAME/cua/libs/agent:/Users/YOURUSERNAME/cua/libs/computer:/Users/YOURUSERNAME/cua/libs/core:/Users/YOURUSERNAME/cua/libs/pylume", "CUA_AGENT_LOOP": "UITARS", "CUA_MODEL_PROVIDER": "OAICOMPAT", "CUA_MODEL_NAME": "ByteDance-Seed/UI-TARS-1.5-7B", @@ -98,19 +97,22 @@ If you want to develop with the cua-mcp-server directly without installation, yo } ``` -To see the logs: -``` -tail -n 20 -f ~/Library/Logs/Claude/mcp*.log -``` - This configuration: -- Uses your local Python virtual environment to run the server module directly -- Sets the Python path to include all necessary library dependencies +- Uses the start_mcp_server.sh script which automatically sets up the Python path and runs the server module - Works with Claude Desktop, Cursor, or any other MCP client - Automatically uses your development code without requiring installation Just add this to your MCP client's configuration and it will use your local development version of the server. +### Troubleshooting + +If you get a `/bin/bash: ~/cua/libs/mcp-server/scripts/start_mcp_server.sh: No such file or directory` error, try changing the path to the script to be absolute instead of relative. + +To see the logs: +``` +tail -n 20 -f ~/Library/Logs/Claude/mcp*.log +``` + ## 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/`): diff --git a/libs/mcp-server/scripts/start_mcp_server.sh b/libs/mcp-server/scripts/start_mcp_server.sh new file mode 100755 index 00000000..17fd9dab --- /dev/null +++ b/libs/mcp-server/scripts/start_mcp_server.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +set -e + +# Set the CUA repository path based on script location +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +CUA_REPO_DIR="$( cd "$SCRIPT_DIR/../../.." &> /dev/null && pwd )" +PYTHON_PATH="${CUA_REPO_DIR}/.venv/bin/python" + +# Set Python path to include all necessary libraries +export PYTHONPATH="${CUA_REPO_DIR}/libs/mcp-server:${CUA_REPO_DIR}/libs/agent:${CUA_REPO_DIR}/libs/computer:${CUA_REPO_DIR}/libs/core:${CUA_REPO_DIR}/libs/pylume" + +# Run the MCP server directly as a module +$PYTHON_PATH -m mcp_server.server \ No newline at end of file