MCP(模型上下文协议)服务器实现,集成 Kakao 开发者 API,以连接 AI 代理到 Kakao 官方账号。
这是一个 MCP 服务器实现示例,它将 Kakao 开发者 API 集成到 AI 代理中。
<br><br>[!NOTE] 本仓库并非由 Kakao 官方提供或维护。<br> 可能不包括完整的功能或全面的支持。<br> 对于大多数 API,Kakao 通常以包含企业注册信息的企业应用程序为单位来管理权限,因此对于个人用户来说可能具有一定的限制性。
参考文档:https://developers.kakao.com/docs/latest/ko/kakaotalk-message/rest-api
通过 claude desktop 运行 MCP 工具
<img src="https://gips0.baidu.com/it/u=1581137802,4133899476&fm=3081&app=3081&f=PNG?w=850&h=1136" alt="截图_2025-05-03_下午_2.37.25" width="330"> <br>“发送消息给我”结果
所有工具都需要 __email_address__ 输入来识别用户的凭证。
send_text_template_to_me
__email_address__ (字符串,必需):与 Kakao 账户关联的电子邮件地址。text (字符串,必需,最大 200 字符):消息的文本内容。link (对象,必需):定义与文本关联的链接的对象。
web_url (字符串,可选,uri 格式)mobile_web_url (字符串,可选,uri 格式)button_title (字符串,可选):按钮的标题。send_feed_template_to_me
__email_address__ (字符串,必需)content (对象,必需):动态消息的主要内容块。
title (字符串,必需)description (字符串,必需)image_url (字符串,必需,uri 格式)image_width (整数,可选)image_height (整数,可选)link (对象,必需) - 定义内容的链接
web_url (字符串,可选,uri 格式)mobile_web_url (字符串,可选,uri 格式)android_execution_params (字符串,可选)ios_execution_params (字符串,可选)item_content (对象,可选):动态消息的附加项目内容。(参见 API 文档中的嵌套结构)social (对象,可选):社交信息,如点赞、评论等。(参见 API 文档中的嵌套结构)buttons (对象数组,可选):要包含在消息中的按钮。(每个对象需要 title 和 link)send_list_template_to_me
__email_address__ (字符串,必需)header_title (字符串,必需):列表顶部显示的标题。contents (对象数组,必需):一个内容项列表。每个项需要:
title (字符串,必需)description (字符串,必需)image_url (字符串,必需,uri 格式)image_width (整数,可选)image_height (整数,可选)link (对象,必需) - 定义列表项的链接
web_url (字符串,可选,uri 格式)mobile_web_url (字符串,可选,uri 格式)android_execution_params (字符串,可选)ios_execution_params (字符串,可选)header_link (对象,可选):头部区域的链接。(参见 API 文档中的嵌套结构)buttons (对象数组,可选):要包含在消息中的按钮。(每个对象需要 title 和 link)send_location_template_to_me
__email_address__ (字符串,必需)content (对象,必需):地址消息的主要内容块。
title (字符串,必需)description (字符串,必需)image_url (字符串,必需,uri 格式)image_width (整数,可选)image_height (整数,可选)link (对象,必需) - 定义内容的链接
web_url (字符串,可选,uri 格式)mobile_web_url (字符串,可选,uri 格式)android_execution_params (字符串,可选)ios_execution_params (字符串,可选)address (字符串,必需):地址。buttons (对象数组,可选):要包含在消息中的按钮。(每个对象需要 title 和 link)address_title (字符串,可选):地址的标题。send_calendar_template_to_me
__email_address__ (字符串,必需)content (对象,必需):日历消息的主要内容块。
title (字符串,必需)description (字符串,必需)link (对象,必需) - 定义内容的链接
web_url (字符串,可选,uri 格式)mobile_web_url (字符串,可选,uri 格式)android_execution_params (字符串,可选)ios_execution_params (字符串,可选)image_url (字符串,可选,uri 格式)id_type (字符串,必需,枚举:"event"):日历项目的类型。id (字符串,必需):日历项目的 ID。buttons (对象数组,可选):要包含在消息中的按钮。(每个对象需要 title 和 link)send_commerce_template_to_me
__email_address__ (字符串,必需)content (对象,必需):商业消息的主要内容块。
title (字符串,必需)image_url (字符串,必需,uri 格式)image_width (整数,可选)image_height (整数,可选)link (对象,必需) - 定义内容的链接
web_url (字符串,可选,uri 格式)mobile_web_url (字符串,可选,uri 格式)android_execution_params (字符串,可选)ios_execution_params (字符串,可选)commerce (对象,必需):特定于商业的信息。
regular_price (整数,必需)discount_price (整数,可选)discount_rate (整数,可选,0-100)buttons (对象数组,可选):要包含在消息中的按钮。(每个对象需要 title 和 link)get_calendar_list
__email_address__ (字符串,必需):与 Kakao 账户关联的电子邮件地址。create_sub_calendar
__email_address__ (字符串,必需):与 Kakao 账户关联的电子邮件地址。name (字符串,必需):子日历的名称。color (字符串,可选):日历事件的默认颜色。reminder (整数,可选):非全天事件的默认提醒时间(分钟)。reminder_all_day (整数,可选):全天事件的默认提醒时间(分钟)。update_sub_calendar
__email_address__ (字符串,必需):与 Kakao 账户关联的电子邮件地址。calendar_id (字符串,必需):要更新的子日历的 ID。name (字符串,可选):子日历的新名称。color (字符串,可选):日历事件的新默认颜色。reminder (整数,可选):非全天事件的新默认提醒时间(分钟)。reminder_all_day (整数,可选):全天事件的新默认提醒时间(分钟)。delete_sub_calendar
__email_address__ (字符串,必需):与 Kakao 账户关联的电子邮件地址。calendar_id (字符串,必需):要删除的子日历的 ID。需求:Python 3.13+
需要 Kakao 账户
创建 Kakao 新应用程序的方法,请参阅 快速入门 文档。
<details> <summary>激活消息 API 的额外操作</summary>在“我的应用程序 > 应用设置 > 平台”的 Web 中,将站点域名注册为 http://localhost:8000
<br>注册业务应用。即使没有企业编号,也可以注册“个人开发者业务应用”。
<br>激活 Kakao 登录。
<br>本地需要安装 uv。
git clone git@github.com:inspirit941/kakao-bot-mcp-server.git
cd kakao-bot-mcp-server
pip install uv
uv sync
# 运行 inspector
npx @modelcontextprotocol/inspector uv --directory . run mcp-kakao
# 运行 MCP 服务器
uv run mcp-kakao
正常运行需要两个文件:.accounts.json 和 .kauth.json,在项目根目录下创建这些文件。
.accounts.json
{
"accounts": [
{
"email": "your-email@kakao.com",
"account_type": "personal",
"extra_info": "要告诉 Claude 的附加信息:例如 '包含家庭日历'"
}
]
}
.kauth.json
{
"web": {
"client_id": "rest-api-key",
"auth_uri": "https://kauth.kakao.com/oauth/authorize",
"token_uri": "https://kauth.kakao.com/oauth/token",
"client_secret": "your_client_secret",
"redirect_uris": ["http://localhost:8000/code"],
"revoke_uri": "https://kapi.kakao.com/v2/user/revoke/scopes",
"token_info_uri": "https://kauth.kakao.com/oauth/tokeninfo"
}
}
Claude desktop 设置
{
"mcpServers": {
"mcp-kakao": {
"command": "uv",
"args": [
"--directory",
"your-project-path/kakao-bot-mcp-server",
"run",
"mcp-kakao"
]
}
}
}
工作原理
<br>当 LLM 执行 MCP 工具时,
.oauth2.<Kakao邮件地址>.json 文件。
.oauth2.<Kakao邮件地址>.json 的名称保存访问令牌信息。MCP 工具使用 JSON 文件中的访问令牌。