How to Automate Your Mac or Linux with CUA MCP and Claude 3.7

Learn how to set up the CUA MCP server to automate any Mac or Linux system with Claude 3.7. This step-by-step guide covers installation, configuration, and real-world automation—perfect for developers seeking secure, local AI-powered productivity.

Ashley Goolam

Ashley Goolam

31 January 2026

How to Automate Your Mac or Linux with CUA MCP and Claude 3.7

Looking to supercharge your local automation on macOS or Linux? The open-source CUA (Computer-Use Agent) framework, paired with its MCP server, allows AI agents like Claude 3.7 to control your computer through natural language—securely and without cloud dependencies. This hands-on tutorial walks API developers and backend engineers through setting up the CUA MCP server on Apple Silicon or Linux, testing it with real-world automation, and integrating it with Claude Desktop. No advanced skills required—just curiosity and a willingness to try something new.

💡 Looking for a better API testing workflow? Apidog generates beautiful API documentation and offers an all-in-one platform for developer teams, boosting productivity while replacing Postman at a more affordable price.

button

What Is CUA and the MCP Server?

CUA (Computer-Use Agent) is an open-source automation framework that empowers AI agents to interact directly with your computer. It supports actions like screen control, keyboard/mouse automation, and even launching sandboxed virtual machines—optimized for Apple Silicon Macs and Linux.

The CUA MCP server (Model Context Protocol) acts as a secure bridge, allowing AI models (like Claude) to issue system-level commands via natural language. This keeps your automation local and private—ideal for developer teams concerned with data security.


Prerequisites: Preparing Your System for CUA MCP

Before installing CUA MCP, ensure your environment meets these requirements:

Tip: Missing a dependency? Install it before continuing to avoid setup issues.


Step 1: Set Up Your Project Environment

Organize your workspace for a clean install:

mkdir cua-mcp-test
cd cua-mcp-test

This keeps your CUA MCP files isolated for easy management.


Step 2: Clone and Prepare the CUA Repository

Grab the latest CUA codebase:

git clone https://github.com/trycua/cua.git
cd cua

Now, create a dedicated Python virtual environment to avoid dependency conflicts:

python -m venv venv
# Activate the environment
# On Mac/Linux:
source venv/bin/activate
# On Windows:
venv\Scripts\activate

A (venv) prefix in your terminal indicates you're working in the isolated environment.


Step 3: Open Your Project in VS Code

For optimal Python development, open the project in Visual Studio Code:

code .

If you don't have VS Code, download it here. Its Python integration streamlines scripting and debugging.


Step 4: Install the CUA MCP Server

Quick Install via Script

Automate installation with the official script:

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

This script will:

Note: Installation may take several minutes as dependencies are downloaded.

Manual Installation (If Needed)

If the script fails, install manually:

pip install cua-mcp-server

This installs the MCP server and all required agent dependencies.

Confirm Docker is Running

The MCP server depends on Docker. Check with:

docker ps

If Docker isn’t running, start it via Docker Desktop (Mac) or:

sudo systemctl start docker

(on Linux).


Step 5: Configure CUA MCP Server for Claude Desktop

Integrate CUA with Claude 3.7 using your Anthropic API key.

claude desktop

1. Obtain Your Anthropic API Key

2. Update Claude Desktop Configuration

Open (or create) ~/.config/claude-desktop/claude_desktop_config.json and add:

{
  "mcpServers": {
    "cua-agent": {
      "command": "/bin/bash",
      "args": ["~/.cua/start_mcp_server.sh"],
      "env": {
        "CUA_AGENT_LOOP": "OMNI",
        "CUA_MODEL_PROVIDER": "ANTHROPIC",
        "CUA_MODEL_NAME": "claude-3-7-sonnet-20250219",
        "ANTHROPIC_API_KEY": "your-api-key"
      }
    }
  }
}

Replace "your-api-key" with your actual Anthropic API key.

3. Optional: Cursor Integration

Want to control your computer with Cursor? Add a similar MCP config to .cursor/mcp.json (project-specific) or ~/.cursor/mcp.json (global). Then, in Cursor’s Agent chat, prompt:
“Use the computer control tools to open Safari.”


Step 6: Test CUA MCP Server with Claude 3.7

Let's validate your setup by asking Claude to open a terminal and list directory contents.

1. Create a Test Script

In VS Code, save the following as test.py:

import os
import asyncio
from computer import Computer
from agent import ComputerAgent, LLM, AgentLoop, LLMProvider

async def run_task() -> str:
    async with Computer(verbosity='DEBUG') as computer:
        agent = ComputerAgent(
            computer=computer,
            loop=AgentLoop.OMNI,
            model=LLM(
                provider=LLMProvider.ANTHROPIC,
                model_name="claude-3-7-sonnet-20250219",
                api_key="your-api-key"
            )
        )
        task = "Open a terminal and list the contents of the current directory"
        async for result in agent.run(task):
            return result

async def main():
    result = await run_task()
    print("\n\nResult:", result)

if __name__ == "__main__":
    asyncio.run(main())

Replace "your-api-key" with your Anthropic key, or set it as the ANTHROPIC_API_KEY environment variable.

2. Select Python Interpreter in VS Code

3. Run Your Script

With Docker running and configs set, execute:

python test.py

Claude 3.7, via CUA MCP, will open a terminal and execute ls.
You should see a result like:
Result: cua test.py venv

If you encounter issues, double-check:

4. Test Directly in Claude Desktop

Open Claude Desktop and type:
“Open a terminal and list the contents of the current directory.”
Claude will use CUA MCP to automate the action and display results in chat.

cua result output


CUA MCP Server Tools: What Can You Automate?

CUA MCP exposes two main tools to AI agents like Claude 3.7:

Sample Prompts:

Claude automatically routes these requests to CUA for execution.

For more advanced use cases, see:
How to Use MCP Servers in Windsurf AI: Unlock Seamless Automation


Developer Insights: Using CUA MCP with Claude 3.7

What stands out after hands-on use:

If you run into trouble, check the CUA GitHub issues for known fixes or review your Docker/API settings.


Pro Tips for Reliable CUA MCP Automation


Final Thoughts: Unlock Local AI Automation for Developers

With CUA MCP and Claude 3.7, you can automate your Mac or Linux system using natural language—everything stays private and under your control. Try automating app launches, file management, or even building your own coding assistant. For more advanced API workflows, Apidog delivers an integrated, all-in-one platform for teams seeking efficiency and seamless collaboration.

button

apidog

Explore more

How to Secure NPM Dependencies ? A Complete Supply Chain Security Guide for API Developers

How to Secure NPM Dependencies ? A Complete Supply Chain Security Guide for API Developers

Protect your API projects from npm supply chain attacks with 7 layers of defense: lockfiles, script blocking, provenance, behavioral analysis, and dependency reduction.

1 April 2026

Twilio's API: The Other Gold Standard and Why It's Stripe's True Equal

Twilio's API: The Other Gold Standard and Why It's Stripe's True Equal

How Twilio turned phone calls and text messages into elegant REST resources.

1 April 2026

What the Claude Code Source Leak Reveals About AI Coding Tool Architecture

What the Claude Code Source Leak Reveals About AI Coding Tool Architecture

Claude Code's source leaked via npm, revealing fake tools, frustration detection, undercover mode, and KAIROS autonomous agent. Here's what API developers need to know.

1 April 2026

Practice API Design-first in Apidog

Discover an easier way to build and use APIs