sctl

module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: GPL-3.0

README

sctl

English | 简体中文

sctl connects AI clients and command-line workflows to the ScriptCat browser extension. One cross-platform binary provides a local bridge daemon, a stdio MCP server, and script-management commands.

AI client ── stdio MCP ──▶ sctl mcp ── local control API ──▶ sctl serve ── WebSocket ──▶ ScriptCat
CLI ────────────────────────────────────────────────────────▲

ScriptCat remains the authority: source disclosure and every write request are governed by the policies and confirmation UI in the extension.

Features

  • Exposes ScriptCat operations as discoverable, schema-typed MCP tools.
  • Lists scripts and reads metadata or source, including line windows and source search.
  • Requests installation, content-anchored editing, enable/disable, and deletion through browser approval.
  • Uses JSON-RPC 2.0 over a WebSocket with mutual authentication; the listener defaults to loopback.
  • Ships as one binary; no browser automation or Native Messaging host is required.

Quick start

If a binary for your platform is available on GitHub Releases, install it on PATH. If no release is available, contributors can build sctl from source; plain source builds identify themselves as 0.0.0-dev.

Choose one absolute data directory and export it for every sctl process:

export SCTL_DATA_DIR=/absolute/path/to/sctl-data

# Terminal 1: keep the daemon running
sctl serve

# Terminal 2: enroll once, then verify the connection
sctl connect
sctl status

Enable External Access in ScriptCat and enter the one-time code printed by connect. Then configure the AI client to launch:

/absolute/path/to/sctl mcp --name my-ai-client

sctl mcp does not start the daemon. It and sctl serve must resolve to the same data directory and, when overriding the default listener, use the same --listen-address <host:port>. See the complete MCP installation guide for client JSON, verification, security notes, and troubleshooting.

Commands

Command Purpose
sctl serve Run the local bridge daemon.
sctl connect Open a one-time ScriptCat enrollment window.
sctl mcp [--name <label>] Serve ScriptCat tools over stdio MCP.
sctl status Show daemon and extension connection status.
sctl get [<uuid>] List scripts or read one script.
sctl grep <uuid> <query> Search one script's source.
sctl install <url|file> Request script installation.
sctl edit <uuid> Request a content-anchored source edit.
sctl enable <uuid> / sctl disable <uuid> Request an enabled-state change.
sctl delete <uuid> Request script deletion.

Run sctl --help or sctl <command> --help for usage and flags. Write operations block until the user approves, rejects, or closes the confirmation flow in ScriptCat.

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 工具,并在阻塞等待(写审批 / 源码披露)期间周期发送 progress 通知(支持的 客户端可借此续期工具超时)。
Package mcpserver 用官方 go-sdk 构建 sctl 的 stdio MCP server:把 protocol.json 定义的 bridge action 暴露成 MCP 工具,并在阻塞等待(写审批 / 源码披露)期间周期发送 progress 通知(支持的 客户端可借此续期工具超时)。
daemon
Package daemon 是 sctl serve 的组装层:一个 cago Component,把可配置监听地址的 桥接 WS server(internal/daemon/bridge)、本机控制 API(internal/daemon/controlapi) 与持久化存储(internal/daemon/store)接到同一个 listener 上。
Package daemon 是 sctl serve 的组装层:一个 cago Component,把可配置监听地址的 桥接 WS server(internal/daemon/bridge)、本机控制 API(internal/daemon/controlapi) 与持久化存储(internal/daemon/store)接到同一个 listener 上。
daemon/auth
Package auth 实现桥接协议的认证原语:双向 HMAC 挑战应答握手(会话/配对两种模式)、 配对码派生(HKDF)与长期密钥下发(AES-256-GCM)。
Package auth 实现桥接协议的认证原语:双向 HMAC 挑战应答握手(会话/配对两种模式)、 配对码派生(HKDF)与长期密钥下发(AES-256-GCM)。
daemon/controlapi
Package controlapi 实现 daemon listener 上的本机内部控制 API(/control/*)。
Package controlapi 实现 daemon listener 上的本机内部控制 API(/control/*)。
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