Files
computer/libs/python/mcp-server
Adam 3274cfafe7 add concurrent session management and resource isolation
Implement concurrent session management for MCP server with:

- SessionManager with computer instance pooling
- Concurrent task execution support
- New tools: get_session_stats, cleanup_session
- Graceful shutdown and resource cleanup
- Fix nested asyncio event loop issues
- Add comprehensive tests and documentation

Enables multiple concurrent clients with proper resource isolation
while maintaining backward compatibility.
2025-10-06 18:37:10 -04:00
..

Shows my svg

Python macOS Discord PyPI

cua-mcp-server

cua-mcp-server is an MCP server for the Computer-Use Agent (CUA). It enables CUA to run through MCP clients such as Claude Desktop and Cursor.

Prerequisites

Install

Download and run the installation script:

curl -fsSL https://raw.githubusercontent.com/trycua/cua/main/libs/python/mcp-server/scripts/install_mcp_server.sh | bash

Add this to your MCP client configuration:

{
  "mcpServers": {
    "cua-agent": {
      "command": "/usr/bin/env",
      "args": [
        "bash", "-lc",
        "export CUA_MODEL_NAME='anthropic/claude-3-5-sonnet-20241022'; ~/.cua/start_mcp_server.sh"
      ]
    }
  }
}

Development (run from a local checkout)

Use an absolute path to the repository root in the arguments below.

{
  "mcpServers": {
    "cua-agent": {
      "command": "/usr/bin/env",
      "args": [
        "bash", "-lc",
        "export CUA_MODEL_NAME='huggingface-local/ByteDance-Seed/UI-TARS-1.5-7B'; /Users/your-username/Documents/GitHub/cua/libs/python/mcp-server/scripts/start_mcp_server.sh"
      ]
    }
  }
}

Notes:

  • Replace /Users/your-username/Documents/GitHub/cua with the absolute path to your clone.
  • The script sets PYTHONPATH for local libs and runs the server module.

Quick Start

After configuring your MCP client, restart it and invoke one of these tools:

  • Take a screenshot
{
  "tool": "screenshot_cua",
  "args": {}
}
  • Run a task
{
  "tool": "run_cua_task",
  "args": { "task": "Open Safari and search for University of Toronto" }
}

Expected results:

  • Assistant messages streamed during execution
  • A final screenshot image

Documentation

Troubleshooting

Server reports disconnected in MCP client:

  • Use an absolute path in the args command.
  • Launch via /usr/bin/env bash -lc so the shell initializes and expands paths.
  • Run the script manually to verify:
    /usr/bin/env bash -lc '/Users/your-username/Documents/GitHub/cua/libs/python/mcp-server/scripts/start_mcp_server.sh'
    

pip not found in venv:

python3 -m ensurepip --upgrade
python3 -m pip install -U pip setuptools wheel

Pydantic schema error related to Image:

python3 -m pip install -U "mcp>=1.2.0" "fastmcp>=0.4.7" "pydantic>=2.7,<2.12"

If issues persist, capture logs from your MCP client and the server startup script for diagnosis.