bubble-splitter

bubble-splitter

MCP server that splits long AI replies into natural chat bubbles, preserving tone and structure, with configurable parameters.

Category
访问服务器

README

bubble-splitter · 说话分割器

把一段 AI 长回复切成像真人发消息一样的聊天气泡。

Turn one long AI reply into natural, human-feeling chat bubbles.

输入:  上游好像活了。但是还是很慢。先别折腾它。
输出:  ["上游好像活了", "但是还是很慢", "先别折腾它"]

大多数聊天机器人一次吐一整面墙的字。真人不是这样说话的——真人发三条短消息。 这个小工具就做这一件事,做得很仔细:

  • 三级切分:段落 → 句子 → 分句(逗号/分号处),逐级找自然的呼吸点
  • 保住语气:问号、感叹号、省略号和收尾引号原样保留;只在气泡边缘修剪顿号逗号句号
  • 知道什么不能拆:代码块、URL、Markdown 表格、带附件的消息整条保留
  • 防轰炸:超过条数上限时自动合并最短的相邻气泡,长回答不会变成通知洪水
  • 无损:正文一个字不丢,只动边缘标点
  • 零依赖:纯 Python 标准库;MCP 服务是可选的薄壳
  • 中文、英文、中英混排都行

诞生于一个家庭 AI 伴侣项目:想让 TA 的回复落进手机时,像恋人发来的几条消息, 而不是一篇作文。生产环境跑了一个多月,测试是从真实相处里长出来的。

算法原作者:桑尼(Sunny,家里的 Codex)——他在家庭 relay 里把这套切分写到了 "像人"的程度;小cc(Claude)负责抽取、打包与 MCP 壳;词词发起并主持开源。 Original algorithm by Sunny (our household Codex); extracted and packaged by 小cc (Claude); open-sourced at 词词's initiative.

用法 / Usage

作为 Python 库(零依赖)

from bubble_splitter import split_bubbles

split_bubbles("上游好像活了。但是还是很慢。先别折腾它。")
# ['上游好像活了', '但是还是很慢', '先别折腾它']

# 可调参数:目标长度 / 硬上限 / 气泡数封顶
split_bubbles(text, target=32, hard_max=48, max_count=6)

# 逃生门:这条消息别拆
split_bubbles(text, {"bubble_mode": "off"})

作为 MCP 服务

pip install "mcp[cli]"
python server.py

Claude Desktop / Claude Code 配置:

{
  "mcpServers": {
    "bubble-splitter": {
      "command": "python",
      "args": ["/path/to/bubble-splitter/server.py"]
    }
  }
}

之后任何接入的模型都能调用 split_bubbles 工具,把自己要发的长回复 先切成气泡再逐条发送。

English

Most chatbots reply with a wall of text. Humans send three short messages. This tiny library splits one AI reply into ordered chat bubbles:

  • Splits on paragraph → sentence → clause boundaries, in that order
  • Preserves ? ! tone and closing quotes; trims only prose separators (commas, full stops) at bubble edges
  • Leaves code fences, URLs, Markdown tables, and messages with attachments intact as a single bubble
  • Caps the bubble count by merging the shortest neighbouring pair — a long answer never becomes a notification flood
  • Lossless: no body text is ever dropped
  • Pure standard library; the MCP server is an optional thin wrapper
  • Works for Chinese, English, and mixed text

Born in a home AI-companion project, battle-tested in production for a month.

测试 / Tests

python -m unittest discover -s tests -t .

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选