Back to Blog
Tutorial

Sarah Chen7 min
⌘+D

You want an agent that can open a browser, fill a form, and click a button, but you do not want to manage screenshots or HTTP calls yourself. The Coasty MCP server lets you drive a computer use agent from Cursor or Claude Desktop with simple function calls, while the server handles screen capture, vision predictions, and action execution.

How it works

The MCP server exposes a few tools that map directly to Coasty's endpoints. Claude Desktop or Cursor imports the server and can call tools like start_machine, post_task_run, and list_runs. Behind the scenes the server uses your COASTY_API_KEY to call POST /v1/runs with machine_id and task, then streams events via GET /v1/runs/{id}/events. You can also call POST /v1/predict directly for low‑level control with a screenshot and instruction, billed $0.05 per predict call.

python
import os
import asyncio
from anthropic import AsyncAnthropic

COASTY_API_KEY = os.getenv("COASTY_API_KEY")

async def main():
    client = AsyncAnthropic(api_key=os.environ.get("ANTHROPIC_API_KEY"))
    # Start a task run on Coasty using MCP-style tool call
    response = await client.beta.tools.run(
        model="claude-sonnet-4-20250514",
        tool_choice={"type": "tool", "name": "coasty_task_run"},
        tools=[
            {
                "name": "coasty_task_run",
                "description": "Start a Coasty computer use task run on a remote machine.",
                "input_schema": {
                    "type": "object",
                    "properties": {
                        "machine_id": {"type": "string"},
                        "task": {"type": "string"},
                        "cua_version": {"type": "string", "default": "v3"},
                        "max_steps": {"type": "integer", "default": 50},
                        "deadline_seconds": {"type": "integer", "default": 600}
                    }
                }
            }
        ],
        tool_input={
            "machine_id": "my-prod-vm-1",
            "task": "Open Chrome, navigate to https://example.com, and click the login button.",
            "cua_version": "v3",
            "max_steps": 50
        }
    )
    print(response.content[0].text)

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

MCP tool contracts

  • coasty_start_machine: Provision a cloud VM that the agent can drive, returning machine_id.
  • coasty_task_run: POST /v1/runs with machine_id and task, plus optional instructions and cua_version (default v3, v4 adds a verifier).
  • coasty_list_runs: GET /v1/runs to see queued, running, succeeded, failed, cancelled, or timed_out runs.
  • coasty_cancel_run: POST /v1/runs/{id}/cancel to abort a running task.
  • coasty_resume_run: POST /v1/runs/{id}/resume to continue a paused run with awaiting_human.
  • coasty_stream_events: GET /v1/runs/{id}/events (SSE) to receive real‑time status and action logs.
  • coasty_predict: POST /v1/predict with a base64 screenshot and instruction, billed $0.05 per call. Returns actions and status ("done" when complete).
  • All tools require a valid COASTY_API_KEY via environment variable, never hardcode keys.

Use the MCP server in Cursor or Claude Desktop to call cozy_task_run, and let Coasty stream events back to you via SSE.

Where this beats brittle automation

Traditional automation relies on selectors that break when UI changes. A computer use agent reads the screen, understands context, and clicks the visually correct button. The Coasty computer use API models human behavior, so it can handle dynamic layouts, multi-step workflows, and mixed desktop/browser environments. You do not need to maintain brittle selectors or brittle APIs. You simply describe what to do in plain language, and the agent figures out the UI.

Add a Coasty computer use agent to your Cursor or Claude workflow. Build agents that see screens, click buttons, and complete multi-step tasks end-to-end. Create a key at https://coasty.ai/developers to start.

© 2026 Coasty

Backed byYCombinator