diff --git a/libs/mcp-server/README.md b/libs/mcp-server/README.md index ae3e4ec3..6459931d 100644 --- a/libs/mcp-server/README.md +++ b/libs/mcp-server/README.md @@ -42,15 +42,17 @@ curl -fsSL https://raw.githubusercontent.com/trycua/cua/main/libs/mcp-server/scr 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 | bash"], - "env": { - "CUA_AGENT_LOOP": "OMNI", - "CUA_MODEL_PROVIDER": "ANTHROPIC", - "CUA_MODEL_NAME": "claude-3-opus-20240229", - "ANTHROPIC_API_KEY": "your-api-key" +{ + "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 | bash"], + "env": { + "CUA_AGENT_LOOP": "OMNI", + "CUA_MODEL_PROVIDER": "ANTHROPIC", + "CUA_MODEL_NAME": "claude-3-7-sonnet-20250219", + "ANTHROPIC_API_KEY": "your-api-key" + } } } } @@ -62,22 +64,6 @@ This script will automatically check if cua-mcp-server is installed, install it To use with Claude Desktop, add an entry to your Claude Desktop configuration (`claude_desktop_config.json`, typically found in `~/.config/claude-desktop/`): -```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 | bash"], - "env": { - "CUA_AGENT_LOOP": "OMNI", - "CUA_MODEL_PROVIDER": "ANTHROPIC", - "CUA_MODEL_NAME": "claude-3-opus-20240229", - "ANTHROPIC_API_KEY": "your-api-key", - "PYTHONIOENCODING": "utf-8" - } - } -} -``` - For more information on MCP with Claude Desktop, see the [official MCP User Guide](https://modelcontextprotocol.io/quickstart/user). ## Cursor Integration @@ -87,26 +73,6 @@ To use with Cursor, add an MCP configuration file in one of these locations: - **Project-specific**: Create `.cursor/mcp.json` in your project directory - **Global**: Create `~/.cursor/mcp.json` in your home directory -The configuration format is similar to Claude Desktop's: - -```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 | bash"], - "env": { - "CUA_AGENT_LOOP": "OMNI", - "CUA_MODEL_PROVIDER": "ANTHROPIC", - "CUA_MODEL_NAME": "claude-3-7-sonnet-20250219", - "ANTHROPIC_API_KEY": "your-api-key", - "PYTHONPATH": "/path/to/your/cua/installation" - } - } - } -} -``` - After configuration, you can simply tell Cursor's Agent to perform computer tasks by explicitly mentioning the CUA agent, such as "Use the computer control tools to open Safari." For more information on MCP with Cursor, see the [official Cursor MCP documentation](https://docs.cursor.com/context/model-context-protocol). diff --git a/libs/mcp-server/scripts/run_mcp_server.sh b/libs/mcp-server/scripts/run_mcp_server.sh index 8172b2e5..9e2667de 100755 --- a/libs/mcp-server/scripts/run_mcp_server.sh +++ b/libs/mcp-server/scripts/run_mcp_server.sh @@ -22,23 +22,11 @@ if ! command_exists pip3; then exit 1 fi -# Get the directory of this script -SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" -PROJECT_ROOT="$(dirname "$(dirname "$SCRIPT_DIR")")" - -# Add the necessary paths to PYTHONPATH -export PYTHONPATH="$PROJECT_ROOT:$PYTHONPATH" - -# Change to project directory -cd "$PROJECT_ROOT" 2>/dev/null - # Check if mcp_server package is installed if ! package_installed mcp_server; then - # Check if setup.py or pyproject.toml exists - if [ -f "setup.py" ] || [ -f "pyproject.toml" ]; then - pip3 install --quiet --user -e . >/dev/null 2>&1 - fi + pip3 install cua-mcp-server >/dev/null 2>&1 fi # Run the server module directly - this is the only thing that should produce output -exec python3 -m mcp_server.server \ No newline at end of file +exec python3 -c "from mcp_server.server import main; main()" +