Asctrl
<div align="center">
# Asctrl
**A computer-use framework for any AI agent: operate Windows PCs, locally or remotely.**
**English** | [简体中文](README.zh-CN.md)
[MCP](#quick-start) · [Streamable HTTP](#http-connector-for-hosted-agents) · [JSON Lines](#agents-without-mcp) · [Remote control](#remote-access-self-hosted) · [MIT License](LICENSE)
[](https://glama.ai/mcp/servers/yalosaws/Asctrl)
</div>
**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](docs/benchmarks.md).
- **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, an audit log records operations, and `ASCTRL_TOOLS_DENY` removes operations you don't want offered.
## Contents
- [How it works](#how-it-works)
- [Requirements](#requirements)
- [Quick start](#quick-start)
- [Agents without MCP](#agents-without-mcp)
- [The five tools](#the-five-tools)
- [Remote access (self-hosted)](#remote-access-self-hosted)
- [Security and privacy](#security-and-privacy)
- [Troubleshooting](#troubleshooting)
- [Build from source](#build-from-source)
- [License](#license)
## How it works
<p align="center">
<img src="docs/images/architecture.svg" alt="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." width="900">
</p>
<p align="center"><sub><b>Figure 1.</b> Any agent talks to the controller; the controller drives the local PC directly, or a remote PC through a relay you host.</sub></p>
| Part | Where | What it does |
| --- | --- | --- |
| Driver | `agent-app/` | Native Windows app. Reads and operates the desktop, runs plans and programs, shows a desktop orb while a session is active. |
| Controller | `src/console/` | Exposes the five tools over MCP stdio, JSON lines, or Streamable HTTP with access keys and OAuth. |
| Relay | `src/relay/` | Optional WebSocket relay that pairs a controller with a remote driver by a six-digit code. |
| Browser extension | `browser-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. Running from source or hosting the relay needs Node.js 24.5 or newer.
## Quick start
1. Download `asctrl-0.2.0-windows-x64.zip` from the [Releases](https://github.com/yalosaws/Asctrl/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.
```json
{
"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
| File | Contents |
| --- | --- |
| `asctrl-0.2.0-windows-x64.zip` | Portable package: driver, Node runtime, controller and its dependencies, browser extension, notices. Start here. |
| `Asctrl_0.2.0_x64-setup.exe` | Driver-only installer. Unsigned, so Windows may show a publisher warning. |
| `asctrl-0.2.0-server.tar.gz` | Controller, relay and HTTP connector for your own server. |
| `asctrl-0.2.0-source.zip` | Everything needed to rebuild the release. |
| `asctrl-0.2.0-driver-notices.zip` | Third-party notices for the driver. Distribute it alongside the standalone installer. |
| `SHA256SUMS` | Checksums 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.
```jsonl
{"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.
```python
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
| Tool | Use |
| --- | --- |
| `connect` | No arguments for local control. With a configured relay, pass the six-digit code shown by the remote driver. |
| `query` | Read controls, screenshots, text, windows, recent events, file listings or plan progress. `{"what":"observe","help":true}` explains each operation. |
| `act` | Click, press keys, fill a form, open an app, manage files, or queue a plan. `{"do":"click","help":true}` explains targets and arguments. |
| `exec` | Run 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. |
| `resume` | Answer 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}}`.
```json
{
"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.2.0-server.tar.gz`, run `npm ci --omit=dev` with Node.js 24.5 or newer, and start the services from that folder. 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. `PORT` defaults to `8787` and `RELAY_HOST` to `127.0.0.1`.
```sh
export RELAY_TOKEN="$(node -p "require('node:crypto').randomBytes(32).toString('hex')")"
npm run relay
```
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.
```caddyfile
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.
```powershell
.\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.
```sh
export ASCTRL_DATA_DIR="$PWD/data"
npm run keys -- add my-agent
PUBLIC_URL=https://access.example.com RELAY_URL=ws://127.0.0.1:8787 npm run mcp:http
```
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. `npm run 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. 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.
- **Audit log.** The driver records operation metadata in `%LOCALAPPDATA%\Asctrl\actions.log`.
- **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. It runs only if you set `NACE_API_KEY`, and then it sends candidate controls or window text to Nace at `https://console.nace.ai/v1/systemone`. Without the key 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
| Symptom | What to check |
| --- | --- |
| Driver starts but shows no code | Open 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 found | Check 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 found | Check 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 active | End the current session at the orb or disconnect it from its controller, then connect again. |
| Hosted client receives HTTP 401 | Check 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.2.0-source.zip`) in PowerShell:
```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.2.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.
### Tests
| Coverage | Command from the repository root |
| --- | --- |
| TypeScript and controller regressions | `npm run typecheck` and `node --test test/regressions.ts` |
| Native tests and lint | `cargo 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 relay | `npm run test:http` and `node test/relay-limit.ts` |
| Extracted portable ZIP, local cold start | `./test/portable.ps1 -Bundle <extracted-directory>` |
| Driver end to end | `npm test` |
| Real desktop tasks and latency | `npm run bench` and `npm run timing` |
| Browser, Windows and program suites | `node test/<suite>.ts` for `windows`, `page`, `programs`, `skills`, `presence`, `tools`, `log`, `run`, `electron` and `ext` |
| Recorded overlay regression | `node test/fxcheck.ts test/fx/p4-v1.fxlog test/fx/p4-v2.fxlog --check` |
| Agent benchmark, 40 tasks | `node test/p0/run.ts --model sonnet` |
| Full desktop suite, WSS pairing and clipboard | `npm 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](LICENSE). Third-party components keep their own licenses; see `docs/driver-notices/` in the portable package and `runtime/LICENSE` for Node.js.
TDQS
Scored across 5 tools
query, observe, screenshot, read_text, wait_for, and timeline all read machine state with overlapping purposes; click, type_text, press_keys, set_value, scroll, drag, mouse, run, act, and exec all perform actions or coordinate them. The descriptions help, but the boundaries remain easy to confuse, especially direct action tools versus act's single actions and duplicate skills tools.
Most names are lowercase snake_case, but the set mixes specific verbs (click, type_text), broad collection verbs (query, act, exec, run), and nouns (skills, timeline, clipboard, job, mouse). It is readable but not a predictable verb_noun pattern, and 'skills' appears in both query and act surfaces.
Although the header says 5 tools, the actual surface exposes roughly 37 tools, which is far above the 25-tool threshold even for rich desktop automation. Many low-level actions duplicate the higher-level act/run/exec entry points, making the set feel bloated rather than well-scoped.
The surface covers connection, observation, input, plans/programs, files, disk usage, PowerShell jobs, clipboard, admin, restart, and upload/download, so most desktop automation workflows have a path. Minor gaps exist, such as no dedicated process/service manager beyond PowerShell, but there are no obvious dead ends.