mcpField
I
imsg

imsg

github.com/joelhooks生产力6541 次安装2 天前更新
代码仓库

关于 imsg

imsg 是使用 imsg 命令行工具在终端读取和发送 iMessage 与 SMS 的技能,适合需要通过 Messages.app 处理消息的工作流。它提供聊天列表、历史记录、消息监听和附件发送等操作,并说明读取权限与发送确认要求。

主要功能

  1. 01列出聊天并读取消息历史
  2. 02监听新消息及附件
  3. 03向邮箱或电话号码发送消息
  4. 04发送文件附件
  5. 05说明权限要求与发送安全规则

适用场景

  1. 01查看聊天记录并解析为 JSON
  2. 02等待指定聊天中的新消息
  3. 03发送消息或文件附件

MCP 相关

README 还描述了 Flagg 上通过 Executor 调用 iMessage MCP 服务的方式,可用于状态、聊天、历史记录和发送操作。发送工具需要明确批准收件人和文本。

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/joelhooks/joelclaw --skill imsg

安装后在 Claude Code 中输入/imsg确认已加载。

附带文件agents/openai.yaml

详细介绍

iMessage

通过 imsg CLI 在终端中读取和发送 iMessage 与 SMS。

设置(Panda)

  • Messages.app 登录账号:Agent 的 Apple ID(参见 USER.md)
  • Joel 的 iMessage 地址:参见 USER.md → imessage
  • 读取操作(chats、history、watch)需要为终端授予完全磁盘访问权限
  • 发送操作需要 Messages.app 的自动化权限
  • imsg send 会乐观地返回 "sent"——这表示 AppleScript 已触发,不代表已确认送达

命令

列出聊天
imsg chats --limit 10 --json
读取历史记录
imsg history --chat-id <id> --limit 20 --attachments --json
监听新消息
imsg watch --chat-id <id> --attachments
发送
# By email (iMessage)
imsg send --to "[email protected]" --text "hello"

# By phone number (iMessage or SMS)
imsg send --to "+18005551234" --text "hello"

# With file attachment
imsg send --to "[email protected]" --text "see attached" --file /path/to/file.jpg

送达说明

  • CLI 返回 "sent" = AppleScript 已成功将消息交给 Messages.app
  • Messages.app 中显示 "Not delivered" = 实际送达失败(授权问题、收件人离线等)
  • 缺少完全磁盘访问权限 = 读取命令会失败并返回 permissionDenied;通过 AppleScript 发送仍可正常工作
  • 消息显示为来自 Agent 的 Apple ID,而非 Joel

发送给 Joel

Joel 的 iMessage 地址位于 USER.md(imessage 字段)。使用该地址直接通知他:

imsg send --to "<joel-imessage>" --text "your message"

安全

  • 默认只读——发送前先使用 chats 和 history
  • 执行 imsg send 前,务必确认收件人和消息文本
  • 所有读取操作优先使用 --json 标志(便于确定性解析)

安装

brew install steipete/tap/imsg

致谢

CLI 由 steipete 开发。根据 ADR-0067 采用。

Flagg:通过 Executor 使用 imsg

在 Flagg 上,不要在终端中调用 imsg 进行读取。请使用 Executor 保存的连接,它会运行一个已签名的服务,并持有完全磁盘访问权限。

  • 地址:tools.imsg.org.flaggImsg.<tool>。使用 tools.search({ namespace: "imsg", query: "" }) 进行发现。
  • 工具:imsg_status、imsg_chats、imsg_group、imsg_history、imsg_send。先调用 imsg_status。
  • 服务:LaunchAgent com.joel.imsg-mcp,运行于 127.0.0.1:4793;代码位于 packages/imsg-mcp,应用包位于 /Applications/imsg-mcp.app。
  • imsg_send 需要 Joel 明确批准收件人和文本。在 Executor 中,对该工具设置 org require_approval 策略是预期行为;请检查 Tools 选项卡。附件只能来自 ~/.joelclaw/imsg-outbox 或 /tmp。如果发送进程被终止,会返回“结果未知”,因此重试前请检查 Messages.app。
  • 健康检查:curl -s http://127.0.0.1:4793/healthz 和 launchctl print gui/501/com.joel.imsg-mcp。使用 launchctl kickstart -k gui/501/com.joel.imsg-mcp 重启。
  • Bearer:agent-secrets 中的 imsg_mcp_bearer_token。切勿打印它。
  • 仅 Joel 授予的权限:为 /Applications/imsg-mcp.app 授予完全磁盘访问权限(每次重新签名后都要重新切换),并在首次发送时为 Messages.app 授予自动化权限。

完整回执:~/Code/joelhooks/dark-wizard/.brain/projects/imsg-mcp-executor-2026-09.svx。

评论

支持 Markdown