Skip to main content
Glama
hedgehogcandy

kakao-channel

kakao-channel-chat

非官方(Unofficial)。 这是对 Kakao 频道管理中心(Business Chat,内部代号 "rocket")的未公开内部 API 进行逆向工程的产物。它不是 Kakao 的官方产品,规格可能在毫无预告的情况下发生变化并失效,也可能与 Kakao 的服务条款相冲突。请仅在自动化你自己拥有的频道场景下使用,并自行承担责任。 详见 DISCLAIMER

复用已登录的浏览器会话,用代码操作 Kakao 频道聊天的 Node 工具包。
提供 API 库 · CLI · MCP 服务器 三种形式。外部运行时依赖只有 MCP SDK 一个(库/CLI 为零依赖)。

支持的功能

  • 登录状态检查 & token 无限续期(会话不中断)

  • 聊天室列表 + 区分已读/未读 + 聊天室 deep link

  • 会话记录查询(区分我方/客户/系统消息,提取链接)

  • 标记已读发送消息(回复)

  • 实时监控新消息(SSE / 轮询)

  • 常驻守护进程(token 自动续期 + keepalive + 监控 + 可选自动回复)

  • MCP 服务器 — 可在 Claude、Cursor 等工具中使用

Related MCP server: @chatmaid/mcp

工作原理

Kakao 频道聊天 API(business.kakao.com/api/*只用一个 kakao 登录 Cookie 就能认证(无需额外 token)。本工具会获取有效的 kakao 会话 Cookie,然后直接调用该 API。逆向得到的完整端点可参见 API.md

3 种认证方式(任选一种)

1) macOS + Chrome 自动提取(默认)
只需 Chrome 已登录目标频道,即可从 Cookie 存储中自动提取会话(含 HttpOnly Cookie)。无需额外配置。

node bin/kbc.js whoami   # 그냥 실행하면 됨(macOS)

2) Playwright 自行登录(跨平台 · 无头 · 推荐)
工具会用自己的浏览器完成登录并持有会话,因此非 macOS 环境、服务器环境也能运行。2FA/验证码只在首次自行处理一次。

npm i playwright && npx playwright install chromium
node bin/kbc.js login          # 브라우저가 열림 → 카카오 로그인(2FA 포함) → 세션 저장
KBC_AUTH=playwright node bin/kbc.js whoami   # 이후 저장된 세션 사용
  • 会话保存在 .kbc-auth/state.json(已加入 gitignore)中。daemon 会定期访问站点,让会话保持不过期

  • 自动重新登录:当会话完全失效,守护进程会检测到 → 重新弹出登录浏览器(只需手动处理 2FA)→ 自动恢复。无头/服务器环境下重新运行 kbc login,守护进程会自动捕获新会话并恢复,无需重启。

3) 直接注入 Cookie

KBC_COOKIE="_kawlt=...; _kawltea=...; ..." node bin/kbc.js whoami

(从浏览器 DevTools → Network → 复制请求的 Cookie 头,或使用 “Copy as cURL”)

系统要求

  • Node ≥ 20.12

  • 如果要使用 Cookie 自动提取:需要 macOS + Google Chrome 已登录目标 Kakao 频道(内部使用 /usr/bin/sqlite3 + Keychain,macOS 自带)

  • 其他 OS/浏览器:可通过手动注入 KBC_COOKIE 使用

安装

git clone <this-repo>
cd kakao-channel-chat
npm install
cp .env.example .env      # KBC_PROFILE_ID 채워넣기

.env

KBC_PROFILE_ID=_XXXXX     # 관리자센터 URL business.kakao.com/{이값}/chats 의 {이값}
# KBC_CHROME_PROFILE=Default   # (선택) 여러 Chrome 프로필 중 지정. 미지정 시 자동탐지
# KBC_COOKIE=...               # (선택) 쿠키 자동추출 대신 직접 주입

CLI 用法

node bin/kbc.js whoami                 # 로그인 상태
node bin/kbc.js token                  # 토큰 리프레시(무한로그인 확인)
node bin/kbc.js unread                 # 안읽은 방 (링크 포함)
node bin/kbc.js list --json            # 전체 방 (JSON)
node bin/kbc.js logs <chatId>          # 대화내역
node bin/kbc.js mark <chatId>          # 읽음 처리
node bin/kbc.js send <chatId> "<text>" --yes    # ⚠️ 실제 발송
node bin/kbc.js watch --poll           # 실시간 감시
node bin/kbc.js daemon                  # 상시 구동(토큰 무한유지+감시)
node bin/kbc.js daemon --autoreply      # + 안읽은 새 메시지 자동응답

库的使用

import { KakaoBizChatClient } from './src/client.js';

const c = new KakaoBizChatClient({ profileId: process.env.KBC_PROFILE_ID }); // 쿠키 자동
if ((await c.checkLogin()).loggedIn) {
  const unread = await c.getUnreadChats();               // is_read=false 방들 (+ .link)
  const { items } = await c.getChatlogs(unread[0].id);   // 대화내역 (.from = 'us'|'customer')
  await c.markRead(unread[0].id);
  // await c.sendText(unread[0].id, '답장');              // ⚠️ 실발송
}

实时监控:

import { watchPolling, watchSSE } from './src/push.js';
watchPolling(c, { onMessage: ({ chat }) => console.log('새 메시지', chat.name, chat.last_message) });

MCP 服务器

在 Claude Code / Claude Desktop / Cursor 等工具的 MCP 配置中添加:

{
  "mcpServers": {
    "kakao-channel": {
      "command": "node",
      "args": ["/absolute/path/to/kakao-channel-chat/src/mcp-server.js"],
      "env": {
        "KBC_PROFILE_ID": "_XXXXX",
        "KBC_CHROME_PROFILE": "Default"
      }
    }
  }
}

暴露的工具:kakao_login_statuskakao_unread_countkakao_list_chatskakao_get_chatkakao_get_messageskakao_mark_read
发送工具kakao_send_message)出于安全考虑默认禁用 — 在 env 中添加 KBC_MCP_ALLOW_SEND=1 即可启用。

持续运行(PM2)

在 token 过期前自动续期,并保持会话 不断线 地运行。崩溃时自动重启:

npm i -g pm2
pm2 start ecosystem.config.cjs
pm2 logs kakao-channel
pm2 save && pm2 startup   # 부팅 시 자동 실행

macOS 的 Cookie 自动提取方式需要 Chrome 一直保持登录状态才能无限维持会话(Chrome 会自动刷新 Cookie)。如果要在完全没有 Chrome 的情况下以 headless 方式运行,则需要定期更新 KBC_COOKIE,或自行实现 Kakao SSO refresh 流程。

安全 / 注意事项

  • 详细安全策略见 SECURITY.md — 明确说明会访问什么、不会访问什么。

  • Cookie、token 仅存在于本地,不会发送到外部(通讯仅限 Kakao 域名)。

  • 绝对不要把 .env 和 Cookie 提交到仓库(.gitignore 已包含)。

  • send/--autoreply立即发送给真实客户

  • 请仅用于您自己拥有的频道。

许可证

MIT — LICENSE。Kakao/KakaoTalk 是 Kakao Corp. 的商标,与本项目无关。

A
license - permissive license
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • F
    license
    Not graded
    quality
    F
    maintenance
    Enables interaction with Rocket.Chat instances through MCP protocol. Allows users to manage chat operations and integrate with Rocket.Chat servers using natural language commands.
    6
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables AI tools to read and send messages through LINE Desktop via MCP, supporting manual or automatic sending without official LINE API tokens.
    73
    108
    MIT

View all related MCP servers

Related MCP Connectors

  • Manage feature requests, votes, roadmaps, and changelogs from any MCP client.

  • Official MCP server for OmniDimension. Drive voice agents, dispatch calls, and run bulk campaigns.

  • Managed LinkedIn MCP server for AI agents: search, connect, message and enrich on accounts you own.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/hedgehogcandy/kakao-channel-chat'

If you have feedback or need assistance with the MCP directory API, please join our Discord server