Skip to main content
Glama

QQBot Channel for Claude Code

在 QQ 里直接和 Claude Code 对话。通过 QQ 官方机器人 API 收发消息,支持图片识别、文件处理和富媒体回复。

本项目参考:OpenClaw QQBot,初始版本功能有限,欢迎提交PR。

前置条件

  • Bun >= 1.0

  • Claude Code CLI >=2.1.87

  • 在 QQ 开放平台 申请的机器人账号(获取 AppID 和 AppSecret,推荐使用龙虾专用入口申请的机器人)

Related MCP server: QQ MCP

安装

将仓库克隆到本机,以~/qqbot-channel为例:

git clone https://github.com/ZhongtaoWang/qqbot-claude-channel.git ~/qqbot-channel
cd ~/qqbot-channel
bun install

配置

运行一次即可,凭据会写入 ~/.claude.json,对所有项目生效:

claude mcp add qqbot \
  --scope user \
  --env QQ_APPID=你的AppID \
  --env QQ_APP_SECRET=你的AppSecret \
  -- bun ~/qqbot-channel/qqbot.ts

完成后无需在任何工作目录放置配置文件,qqbot 会在所有 Claude Code 会话中自动加载。

如需白名单或沙箱模式,追加 --env QQ_ALLOWED_USERS=openid1,openid2 / --env QQ_SANDBOX=true。

启动

在任意目录运行:

claude --dangerously-load-development-channels server:qqbot

在 QQ 里向机器人发消息即可开始对话。

使用场景

这是一个远程操控 Claude Code 的通道。典型用法:

  • 远程执行任务:在手机 QQ 上给机器人发指令,Claude 在服务器上帮你写代码、改文件、跑脚本

  • 图片分析:发一张截图或照片,Claude 多模态识别后直接回复分析结果

  • 语音交互(TODO):发语音消息,自动转文字后由 Claude 处理

  • 文件处理:发送 PDF、DOCX、代码文件,Claude 读取内容后回复

  • 工具权限审批:Claude 需要执行敏感操作时(如删除文件),会通过 QQ 消息询问你:

    • 回复 yes {id} 允许本次执行

    • 回复 no {id} 拒绝

    • 回复 always {id} 始终允许该工具(本次会话内有效)

环境变量

变量

必填

说明

QQ_APPID

是

QQ 机器人 AppID

QQ_APP_SECRET

是

QQ 机器人 AppSecret

QQ_ALLOWED_USERS

否

用户 openid 白名单,逗号分隔,空则允许所有人

QQ_SANDBOX

否

"true" 使用沙箱 API,默认 "false"

WHISPER_MODEL

否

(TODO)语音识别模型(tiny/base/small/medium/large),默认 base

WHISPER_LANG

否

(TODO)识别语言,默认 zh

STT_API_URL

否

(TODO)外部 STT API 地址(优先于本地 Whisper)

STT_API_KEY

否

(TODO)外部 STT API 密钥

卸载

# 移除 MCP 注册
claude mcp remove qqbot --scope user

# 删除项目代码
rm -rf ~/qqbot-channel

许可

MIT

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables sending QQ messages automatically via Claude Code using Windows UI automation, no Bot API required.
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Enables interaction with QQ through official bot APIs or personal accounts bridged via NapCat/OneBot v11, including status checks, target listing, bounded context retrieval, and plain-text sending to allowlisted conversations.
      5
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables AI agents to control and monitor QQ accounts through the NapCatQQ OneBot 11 protocol, covering private/group messaging, forwards, group administration, file transfer, OCR, friend and profile management, and real-time message listening. It also handles QR-code login, hot-switching between multiple QQ accounts, and one-click self-check, deployment, and updates.
      20
      6
      MIT