本文记录通过cc-connect将微信个人号与 Claude Code Agent 打通的完整操作步骤包括扫码登录、配置写入、权限限制和启动验证。准备工作环境要求条件说明cc-connect 已安装并可执行无需公网 IPilink 由云端提供Claude Code Agent 已配置指向你的工作目录微信手机端用于扫码完成 ilink 登录理解 cc-connect 的工作模型cc-connect 通过config.toml管理多个「项目project」每个项目包含agent底层执行引擎如claudecode配置工作目录和运行模式platforms消息来源平台如feishu、weixin配置对应的认证信息微信个人号通道底层使用腾讯ilink 机器人 HTTP 网关采用getUpdates长轮询 sendMessage下发的方式收发消息。Step 1查看现有配置操作前先确认你的config.toml路径和现有结构。以下是一个已配置飞书平台的典型示例language zh [log] level info [[projects]] name justgotrip [projects.agent] type claudecode [projects.agent.options] work_dir /Users/terry/Downloads/szjz mode default [[projects.platforms]] type feishu [projects.platforms.options] app_id cli_xxxxxxxxxxxx app_secret xxxxxxxxxxxxxxxxxxxxxxxx此时只有飞书平台。目标是新增一个eutopian项目挂载微信平台并将 Claude Code 指向/Users/terry/Downloads/code/eutopian。Step 2扫码登录自动写入 Token微信接入需要通过 ilink 机器人网关获取 Bearer Token。cc-connect 提供了一条命令完成扫码写入的全流程cc-connect weixin setup--projecteutopian--config/path/to/config.toml参数说明参数作用--project eutopian目标项目名若不存在会自动创建并挂上weixin平台--config指定config.toml路径不填则使用默认路径执行后终端会打印 ASCII 二维码同时输出可复制的 URL等待你用手机微信扫码并确认登录扫码成功后自动将token、base_url、account_id等写回config.toml扫码成功后config.toml会自动追加类似以下内容[[projects]] name eutopian [projects.agent] type claudecode [projects.agent.options] work_dir /Users/terry/.cc-connect # 注意此处需要手动修正 mode default [[projects.platforms]] type weixin [projects.platforms.options] token d36404f141edim.bot:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx base_url https://ilinkai.weixin.qq.com account_id d36404f141edim.bot⚠️注意自动写入的work_dir默认为 cc-connect 自身目录需要手动修正为你的实际项目路径。Step 3修正 work_dir将work_dir改为你希望 Claude Code 实际工作的项目目录[projects.agent.options] work_dir /Users/terry/Downloads/code/eutopian # ✅ 修正后 mode default直接编辑config.toml文件找到eutopian项目下的work_dir行并替换即可。Step 4配置 allow_from 和 admin_from启动 cc-connect 后默认不限制任何用户日志会出现警告levelWARN msgallow_from is not set — all users are permitted. levelWARN msgadmin_from is not set — privileged commands are blocked.生产环境强烈建议配置这两个字段。如何获取你的微信用户 ID启动 cc-connect 后用微信给机器人发一条任意消息日志中会出现levelINFO msgmessage received platformweixin usero9cq807tacASJCy5LaJPqx6kbFa4im.wechat sessionweixin:dm:o9cq807tacASJCy5LaJPqx6kbFa4im.wechatuser字段即为你的 ilink 用户 ID格式为xxxxxim.wechat。写入配置[projects.platforms.options] token d36404f141edim.bot:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx base_url https://ilinkai.weixin.qq.com account_id d36404f141edim.bot allow_from o9cq807tacASJCy5LaJPqx6kbFa4im.wechat # 限制只允许此用户 admin_from o9cq807tacASJCy5LaJPqx6kbFa4im.wechat # 允许使用管理命令字段说明字段说明allow_from允许与机器人对话的用户 ID多个用英文逗号分隔*表示不限制不安全admin_from允许执行/shell、/show、/dir、/restart、/upgrade等特权命令的用户 IDStep 5完整 config.toml 示例配置完成后完整的config.toml结构如下language zh [log] level info # ── 项目一justgotrip飞书────────────────────────────────── [[projects]] name justgotrip [projects.agent] type claudecode [projects.agent.options] work_dir /Users/terry/Downloads/szjz mode default [[projects.platforms]] type feishu [projects.platforms.options] app_id cli_xxxxxxxxxxxx app_secret xxxxxxxxxxxxxxxxxxxxxxxx # ── 项目二eutopian微信─────────────────────────────────── [[projects]] name eutopian [projects.agent] type claudecode [projects.agent.options] work_dir /Users/terry/Downloads/code/eutopian mode default [[projects.platforms]] type weixin [projects.platforms.options] token d36404f141edim.bot:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx base_url https://ilinkai.weixin.qq.com account_id d36404f141edim.bot allow_from o9cq807tacASJCy5LaJPqx6kbFa4im.wechat admin_from o9cq807tacASJCy5LaJPqx6kbFa4im.wechatStep 6启动 cc-connectcc-connect start--config/path/to/config.toml正常启动日志应包含levelINFO msgplatform ready projectjustgotrip platformfeishu levelINFO msgengine started projectjustgotrip agentclaudecode platforms1 levelINFO msgplatform ready projecteutopian platformweixin levelINFO msgengine started projecteutopian agentclaudecode platforms1 levelINFO msgcc-connect is running projects2两个项目均显示platform ready即为成功。Step 7触发首次 context_token 关联微信通道有一个重要的初始化步骤首次连接时必须先发一条消息触发 context_token 关联之后才能正常使用/new、/reset等指令。操作步骤cc-connect 启动后用微信向机器人发任意一条消息如「你好」等待机器人回复首次响应约需 10-15 秒关联完成后即可正常使用常见问题 FAQQ1扫码超时或无反应# 增加超时时间重试cc-connect weixin setup--projecteutopian--timeout600检查网络是否能访问https://ilinkai.weixin.qq.com也可用--api-url指定其他网关地址。Q2已有 Token不想重新扫码cc-connect weixinbind--projecteutopian--token你的_Bearer_TokenQ3启动后收不到消息按顺序排查确认allow_from是否包含你的用户 ID确认进程已重启修改配置后需要重启确认已完成首次 context_token 关联向机器人发一条消息Q4如何同时运行多个微信账号在同一项目下添加多个weixin平台时用account_id区分[[projects.platforms]] type weixin [projects.platforms.options] token 账号1的token account_id account_1 # 隔离本地状态目录 [[projects.platforms]] type weixin [projects.platforms.options] token 账号2的token account_id account_2用--platform-index参数指定扫码写入到哪个平台cc-connect weixin setup--projecteutopian --platform-index2Q5如何排除微信通道精简编译go build-tagsno_weixin ./cmd/cc-connect微信通道能力一览能力支持情况文字消息收发✅引用消息✅语音转写文本STT✅需配置语音转写 ffmpeg图片接收AES-128-ECB 解密✅需配置cdn_base_url文件接收✅视频接收✅出站图片发送✅通过cc-connect send --image出站文件发送✅通过cc-connect send --file可选配置项速查[projects.platforms.options] token # 必填Bearer Token base_url https://ilinkai.weixin.qq.com # 可选默认同左 cdn_base_url https://novac2c.cdn.weixin.qq.com/c2c # 可选媒体 CDN allow_from # 建议填写限制使用者 admin_from # 建议填写开启管理命令 account_id default # 多账号时区分状态目录 route_tag # 运营商要求时填写 long_poll_timeout_ms 35000 # 长轮询超时默认 35s proxy # 可选 HTTP 代理相关资源cc-connect 仓库github.com/chenhg5/cc-connect微信通道文档docs/weixin.md企业微信通道不同协议docs/wecom.md完整配置示例config.example.toml