Asctrl

适用于任何 AI agent 的计算机操作:查看并操作 Windows PC,可在本地操作,也可通过自托管中继远程操作。计划和程序在 PC 本机运行(五项操作约需 0.44 秒),通过 UI Automation 根据控件文本定位控件。

文档

Asctrl

A computer-use framework for any AI agent: operate Windows PCs, locally or remotely.

English | 简体中文

MCP · Streamable HTTP · JSON Lines · Remote control · MIT License

Asctrl MCP server

Asctrl is a computer-use framework for any AI agent. Plug it into the agent you already use, over MCP, Streamable HTTP or a plain JSON-lines subprocess, and that agent can see and operate a Windows PC: the one it runs on, or one across the internet through a relay you host yourself.

A local driver reads Windows UI Automation controls, browser content and screenshots; it clicks, types, fills forms, runs whole sequences on the computer and reports what happened. The agent supplies the reasoning.

Why Asctrl

  • Works with any agent. Claude Code, any other MCP client, a hosted agent over Streamable HTTP (access keys or OAuth with PKCE), or your own program in any language through JSON lines. No SDK, no model lock-in: the agent brings the model, Asctrl brings the computer.
  • Remote control built in. Pair any agent with a PC anywhere using a six-digit code. Traffic goes over TLS through a relay on your own server; nothing depends on a third-party cloud. The person at the PC sees the session, can end it with one click, and the code rotates afterwards.
  • Fast, because the work happens on the computer. A plan or a JavaScript program runs on the driver and comes back only when it ends, asks, or a step fails, instead of a model round trip per click. Measured on the release build: 43 ms to read a window's text, 55 ms for a screenshot, about 0.44 s for a five-action program.
  • Proven on real tasks. With Asctrl as its only computer interface, Claude Code passed 40 of 40 real tasks in a browser, Windows Settings, Word/Excel/PowerPoint and VS Code, averaging under 9 model calls per task. Every result was checked against what the task left behind, not the model's word. See the release verification report.
  • Reliable targeting. Steps name what they act on ("Save", "To"), and the driver finds it through UI Automation, the page itself (Chrome DevTools Protocol or the extension), or OCR, and pages in its own browser can be worked even while another window covers them. Popups that turn up mid-plan are dismissed between steps, expect checks the outcome, and a failed step reports the window's controls so the agent can re-plan from there.
  • Gets cheaper with use. A program that worked is kept as a skill on that computer and runs again with new arguments, without planning it again.
  • Small surface. Five tools (connect, query, act, exec, resume) cover everything, so an agent spends few tokens learning them.
  • Local first and visible. By default the controller talks only to the driver on the same PC. An on-screen orb shows every session, actions that can't be undone or that send something out wait for a click at the PC, an audit log records operations, and ASCTRL_TOOLS_DENY removes operations you don't want offered.

Contents

How it works

Asctrl architecture: agents connect to the controller over JSON Lines, MCP stdio or Streamable HTTP; the controller drives the driver on this PC, or a remote PC through an optional self-hosted relay.

Figure 1. Any agent talks to the controller; the controller drives the local PC directly, or a remote PC through a relay you host.

PartWhereWhat it does
Driveragent-app/Native Windows app. Reads and operates the desktop, runs plans and programs, shows a desktop orb while a session is active.
Controllersrc/console/Exposes the five tools over MCP stdio, JSON lines, or Streamable HTTP with access keys and OAuth.
Relaysrc/relay/Optional WebSocket relay that pairs a controller with a remote driver by a six-digit code.
Browser extensionbrowser-extension/Optional unpacked Chromium extension that lets the driver operate tabs in an existing browser.

Requirements

  • Windows x64 with an interactive, signed-in desktop and WebView2 (tested on Windows 11).
  • The portable package brings its own Node.js runtime. The TypeScript source runs directly on Node.js 22.18 or newer (24 recommended). The built JavaScript in dist/, which the server archive carries and npm run build writes, runs on Node.js 20.12 or newer, for a relay or HTTP connector on a host that keeps an older LTS. Building the release needs 24.5 or newer.

Quick start

  1. Download asctrl-0.3.0-windows-x64.zip from the Releases page and extract it to a folder you keep, such as C:\Tools\Asctrl.

  2. Register the stdio server with your agent. Adjust both absolute paths to the extraction folder; then the agent can be started from any directory.

    {
      "mcpServers": {
        "asctrl": {
          "command": "C:\\Tools\\Asctrl\\runtime\\node.exe",
          "args": ["C:\\Tools\\Asctrl\\src\\console\\mcp-server.ts"]
        }
      }
    }
    
  3. Have the agent call connect with {}, then query with {"what":"observe","args":{"max":10}}. The controller starts the bundled driver on demand, and the desktop orb shows the active session.

Verify the download. The release includes SHA256SUMS. Compare the output of Get-FileHash -Algorithm SHA256 <package-path> with the entry for that file.

Release files

FileContents
asctrl-0.3.0-windows-x64.zipPortable package: driver, Node runtime, controller and its dependencies, browser extension, notices. Start here.
Asctrl_0.3.0_x64-setup.exeDriver-only installer. Unsigned, so Windows may show a publisher warning.
asctrl-0.3.0-server.tar.gzController, relay and HTTP connector for your own server, as TypeScript (src/) and built JavaScript (dist/).
asctrl-0.3.0-source.zipEverything needed to rebuild the release.
asctrl-0.3.0-driver-notices.zipThird-party notices for the driver. Distribute it alongside the standalone installer.
SHA256SUMSChecksums of the files above.

With the installer, start the installed app on the PC you want to control. A controller connects to a running driver, or set ASCTRL_DRIVER_EXE to the driver's full path so the controller starts it. One controller holds the session at a time. The loopback connection uses a random token stored in the current user's %LOCALAPPDATA%\Asctrl\local.json.

The portable ZIP keeps driver dependency notices under docs/driver-notices/, the Node runtime license in runtime/LICENSE and controller dependencies under node_modules/.

Agents without MCP

Launch runtime\node.exe src\console\jsonl.ts from the extracted folder and keep the process running across calls. Write one UTF-8 JSON object per line to stdin and read one response per nonblank line from stdout. Close stdin to end the session. Any language with subprocess I/O can host it; for a text-only model, the host executes the tool requests and returns the results to the model.

{"op":"list"}
{"op":"call","name":"connect","arguments":{}}
{"op":"call","name":"query","arguments":{"what":"observe","args":{"max":10}}}
{"op":"call","name":"act","arguments":{"do":"disconnect"}}

list returns the live tool schemas. A call returns ok and the MCP result with text or image content. A malformed request returns ok:false with an error, and the session keeps accepting requests.

This Python host uses only the standard library. A model can pick a tool from the returned schemas and supply the arguments.

import json
import subprocess
from pathlib import Path

root = Path(r"C:\Tools\Asctrl")
with subprocess.Popen(
    [root / "runtime/node.exe", root / "src/console/jsonl.ts"],
    stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True, encoding="utf-8",
) as bridge:
    def request(message):
        bridge.stdin.write(json.dumps(message) + "\n")
        bridge.stdin.flush()
        line = bridge.stdout.readline()
        if not line:
            raise RuntimeError("Asctrl exited before replying")
        reply = json.loads(line)
        if not reply["ok"]:
            raise RuntimeError(reply.get("error") or reply["result"]["content"])
        return reply

    try:
        request({"op": "call", "name": "connect"})
        screen = request({"op": "call", "name": "query", "arguments": {"what": "observe"}})
        print(screen["result"]["content"][0]["text"])
    finally:
        bridge.stdin.close()

The five tools

ToolUse
connectNo arguments for local control. With a configured relay, pass the six-digit code shown by the remote driver.
queryRead controls, screenshots, text, windows, recent events, file listings or plan progress. {"what":"observe","help":true} explains each operation.
actClick, press keys, fill a form, open an app, manage files, or queue a plan. {"do":"click","help":true} explains targets and arguments.
execRun a JavaScript program on the driver, with loops, assertions and calls to the desktop tools. A program can ask for input or stop at a failed action.
resumeAnswer a question, retry a step, substitute a corrected action or stop the program, using the ID from exec.

Run a plan

Send a known sequence in one call. For example, call act with these arguments against a window titled “Order form”, then read its report with query and {"what":"progress","args":{"waitSec":30}}.

{
  "do": "run",
  "args": {
    "window": "Order form",
    "steps": [
      {"fill": {"Name": "Dana", "City": "Taipei"}},
      {"click": "Submit"},
      {"expect": "Submitted"}
    ]
  }
}

By default a plan moves on as soon as the screen reacts. Add an explicit postcondition (expect) when the next step depends on a particular result. When a plan fails, its report shows the window's controls with references, so the agent can re-plan from there.

Tips for reliable operation

  • Observe the intended window first, then pass its handle to the next action. A window handle tells apart programs with similar titles; a fresh element reference such as e12, or a label with role or nth, picks a particular control. If a label matches several controls, inspect the returned candidates.
  • Coordinates refer to the most recent screenshot. Take a new screenshot after a resize or a change in framing. Read window text first when you only need labels, field values or a confirmation.
  • set_value sets a checkbox to a requested state, selects a list item or replaces text. Use click to press a button. wait_for and plan expect let the desktop decide when an operation has finished.
  • A program can use look, read, click, fill, keys, expect and ask. Its state is done, stuck, asking or running. On stuck, inspect the failed action and its candidates before retrying; on asking, pass the answer to resume. A program that ends well is kept as a skill on that computer; name it with learn: {name, description}, run it again later with skill and new args, or pass learn: false for a one-off.
  • Pages in Asctrl's isolated browser can be operated even while another window covers them. To work in an existing Chromium browser, load the unpacked extension from browser-extension/. It requests debugger access to operate tabs and talks to the running driver through a native messaging host the driver registers.

Remote access (self-hosted)

Remote control is off until you configure a relay on both ends. Use a server and DNS name you control. Extract asctrl-0.3.0-server.tar.gz, run npm ci --omit=dev with Node.js 20.12 or newer, and start the services from that folder. The commands below run the built JavaScript in dist/; on Node.js 22.18 or newer the same files under src/ with a .ts extension work too. Without the archive, the same programs come from npm as @yalosaws/asctrl: npx -p @yalosaws/asctrl asctrl-relay runs the relay, asctrl-http the HTTP connector (asctrl-http keys add my-agent for keys) and asctrl-mcp the MCP stdio controller. The examples use POSIX shell syntax and separate terminals or service units for the long-running processes.

  1. Start the relay. Choose a random shared secret and supply it through your service environment; the relay refuses to start without RELAY_TOKEN (set RELAY_ALLOW_NO_TOKEN=1 only on a closed test network). PORT defaults to 8787 and RELAY_HOST to 127.0.0.1.

    export RELAY_TOKEN="$(node -p "require('node:crypto').randomBytes(32).toString('hex')")"
    node dist/relay/server.js
    
  2. Publish /relay through a TLS reverse proxy with a certificate the driver and controller trust. This Caddy example also routes the optional HTTP connector. Replace access.example.com with your domain.

    access.example.com {
        handle /relay {
            reverse_proxy 127.0.0.1:8787
        }
        handle {
            reverse_proxy 127.0.0.1:8788 {
                flush_interval -1
            }
        }
    }
    
  3. On the Windows PC to be controlled, exit any running driver and start it with your relay address.

    .\driver\asctrl-agent.exe --relay wss://access.example.com/relay
    

    To keep the setting, set ASCTRL_RELAY_URL for the user or put the URL alone in relay.txt beside the driver. The command-line flag wins over the environment, which wins over the file. The orb shows the pairing code once the relay connection is ready. Plain WebSocket is accepted only on loopback.

  4. On the controller, set RELAY_URL=wss://access.example.com/relay and the same RELAY_TOKEN in the stdio or JSON-lines controller's environment. Call connect with {"code":"123456"}, using the code currently shown on the remote PC. To return a PC to local-only mode, remove its relay configuration and restart its driver.

Private certificate authority. Set ASCTRL_RELAY_CA_FILE on the Windows driver to an absolute path holding the CA's PEM certificates; that file then supplies the driver's trust roots for the relay. Set NODE_EXTRA_CA_CERTS to the same CA file before starting an external Node controller. Both peers still verify the server certificate and hostname.

HTTP connector for hosted agents

Run the connector as a second server process with RELAY_TOKEN set to the relay's secret. Create an access key, keep it private and start the connector, using the same persistent ASCTRL_DATA_DIR for key management and for the service.

export ASCTRL_DATA_DIR="$PWD/data"
node dist/console/mcp-http.js keys add my-agent
PUBLIC_URL=https://access.example.com RELAY_URL=ws://127.0.0.1:8787 node dist/console/mcp-http.js

Point the agent at the Streamable HTTP MCP URL https://access.example.com/mcp. It can send the access key as a Bearer token, or use OAuth discovery, dynamic client registration and PKCE. It then calls connect with a pairing code; the HTTP connector always targets a paired driver. node dist/console/mcp-http.js keys revoke my-agent revokes the key and its OAuth tokens. The connector binds to 127.0.0.1:8788 by default.

Security and privacy

  • A controller acts with the Windows rights of the driver's user, including shell and file access, and so can do whatever that account can do through its applications. Treat pairing codes, relay tokens and connector keys as credentials. The relay forwards control traffic, so its operator must be trusted.

  • The user on the controlled PC stays in charge. The orb shows the session; click it and choose End session to disconnect a controller. Ending a remote session rotates its code, and a code nobody has used for 10 minutes is replaced (ASCTRL_CODE_TTL_MIN on the driver; 0 keeps it); New code in the orb's menu replaces it at once. Hold left Alt and right Alt together to quit the driver. Windows elevation (UAC) prompts are left to the user: the driver works on the interactive desktop and cannot click the secure desktop or the lock screen.

  • Risky actions wait for a yes. An action that can't be undone (delete, uninstall, a destructive shell command, a restart) or that sends something out (send, submit, pay, Enter in a chat) waits for the person at the PC to click Allow on the orb; no answer in 2 minutes, or Deny, means it is not done, and the agent is told so. This holds inside plans and programs too. ASCTRL_CONFIRM on the driver sets which levels ask: external,irreversible (default), external, or off for unattended use. The switch in the orb's menu turns asking on or off until the driver quits; it can be turned off only while no agent is connected, so an agent operating the PC can't switch it off itself.

  • Audit log. The driver records operation metadata in %LOCALAPPDATA%\Asctrl\actions.log, including whether the person was asked and what they answered.

  • Limit the tool surface. ASCTRL_TOOLS_DENY takes comma-separated operation names. On the controller it hides them from discovery; on the driver it rejects those native operations, including calls from inside programs.

  • Optional decision model. When a step's text matches several controls or none, a decision model may choose, and only when it is sure. It runs only if you set one up on the controller:

    • NACE_API_KEY: sends candidate controls or window text to Nace at https://console.nace.ai/v1/systemone.
    • Any OpenAI-compatible endpoint, such as Ollama, vLLM or llama.cpp on your own machine: ASCTRL_DECISION_BASE_URL (for example http://127.0.0.1:11434/v1), ASCTRL_DECISION_MODEL, and ASCTRL_DECISION_API_KEY if it needs one. Its confidence comes from the answer's logprobs; an endpoint without them is asked to rate itself, and that rating counts for less. Small models judge less reliably than a dedicated one.

    Without either, nothing leaves the machine for this, and local control and ordinary desktop operations work as usual.

  • What affects targeting. The default screen capture shows the foreground composition; a window-targeted capture can use Windows Graphics Capture to read a covered window. OCR, display scaling and the accessibility information an application exposes affect how well controls are found.

Troubleshooting

SymptomWhat to check
Driver starts but shows no codeOpen the orb menu. “Local control only” means no relay is configured. A relay connection error appears here if the configured address or certificate fails.
Local driver cannot be foundCheck that the portable archive was fully extracted, or point ASCTRL_DRIVER_EXE at the installed executable. Run the controller as the same Windows user as the driver.
Remote code cannot be foundCheck that the driver and controller use the same relay, that the proxy allows WebSocket upgrades at that path, and that the driver has reached its pairing state.
Another controller is activeEnd the current session at the orb or disconnect it from its controller, then connect again.
Hosted client receives HTTP 401Check the connector access key or OAuth token. The relay token authenticates the connector to the relay and is not a client credential. Use the full connector URL ending in /mcp.

Build from source

Use Windows x64 with Node.js 24.5 or newer, Rust, the Visual Studio C++ build tools and WebView2. From the repository root (or an extracted asctrl-0.3.0-source.zip) in PowerShell:

npm ci
.\scripts\package.ps1

The script builds the UI and the Tauri driver and writes the portable ZIP, the installer, the driver notices, the server archive, the source ZIP and SHA256SUMS to dist/release/0.3.0/. From a checkout you can also run the controller directly: node src/console/mcp-server.ts for MCP stdio or node src/console/jsonl.ts for JSON lines. npm run build writes the same code as JavaScript to dist/ for Node.js 20.12 or newer.

Tests

CoverageCommand from the repository root
TypeScript and controller regressionsnpm run typecheck and node --test test/regressions.ts
Native tests and lintcargo test --manifest-path agent-app/src-tauri/Cargo.toml --locked --release --all-targets and cargo clippy --manifest-path agent-app/src-tauri/Cargo.toml --locked --release --all-targets -- -D warnings
HTTP, OAuth, stdio and relaynpm run test:http and node test/relay-limit.ts
Built JavaScript on the Node.js at hand (20.12 or newer)npm run build and node test/dist.mjs
Extracted portable ZIP, local cold start./test/portable.ps1 -Bundle <extracted-directory>
Driver end to endnpm test
Real desktop tasks and latencynpm run bench and npm run timing
Browser, Windows and program suitesnode test/<suite>.ts for windows, page, programs, skills, presence, tools, log, run, electron and ext
Recorded overlay regressionnode test/fxcheck.ts test/fx/p4-v1.fxlog test/fx/p4-v2.fxlog --check
Agent benchmark, 40 tasksnode test/p0/run.ts --model sonnet
Full desktop suite, WSS pairing and clipboardnpm run test:desktop (needs OpenSSL on PATH and a test browser with extension support)

Desktop suites take over the keyboard, mouse and foreground window. Run one at a time, on a dedicated test desktop.

  • Extension suite: point ASCTRL_EXT_TEST_EXE at an extracted Chrome for Testing chrome.exe. Its sandbox must be able to read the browser folder; if Chrome reports “Sandbox cannot access executable”, grant read and execute permission to the application-package identities on that folder.
  • Electron suite: ASCTRL_ELECTRON_TEST_EXE can point to the official VS Code ZIP distribution. A pending update of an installed VS Code can keep it from opening a new window.
  • P0 agent benchmark: needs an authenticated Claude Code runner, a working browser, Windows Settings, desktop Word, Excel, PowerPoint and VS Code. It checks what each task leaves behind and records latency, tool calls and token use in test/out/p0-*.jsonl. --dry validates task setup and negative checks; --root <path> measures another checkout, and --tools full selects the older many-tool interface.

License

Asctrl is released under the MIT License. Third-party components keep their own licenses; see docs/driver-notices/ in the portable package and runtime/LICENSE for Node.js.