sctl

module
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2026 License: GPL-3.0

README

sctl

English | 简体中文

sctl puts the browser you are using under the control of the command line, AI clients, and scripts. One cross-platform binary runs a local bridge daemon that reaches ScriptCat for userscript management and its own sctl Browser extension for tabs, browser data, page automation, and debugging.

Who decides: ScriptCat stays the authority for its scripts, so reading source and every write wait for approval in the browser. Browser control, page automation, debugging, and raw CDP run immediately, by design; only deleting bookmarks and uninstalling an extension wait for approval, and other destructive commands need --yes. Read docs/threat-model.md before exposing sctl to anything you do not trust.

Features

  • ScriptCat userscripts — list, read metadata and source (line windows, search), install, edit by content anchors, enable, disable, delete.
  • Tabs and windows — list, open, close, activate, move, pin, mute, reload, duplicate, and group tabs across one or more paired browsers.
  • Browser data — bookmarks, reading list, history, recently closed tabs, downloads, cookies, browsing data, and extensions.
  • Page automation — accessibility snapshots with element refs, click, hover, fill, type, select, upload, scroll, navigate, wait, screenshot, and run JavaScript, in background tabs without switching the one you are on.
  • Debugging — console messages, uncaught exceptions, browser messages, and network requests with headers and bodies.
  • Raw CDP — send one Chrome DevTools Protocol command, or open an endpoint that Playwright connectOverCDP and Puppeteer connect attach to.
  • One binary — JSON-RPC 2.0 over a mutually authenticated WebSocket, loopback by default; no Native Messaging host.

Install

macOS and Linux:

curl -fsSL https://raw.githubusercontent.com/scriptscat/sctl/main/scripts/install.sh | sh

Homebrew:

brew install scriptscat/tap/sctl

Windows PowerShell:

irm https://raw.githubusercontent.com/scriptscat/sctl/main/scripts/install.ps1 | iex

The install script verifies the release archive's sha256 and installs sctl into ~/.local/bin (macOS/Linux) or %LOCALAPPDATA%\sctl\bin (Windows). Pinning a version, manual downloads, and building from source are covered in docs/mcp.md.

Quick start

  1. Start the daemon and leave it running:

    sctl serve              # in a terminal, or
    sctl service install    # in the background, starting at login
    
  2. Pair the extensions. sctl connect prints a one-time code; each code pairs one extension, so run it once per extension.

    • ScriptCat: enable External Access in its options and enter the code.
    • sctl Browser: install it from the Chrome Web Store or Microsoft Edge Add-ons and enter a code in its popup. It needs Chrome 125 or newer (or a Chromium browser of that version). You can also load sctl-browser-extension-<version>.zip from GitHub Releases as an unpacked extension.
  3. Check the connection:

    sctl status      # daemon and ScriptCat
    sctl scriptcats  # paired ScriptCat instances
    sctl browsers    # paired sctl Browser instances
    

Every sctl process must use the same data directory and listener address; the defaults work when they all run as the same user. The step-by-step guide, including SCTL_DATA_DIR, --listen-address, and the debugging infobar Chrome shows while a page is being driven, is docs/mcp.md.

Ways to use it

Command line. Every capability is a command; add -o json for scripts.

sctl tabs list
sctl page snapshot --tab 123
sctl debug console --tab 123 --level error
sctl get                      # ScriptCat scripts

Behavior, exit codes, and confirmations are in docs/cli.md.

AI clients over MCP. Configure the client to launch /absolute/path/to/sctl mcp --name my-ai-client. sctl mcp does not start the daemon. Client configuration, the tool reference, and troubleshooting are in docs/mcp.md.

Agent skill. To have an agent drive the command line instead of MCP, install the skill in skills/sctl/. For Claude Code, link it from a clone of this repository:

ln -s "$PWD/skills/sctl" ~/.claude/skills/sctl

Playwright and Puppeteer. sctl cdp endpoint prints addresses that existing scripts connect to, keeping the browser's logins; see docs/cli.md.

Commands

Group What it does
sctl serve / connect / status / mcp Run the daemon, pair an extension, show connection status, serve MCP over stdio.
sctl service Run the daemon in the background as a user service (launchd, systemd, Task Scheduler).
sctl get / grep / install / edit / enable / disable / delete Manage ScriptCat userscripts.
sctl scriptcats List paired ScriptCat instances, or forget one.
sctl browsers List paired sctl Browser instances, or forget one.
sctl tabs / windows / groups Tabs, windows, and tab groups.
sctl bookmarks / reading-list Bookmarks and the reading list.
sctl history / recent / downloads History, recently closed tabs and windows, downloads.
sctl cookies / browsing-data / extensions Cookies, browsing data, installed extensions.
sctl page Automate a page: snapshot, click, fill, navigate, wait, screenshot, evaluate.
sctl debug Record and read a tab's console and network requests.
sctl cdp Send a raw CDP command, or open an endpoint for Playwright and Puppeteer.

sctl <command> --help lists every subcommand and flag; docs/cli.md is the full reference.

Documentation

  • docs/cli.md — command-line reference.
  • docs/mcp.md — installation, pairing, MCP client setup, and the MCP tool reference.
  • docs/threat-model.md — what sctl protects and what it deliberately does not.
  • docs/README.md — index of the contributor docs (architecture, protocol, development).

License

GPL-3.0, the same license as ScriptCat. See LICENSE.

Directories

Path Synopsis
cmd
protocolgen command
sctl command
sctl — ScriptCat 控制工具:本地桥接 daemon、MCP stdio server 与脚本管理命令。
sctl — ScriptCat 控制工具:本地桥接 daemon、MCP stdio server 与脚本管理命令。
internal
cli
Package cli 定义 sctl 的 cobra 子命令。
Package cli 定义 sctl 的 cobra 子命令。
client/control
Package control 定义 sctl 前端(sctl mcp / CLI 动词)与常驻 daemon(sctl serve)之间的 「控制连接」:一套跑在 daemon listener 上、与扩展 WS 面同端口但独立路径的 HTTP/JSON 控制 API。
Package control 定义 sctl 前端(sctl mcp / CLI 动词)与常驻 daemon(sctl serve)之间的 「控制连接」:一套跑在 daemon listener 上、与扩展 WS 面同端口但独立路径的 HTTP/JSON 控制 API。
client/mcpserver
Package mcpserver 用官方 go-sdk 构建 sctl 的 stdio MCP server:把 protocol.json 定义的 bridge action 暴露成 MCP 工具(第 1 期的方法一方法一工具,之后的浏览器领域按领域合并成一个工具),并在 调用等待期间周期发送 progress 通知(支持的客户端可借此续期工具超时;哪些调用、从何时开始发见 progressFor)。
Package mcpserver 用官方 go-sdk 构建 sctl 的 stdio MCP server:把 protocol.json 定义的 bridge action 暴露成 MCP 工具(第 1 期的方法一方法一工具,之后的浏览器领域按领域合并成一个工具),并在 调用等待期间周期发送 progress 通知(支持的客户端可借此续期工具超时;哪些调用、从何时开始发见 progressFor)。
client/service
Package service 把 `sctl serve` 注册为当前用户的系统服务:macOS launchd LaunchAgent、Linux systemd 用户单元、Windows 登录触发的计划任务。
Package service 把 `sctl serve` 注册为当前用户的系统服务:macOS launchd LaunchAgent、Linux systemd 用户单元、Windows 登录触发的计划任务。
daemon
Package daemon 是 sctl serve 的组装层:一个 cago Component,把可配置监听地址的 桥接 WS server(internal/daemon/bridge)、本机控制 API(internal/daemon/controlapi)、 页面自动化组件(internal/daemon/page)、原始 CDP 端点(internal/daemon/cdpendpoint)与持久化存储(internal/daemon/store) 接到同一个 listener 上。
Package daemon 是 sctl serve 的组装层:一个 cago Component,把可配置监听地址的 桥接 WS server(internal/daemon/bridge)、本机控制 API(internal/daemon/controlapi)、 页面自动化组件(internal/daemon/page)、原始 CDP 端点(internal/daemon/cdpendpoint)与持久化存储(internal/daemon/store) 接到同一个 listener 上。
daemon/auth
Package auth 实现桥接协议的认证原语:双向 HMAC 挑战应答握手(会话/配对两种模式)、 配对码派生(HKDF)与长期密钥下发(AES-256-GCM)。
Package auth 实现桥接协议的认证原语:双向 HMAC 挑战应答握手(会话/配对两种模式)、 配对码派生(HKDF)与长期密钥下发(AES-256-GCM)。
daemon/cdpendpoint
Package cdpendpoint 为每个已配对的 sctl Browser 实例提供一个原始 CDP 端点:Playwright connectOverCDP 与 Puppeteer connect 连上它,就能驱动这个浏览器里能附加的全部标签页(docs/protocol.md「Raw CDP endpoint」)。
Package cdpendpoint 为每个已配对的 sctl Browser 实例提供一个原始 CDP 端点:Playwright connectOverCDP 与 Puppeteer connect 连上它,就能驱动这个浏览器里能附加的全部标签页(docs/protocol.md「Raw CDP endpoint」)。
daemon/controlapi
Package controlapi 实现 daemon listener 上的本机内部控制 API(/control/*)。
Package controlapi 实现 daemon listener 上的本机内部控制 API(/control/*)。
daemon/page
Package page 是 daemon 内的页面自动化组件:把 `sctl page …` 与 page_* MCP 工具的一次动作翻译成 发往浏览器实例的 CDP 命令,并在 daemon 内存里保存跨命令的页面状态(调试器附加、空闲断开计时、快照的元素引用表)。
Package page 是 daemon 内的页面自动化组件:把 `sctl page …` 与 page_* MCP 工具的一次动作翻译成 发往浏览器实例的 CDP 命令,并在 daemon 内存里保存跨命令的页面状态(调试器附加、空闲断开计时、快照的元素引用表)。
daemon/ratelimit
Package ratelimit 提供按 key 的滑动窗口限流,用于桥接的配对尝试节流。
Package ratelimit 提供按 key 的滑动窗口限流,用于桥接的配对尝试节流。
daemon/store
Package store 是守卫侧的持久化层,以原子替换将扩展配对的长期共享密钥写入数据目录。
Package store 是守卫侧的持久化层,以原子替换将扩展配对的长期共享密钥写入数据目录。
pkg/audit
Package audit 记录守卫侧的安全事件。
Package audit 记录守卫侧的安全事件。
pkg/fsutil
Package fsutil 提供跨包复用的文件系统小工具。
Package fsutil 提供跨包复用的文件系统小工具。
pkg/logging
Package logging 为所有 sctl 子命令初始化统一的 zap 日志。
Package logging 为所有 sctl 子命令初始化统一的 zap 日志。
pkg/paths
Package paths 解析 sctl 的数据目录与派生路径(日志、配对密钥等)。
Package paths 解析 sctl 的数据目录与派生路径(日志、配对密钥等)。
pkg/protocol
Package protocol 解析从 sctl 权威 schema 生成并嵌入的协议元数据。
Package protocol 解析从 sctl 权威 schema 生成并嵌入的协议元数据。
pkg/protocol/generated
Code generated by protocolgen; DO NOT EDIT.
Code generated by protocolgen; DO NOT EDIT.
pkg/protocolschema
Package protocolschema validates untrusted WebSocket frames against the schema-owned RPC contract.
Package protocolschema validates untrusted WebSocket frames against the schema-owned RPC contract.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL