超人cli
CLI控制 超级人类 通过Chrome DevTools协议(CDP)和Superhuman的后端API发送电子邮件客户端。
需求
- 包子 运行时
- Superhuman.app在启用远程调试的情况下运行
设置
# Install dependencies
bun install
# Start Superhuman with CDP enabled
/Applications/Superhuman.app/Contents/MacOS/Superhuman --remote-debugging-port=9250CLI使用情况
# Check connection status
superhuman status
# Account management
superhuman account auth
superhuman account list
superhuman account switch 2
superhuman account switch user@example.com阅读电子邮件
# List recent inbox emails (★ marks starred/flagged threads)
superhuman inbox
superhuman inbox --limit 20
superhuman inbox --limit 20 --json # NDJSON: one thread per line as fetched
# Filter inbox
superhuman inbox --focused # Important/primary only
superhuman inbox --needs-reply # Exclude threads where you were last sender
superhuman inbox --unread # Unread only
superhuman inbox --exclude "newsletter,noreply@,statuspage" # Exclude by from/subject pattern
# Combine filters
superhuman inbox --focused --needs-reply --exclude "statuspage,reminder@" --limit 20
# Search emails (keyword FTS via local SQLite index — all categories including Social/Promotions)
superhuman search "from:john subject:meeting"
superhuman search "project update" --limit 20
superhuman search "invoice" --json # NDJSON: one thread per line with IDs
# Search all emails including archived/done (server-side AI search)
superhuman search "uber trip" --include-done
# AI-powered semantic search (natural language, also server-side)
superhuman search "emails about contract renewals last month" --ai
superhuman search "what did John say about the deadline?" --ai --json
# Read a specific thread (requires --account)
superhuman read --account user@gmail.com
superhuman read --account user@gmail.com --context 3 # Full body for last 3 only
superhuman read --account user@gmail.com --json问AI
使用超人的人工智能搜索电子邮件、回答问题或询问特定主题:
# Search emails with natural language
superhuman ai "find emails about the Stanford cover letter"
superhuman ai "what did John say about the deadline?"
# Compose with AI
superhuman ai "Write an email inviting the team to a planning meeting"
# Ask about a specific thread
superhuman ai "summarize this thread"
superhuman ai "what are the action items?"
superhuman ai "draft a professional reply"AI会根据您的提示自动确定是搜索、撰写还是回答。
联系人
# Search contacts by name
superhuman contact search "john"
superhuman contact search "john" --limit 5 --json
# Search contacts in a specific account (without switching UI)
superhuman contact search "john" --account user@gmail.com多账户支持
这 --account 标志允许在不切换超人UI的情况下对任何链接帐户进行操作:
# Search contacts in a specific account
superhuman contact search "john" --account user@gmail.com
# Works with both Gmail and Microsoft/Outlook accounts
superhuman contact search "john" --account user@company.com它是如何工作的: CLI使用Superhuman的后端API(JWT auth)和门户RPC(CDP)。跑 superhuman account auth 一次提取和缓存凭据。
认证
# Extract JWT from running Superhuman app (required once)
superhuman account auth
# Tokens are cached to ~/.config/superhuman-cli/tokens.json
# Re-run 'account auth' if tokens expire撰写电子邮件
收件人可以指定为电子邮件地址或联系人姓名。通过联系人搜索,姓名会自动解析为电子邮件地址。
# Create a draft (using email or name)
superhuman draft create --to user@example.com --subject "Hello" --body "Hi there!"
superhuman draft create --to "john" --subject "Hello" --body "Hi there!"
superhuman draft create --to user@example.com --subject "Report" --body "See attached" --attach ./report.pdf
# List drafts
superhuman draft list
superhuman draft list --account user@example.com
superhuman draft list --to jon@example.com # Filter by recipient
superhuman draft list --subject "Meeting notes" # Filter by subject
superhuman draft list --json # JSON output for scripting
# Send an email
superhuman send --to user@example.com --subject "Quick note" --body "FYI"
# Reply to a thread
superhuman reply --body "Thanks!"
superhuman reply --body "Thanks!" --send
# Reply-all
superhuman reply-all --body "Thanks everyone!"
# Forward
superhuman forward --to colleague@example.com --body "FYI"
# Update a draft
superhuman draft update --body "Updated content"
superhuman draft update --attach ./document.pdf
# Delete drafts
superhuman draft delete
superhuman draft delete
# Send a draft by ID
superhuman send --draft
# Send a Superhuman draft with content
superhuman draft send --account=user@example.com --to=recipient@example.com --subject="Subject" --body="Body"草稿
草稿是通过超人的本地API创建的,并且只存在于超人中。使用 draft list 查看所有草稿,以及 draft send 或 --send 旗帜发送给他们。
管理线程
# Archive
superhuman archive
superhuman archive
# Delete (trash)
superhuman delete
# Mark as read/unread
superhuman mark read
superhuman mark unread
# Star / Unstar
superhuman star add
superhuman star remove
superhuman star list
# Snooze / Unsnooze
superhuman snooze set --until tomorrow
superhuman snooze set --until next-week
superhuman snooze set --until "2024-02-15T14:00:00Z"
superhuman snooze cancel
superhuman snooze list代码片段
存储在Superhuman中的可重用电子邮件模板。代码段支持以下模板变量 {first_name}.
# List all snippets
superhuman snippet list
superhuman snippet list --json
# Use a snippet to create a draft (fuzzy name matching)
superhuman snippet use "zoom link" --to user@example.com
# Substitute template variables
superhuman snippet use "share recordings" --to user@example.com --vars "date=Feb 5,student_name=Jane"
# Send immediately using a snippet
superhuman snippet use "share recordings" --to user@example.com --vars "date=Feb 5" --send标签
# List all labels
superhuman label list
# Get labels on a thread
superhuman label get
# Add/remove labels
superhuman label add --label Label_123
superhuman label remove --label Label_123附件
# List attachments in a thread
superhuman attachment list
# Download all attachments from a thread
superhuman attachment download
superhuman attachment download --output ./downloads
# Download specific attachment
superhuman attachment download --attachment --message --output ./file.pdf日历
超人有内置的日历支持,但更喜欢 morgen 用于日历操作的CLI——它支持正确的日历过滤。请参阅 morgen 技能。
# List events
superhuman calendar list
superhuman calendar list --date tomorrow --range 7 --json
# Create event
superhuman calendar create --title "Meeting" --start "2pm" --duration 30
superhuman calendar create --title "All Day" --date 2026-02-05
# Update/delete event
superhuman calendar update --event --title "New Title" --location "Room 101"
superhuman calendar delete --event
# Check availability
superhuman calendar free
superhuman calendar free --date tomorrow --range 7选项
| 选项 | 描述 |
|---|---|
--account | 要操作的账户(默认:活期账户) |
--to | 收件人电子邮件或姓名(通过联系人自动解析姓名) |
--cc | CC收件人(可多次使用) |
--bcc | BCC收件人(可多次使用) |
--subject | 电子邮件主题 |
--body | 电子邮件正文(纯文本,转换为HTML) |
--html | 电子邮件正文为原始HTML |
--send | 立即发送而不是保存草稿(用于回复/全部回复/转发/摘录) |
| `--vars | |
| ` | 模板变量替换: "key1=val1,key2=val2" (供片段使用) |
--draft | 要发送的草稿ID(用于发送命令) |
--label | 标签ID(用于添加/删除标签) |
--until | Snooze直到时间:预设或ISO日期时间 |
| `--output | |
| ` | 下载输出路径 |
--attachment | 特定附件ID |
--message | 邮件ID(附件中需要) |
--limit | 结果数(默认值:10) |
--focused | 仅显示重要/主要电子邮件(Gmail:类别:个人,Outlook:聚焦) |
--needs-reply | 排除您是最后一个发件人的线程 |
--unread | 仅显示未读电子邮件 |
| `--exclude | |
| ` | 排除与模式匹配的线程(逗号分隔,匹配来自/subject) |
--ai | 使用人工智能驱动的搜索,而不是关键字FTS(用于搜索) |
--include-done | 搜索所有电子邮件,包括存档的电子邮件(用于搜索) |
--context | 要显示全文的消息数(默认值:全部,用于阅读) |
--date | 日历日期(YYYY-MM-DD或“今天”、“明天”) |
--range | 日历显示天数(默认值:1) |
--start | 事件开始时间(ISO日期时间或自然时间:“下午2点”,“明天下午3点”) |
--end | 事件结束时间(ISO日期时间) |
--duration | 事件持续时间(分钟)(默认值:30) |
--title | 事件标题(用于日历创建/更新) |
--event | 事件ID(用于日历更新/删除) |
--location | 事件位置(用于日历创建/更新) |
--calendar | 日历名称或ID(默认:主) |
--json | 输出为NDJSON:数组每行打印一个对象;单个物体印刷得很漂亮 |
--stream / --ndjson | 别名为 --json |
--port | CDP端口(默认值:9250) |
运作原理
两个API层
第1层:后端HTTP API (superhumanFetch JWT)
使用缓存的JWT令牌工作——初始身份验证后不需要超人应用程序。
| 操作 | 端点 |
|---|---|
| 列出收件箱 | 门户RPC threadInternal.listAsync |
| 搜索(FTS) | 门户RPC searchTable.query (SQLite FTS3) |
| 搜索(AI) | POST /v3/ai.askAIProxy (语义,与 --ai) |
| 发送电子邮件 | POST /messages/send |
| 草稿 | POST /v3/userdata.writeMessage |
| AI作曲 | POST /v3/ai.compose |
| Snooze | POST /reminders/create, POST /reminders/cancel |
| 附件(上传) | POST /v3/attachments.upload |
| 附件(列表) | 本地SQLite OPFS blob(无API调用) |
| 附件(下载) | Gmail API/MS图表(存储的OAuth令牌) |
| 代码段 | 超人后端API |
第2层:门户RPC (portal.invoke 通过CDP Runtime.evaluate)
需要运行超人应用程序。通过应用程序自己的OAuth会话进行代理。
| 操作 | 门户服务 |
|---|---|
| 收件箱列表 | threadInternal.listAsync |
| 阅读帖子 | threadInternal.listAsync |
| 存档/删除 | threadInternal.modifyLabels |
| 标签/星 | threadInternal.listAsync (主演), runtimeEvaluate (标签) |
| 读取状态 | threadInternal.modifyLabels |
| 日历(谷歌) | gcal.* (列表、创建、更新、删除、忙/闲) |
| 日历(微软) | backend.requestMicrosoftCalendar (MS Graph代理) |
故障弱化
- 容器/无头:通过缓存的JWT发送、人工智能搜索、人工智能撰写、草稿、打盹、附件、片段
- 运行超人应用程序:完整功能,包括收件箱列表、标签、星号、存档、日历
客户数据平台
Chrome DevTools协议用于:
account auth--从超人身上提取JWTstatus--检查超人连接- 门户RPC--运行时评估搜索、标签、日历操作
好处
- 简单身份验证:单一超人JWT,无OAuth令牌管理
- 按需刷新:令牌过期时通过CDP自动刷新
- 无外部依赖关系:无MCP服务器,API供应商最少使用(仅限附件下载)
- 多账户:适用于Gmail和Microsoft/Outlook帐户
超人的官方MCP服务器
超人运送官方MCP服务器(@superhuman/mcp-mail)at mcp.mail.superhuman.com。这是一个远程MCP(通过HTTP传输 mcp-remote)--不需要本地二进制文件。
官方MCP工具(v1.0.22026年3月)
| 工具 | 说明 |
|---|---|
list_threads | 使用结构化过滤器(从、到、主题、标签、日期)搜索线程 |
query_email_and_calendar | 通过电子邮件和日历进行自然语言/语义搜索 |
create_or_update_draft | 使用您的语音和语调创建或编辑草稿 |
send_draft | 发送电子邮件(智能发送、计划发送、撤消发送) |
create_or_update_event | 创建和更新日历事件 |
update_preferences_email_and_calendar | 更新写作风格、活动偏好、起草事实 |
此CLI添加了什么
| 功能 | 官方MCP | 此CLI |
|---|---|---|
| 搜索(关键词FTS+AI) | ✓ | ✓ |
| 阅读完整的帖子内容 | -- | ✓ |
| 回复/全部回复/转发 | -- | ✓ |
| 存档/删除/回收站 | -- | ✓ |
| 标记为已读/未读 | -- | ✓ |
| 星/非星 | -- | ✓ |
| Snooze/Unsnooze | -- | ✓ |
| 标签(列出、添加、删除) | -- | ✓ |
| 附件(上传、列表、下载) | -- | ✓ |
| 代码段(列表、使用、发送) | -- | ✓ |
| 草稿(创建、列出、更新、删除、发送) | 部分 | ✓ |
| 日历(列表、创建、更新、删除、忙/闲) | 部分 | ✓ |
| AI撰写/询问AI | -- | ✓ |
| 联系人搜索 | -- | ✓ |
| 多账户切换 | -- | ✓ |
| 无头/集装箱模式 | -- | ✓ |
官方MCP值得跟踪-如果Superhuman添加读取、回复和线程管理,它可以取代这里的后端API层。监控进度 超人/mcp邮件.
许可证
麻省理工学院
