Open Connector
构建 Agent

oc CLI

安装并使用 Open Connector 官方命令行客户端。

oc 是 Open Connector 官方命令行客户端。它通过 @open-connector/sdk 调用原生 /api/v1 API,默认输出适合 Agent 与脚本消费的 JSON,也可以通过 --human 切换成人类可读输出。

安装

curl -fsSL https://github.com/openconnector-dev/openconnector/releases/latest/download/install.sh | sh

安装脚本会把 macOS 或 Linux 的免运行时二进制文件下载到 ~/.local/bin。Windows 用户可以从 GitHub Releases 下载 oc-windows-x64.exe

登录实例

先在 SaaS Console 创建项目范围 API Key,再保存 Broker Origin、Key 与可选的默认 Entity ID:

oc login \
  --url https://api.openconnector.dev \
  --key "$OPEN_CONNECTOR_API_KEY" \
  --entity user_123

配置会写入 ~/.config/oc/config.json。这里的 login 只是保存已有项目 Key,并不是 OAuth 登录流程。自托管时传入自己的公网 Server Origin。

连接并执行 Tool

# 1. 查看 Toolkit,并复制准确的 auth method id
oc toolkits info github

# 2. 创建 Auth Config
oc auth-configs create github \
  --auth-method github.oauth2 \
  --name production

# 3. 为当前 Entity 建立连接;OAuth 会打开授权 URL
oc connected-accounts link github --auth-config ac_...

# 4. 查看并执行 Tool
oc tools list github
oc tools info GITHUB_CREATE_AN_ISSUE
oc tools execute GITHUB_CREATE_AN_ISSUE \
  --connected-account conn_... \
  --data '{"owner":"acme","repo":"app","title":"Created by oc"}'

API Key 或 Basic Auth Provider 不需要 OAuth 重定向,直接提交凭证对象:

oc connected-accounts link telegram \
  --auth-method telegram.api_key \
  --credentials '{"apiKey":"..."}'

命令

命令用途
oc toolkits list / info <slug>浏览 Toolkit 元数据与准确的 Auth Method ID
oc tools list [toolkit] / info <slug>发现 Tool 并查看输入 Schema
oc tools execute <slug> --data <input>代表 Entity 或指定 Connected Account 执行 Tool
oc auth-configs create <toolkit> --auth-method <id>创建托管或自带凭证的 Auth Config
oc auth-configs list / info <id>查找并检查 Auth Config
oc connected-accounts link <toolkit>发起 OAuth,或提交 API Key / Basic 凭证
oc connected-accounts list / info <id> / delete <id>管理项目范围内的连接
oc proxy <url> --connection <id>使用 Broker 凭证发起类似 curl 的请求

使用 oc <command> --help 查看完整选项。全局参数是 --entity <id>--human

JSON 输入与输出

--data--credentials 支持内联 JSON、@path/to/file.json 或用 - 从 stdin 读取:

oc tools execute TOOL_SLUG --data @input.json
cat input.json | oc tools execute TOOL_SLUG --data -
oc --human toolkits list

默认 JSON 输出便于 Agent 与 Shell 脚本稳定消费;--human 用于交互式查看。

当前边界

CLI 当前覆盖 Toolkit 与 Tool 发现、Auth Config、Connected Account、Tool 执行和凭证代理。Triggers、Webhooks、内联 JavaScript Sandbox、语义搜索与 OAuth Cloud Login 尚不在当前 CLI 能力范围内。

On this page