bubble-splitter

bubble-splitter

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

Category
Visit Server

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

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured