Skip to main content

speech-bubble-mcp

Lettering for comics and manga videos, as an MCP server: speech bubbles, thought bubbles, caption boxes, shouts and whispers, drawn onto a still page or animated over a video shot. Runs on the CPU, with no model, no network and no API key.

The connected AI harness does the thinking -- which line goes in which shot, where the speaker stands, any translation -- and this server does the mechanical part: fitting the type, drawing the balloon, aiming the tail and timing the fades.

GPU none
Python 3.10+
Video any ffmpeg (decode and encode only, no filters needed)
Languages English, Japanese (vertical or horizontal), Chinese, Korean

Install

From PyPI (simplest)

With uv installed, there is nothing to clone:

claude mcp add -s user speech-bubble -e SPEECH_BUBBLE_FFMPEG=/path/to/ffmpeg -- uvx speech-bubble-mcp

or pip install speech-bubble-mcp and register the speech-bubble-mcp command. Installed this way, styles, saved lettering and output go to ~/speech-bubble-mcp/. The layout page is the speech-bubble-layout command.

From the repo

git clone https://github.com/tobiasfong/webcomic-toolkit
cd webcomic-toolkit/servers/speech-bubble-mcp
python -m venv .venv
.venv/Scripts/python.exe -m pip install -r requirements.txt   # Windows
# .venv/bin/python -m pip install -r requirements.txt         # macOS / Linux

Register it with your harness, for example Claude Code:

claude mcp add -s user speech-bubble -e SPEECH_BUBBLE_FFMPEG=/path/to/ffmpeg -- \
  /path/to/speech-bubble-mcp/.venv/Scripts/python.exe /path/to/speech-bubble-mcp/server.py

Check it with check_status: it reports the ffmpeg it found, a font for each language, and where it writes.

Tools

tool what it does
set_project_style one project's fonts, type size, colors, uppercase, vertical Japanese, reading order, thought style
get_project_style the saved and the effective style
parse_script NAME: line, NAME (thought): line, CAPTION: line script -> bubble entries, words untouched
fit_text the line breaks and size a line would get, without drawing -- checks a translation fits
letter_image letters a still: the lettered PNG, the bubbles alone on a transparent layer, and a saved spec
letter_video animates bubbles over a clip or a still; preview_at renders single frames first
list_lettering, get_lettering saved specs; re-render one in another language by name
check_status ffmpeg, fonts, output folders

Placing bubbles by hand: the layout page

Auto-placement cannot tell a face from calm art, and a bubble over a face is the first thing an author rejects. For a whole episode, layout_server.py puts every shot on one local page, each on the frame its bubbles are held on, lettered by the same drawing code the encode uses:

  • drag a bubble to move it (at)
  • drag the bar on its right edge to resize it; the text re-wraps (max_width)
  • drag the dot to aim its tail (tail)

Every drop re-renders that shot and saves to the layout file at once. Words are never edited on the page.

python layout_server.py <layout.json> [port]      # http://127.0.0.1:8766/
speech-bubble-layout <layout.json> [port]         # the same, when installed from PyPI

The layout file is {"project", "lang", "shots": [{"id", "frame", "script", "bubbles": [...]}]}, with frame the path of that shot's hold frame. Build it with recommended placements (below each speaker, captions top-left), let the author drag, then letter each shot from it with letter_video.

The page doubles as a frame check: a shot's last frame is held on screen for seconds once lettered, and a torn final frame from a video model, invisible in motion, is plain as a still. A replaced hold frame shows on the next reload.

A bubble

{"id": "l3",
 "kind": "speech",
 "text": {"en": "Wait. You think I came here for the money?", "zh": "等等。你以为我是为了钱来的?"},
 "at": [0.30, 0.25],
 "tail": [0.42, 0.55],
 "start": 1.2, "in": "fade"}
  • kind: speech, thought, caption, shout, whisper. A project's thought_style draws thoughts as a cloud (bumps and a trail of dots, the default) or a manga flash (a white body ringed with radiating lines, no outline and no tail).
  • at: the bubble's center as fractions of the frame, or a name (top-left, top, top-right, left, center, right, bottom-left, bottom, bottom-right). Omit it to auto-place on calm art near the speaker.
  • tail: the speaker's mouth or head, as fractions, or left, right, center, far-left, far-right. Omit it for no tail.
  • Video only: start, end (seconds; default is one after another by reading time -- 24 English characters or 7 CJK characters a second, at least 1.2 s -- staying to the end of the shot), read (seconds, to override one bubble's reading time), in (fade, slide-up, slide-down, slide-left, slide-right, pop, none), out (none or fade).
  • Optional: scale (a shout uses 1.15), font, max_width, vertical / horizontal to force Japanese one way.

An explicit newline in text is always kept: that is how a line is broken at the phrase the writer wants.

Where things go

  • Lettered images: ../character-panel-mcp/output/<project>/lettered/
  • Lettered videos: ../anime-production-mcp/output/<project>/lettered/, with each bubble as a transparent PNG in <name>_<lang>_bubbles/
  • Specs and styles: state/ (gitignored -- dialogue carries character names)

Installed on its own, without those sibling servers, it writes to output/. SPEECH_BUBBLE_STATE, SPEECH_BUBBLE_IMAGE_OUT and SPEECH_BUBBLE_VIDEO_OUT override each location.

How it works

  • The bubble follows the text. One type size for a whole project; the balloon is fitted around the words, never the words squeezed into a balloon. Line breaks are chosen by trying every line count and keeping the tightest ellipse, which gives the short-long-short shape of hand lettering.
  • Drawn twice, outlined once. Each shape is a set of primitives drawn grown by the stroke in the outline color, then at size in the fill color, so a tail, a cloud's bumps or a burst's spikes share one clean outline. Drawn at 3x and downsampled.
  • Video frames are composited here, in Pillow. ffmpeg only decodes and encodes, so a reduced ffmpeg build works. The preview and the encode call the same function, so an approved preview is what renders.

Troubleshooting

  • No ffmpeg found -- only video needs it. Set SPEECH_BUBBLE_FFMPEG.
  • Tofu boxes instead of characters -- the font lacks that script. Set one per language with set_project_style(fonts={"zh": "..."}).
  • Bubble has no 'ja' text -- the spec has no line in that language yet; translations are added to text as a per-language map.
  • A bubble runs off the frame -- allowed, and reported as off_frame. Pin it with at if it should not.

Tests

.venv/Scripts/python.exe test_tools.py

Synthetic art in a temporary folder; video checks need ffmpeg. They compare rendered frames against the source and against a still lettered by the other code path, so they check what was encoded, not what was planned.

Metadata

Release files for speech-bubble-mcp 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for speech-bubble-mcp 0.2.0
File Size Uploaded Provenance Actions
speech_bubble_mcp-0.2.0.tar.gz 44.4 kB With provenance Details for speech_bubble_mcp-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for speech-bubble-mcp 0.2.0
File Interpreter ABI Platform Actions
speech_bubble_mcp-0.2.0-py3-none-any.whl Python 3 none any Details for speech_bubble_mcp-0.2.0-py3-none-any.whl

Total release size: 90.0 kB

Release files / speech_bubble_mcp-0.2.0.tar.gz

Download URL speech_bubble_mcp-0.2.0.tar.gz
Size 44.4 kB
Tags Source
SHA-256 checksum
How to use checksums
614b4ff8a67634901f3915e4b7259bcfe83204bf9f4cf5a6c716704b99bde5e0
BLAKE2b-256 checksum
How to use checksums
4e096b56491b58e267705b18d03520687814eecd41d1a51fab35eb97580b8f0e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Release files / speech_bubble_mcp-0.2.0-py3-none-any.whl

Download URL speech_bubble_mcp-0.2.0-py3-none-any.whl
Size 45.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0839d1d7e1b2557c2ce41a97496c1f495d4c3d02c74d8b9f21c6fecc38d50a59
BLAKE2b-256 checksum
How to use checksums
64820b6e1ce5615c766ffb8f319b5818bfc25cc69c2663ae6aa06ec775e1a828
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Security for speech-bubble-mcp 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for speech_bubble_mcp-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page