Character & Panel Generator — MCP Server
A local Model Context Protocol server for writers
who aren't artists — and for artists who'd rather not redraw the same character six
times before page one. Whether you already have reference art, have a story and
nothing else, or have one good drawing of a character, this tool gets it into a
Character Bible, generates new poses and turnaround views that stay recognizably
the same character, and composites them onto background plates into finished panels
— rendering with FLUX 3 Image Klein
on a local ComfyUI.
v2.0.0 — FLUX 3 Klein only. FLUX.1 has been removed. Its GGUF models, the
manhwa and turnaround LoRAs, ControlNet and Kontext are gone, along with every
model=, lora=, negative= and pose_ref_path= parameter that reached them.
The sibling webcomic-background-mcp made
the same move in its v3.0.0, so plates and figures come from one model. See the
CHANGELOG for what replaced each part.
It's the character-domain sibling of the background server's World Builder: same
philosophy (reference-driven, never generate-from-text-and-pray — the references
are the ground truth for who a character is), same skeleton. No code dependency
between the two servers.
How identity works (read this first)
Every render of a character conditions on their PRIMARY REFERENCE — the image
registered first in the bible, cropped from their approved sheet. The bible's
description goes into the prompt as well, resolved in code, never retyped.
What Klein does with that, measured 2026-10-17 (the repo's AGENTS.md has the
detail):
- Identity holds through a pose change. A new pose is drawn from the art, not
from a description of it.
- Several characters in one render work. Two characters' references in one
render held both identities, re-posed, with no attribute bleed, on 3 of 3 seeds.
generate_scene does this; a full CG comes back with its room and light in one
render.
- ⚠ When the asked-for pose is the one the reference already shows, Klein COPIES
the reference — its flaws and its crop. Tight sheet crops came back cut off at
the head or feet 17 times in 40; padding the reference ~18% on its own backdrop
color fixed all 9 retried.
- There is no ControlNet and no LoRA. Describe a pose in words. Klein's own
style was accepted in place of the old manhwa LoRA, which cannot load (0 of its
494 layers exist in Klein).
- Even a boxed edit redraws the whole frame, so
edit_character_image with a
mask_box pastes back only the box: the change outside it is exactly zero.
- Hands are still the weak point. Reroll the whole render before patching one.
- Renders take 18–90 s on a 6 GB card. Compositing is instant and GPU-free.
What it does
register_character — add (or grow) a character's reference set in the bible.
Calling it again on the same character appends references.
get_character / list_characters / forget_character /
list_projects — browse and curate the bible. Call get_character before
writing any prompt that involves a character.
generate_character_concept / crop_reference — Concept Genesis: get a
character into the bible in the first place (see below).
generate_character_pose — the character alone in a new pose, matted to RGBA.
generate_turnaround_sheet — front, three-quarter, profile and back in ONE
render, each view in its own layout box and cut out exactly by it. Measured: four
true views, no strangers, 0.0% of figure pixels outside the boxes.
generate_reference_sheet — one render per view (front, back, 3/4 expression
close-ups) plus an Avery-style poster.
generate_expression — an expression as a WHOLE new body, rendered from
scratch on a different seed from its base and matted. The body moves with the
mood; a face is never pasted onto the base.
fix_hands / apply_hand_fix — bad hands in one step: each hand cropped
with its sleeve, enlarged 4x, redrawn in a box sized to a natural hand, four
candidates per hand on one sheet labeled by side both ways; then one pick per
hand is pasted in and matted. A hand is ~50 px in a full-body render, too small
for fingers; at 4x it is ~200 px.
touch_up — one small defect (a dented outline, a stray line) redrawn at 6x
in a tight box, built on what is there.
generate_scene — several registered characters in one render.
edit_character_image — re-pose or re-frame from an image (no box), or redraw
one region of it (with a box).
compose_reference_sheet / compose_full_reference_sheet — poster
composers from images you already have. GPU-free.
apply_gradient_background / apply_vfx_overlay — GPU-free finishing.
compose_panel — paste a matted character onto a plate at a feet position and
height. Zero GPU, zero tokens, instant to iterate.
check_status — are both ComfyUIs up?
- Episodes of stills —
new_episode · episode_status · frame_prompt ·
set_frame · open_review · render_frames · check_frame · attach_fix ·
approve_frame, and for fixing one part of a still: fix_box ·
erase_background · take_author_edit · shrink_feature · mirror_hand ·
zoom_grid · compare_versions. See below.
Validation is the other half. tools/check_bible.py --all exits non-zero if a
reference is missing, if an unregistered image is lurking in a character folder, or
if the primary reference can't be traced back to an approved sheet. That check
exists because a silently wrong reference once propagated a character's wrong hair
color through a run of finished panels.
Episodes of stills: script to approved pictures
Built on the first manga-video episode (87 stills, 2026-11-27/28). A video made
of stills needs the stills first, and they are where nearly all the review time
went. Each still is a generate_scene render: the cast from their bible
pictures, the room and light in the same pass. The anime-production server
animates the approved pictures.
new_episode — one frame per picture of the script: its lines, the
author's staging line, the cast (each character's approved bible picture as
a reference, padded so Klein does not copy its crop), and one plain scene
sentence. Every character must be in the bible; descriptions are read from
it. The file goes to output/<project>/<episode>/episode.json.
open_review — a local page (127.0.0.1 only): every picture with its
script lines and staging; approve, reroll, or a note asking for a fix. It
renders one picture at a time, a clicked reroll first, as its own
windowless process.
render_frames a section at a time; check each one before the
author sees it and record it with check_frame — it shows on the card.
- Read every note before any reroll. A reroll asked for under an
unapplied note is held;
set_frame(..., note_applied=True) once the prompt
carries it. episode_status lists the open notes.
- Fix one part instead of rerolling when the rest is right;
attach_fix
the result and show the author every take.
| problem |
fix |
what did not work |
| a bad hand on a good picture |
fix_box: wipe the box, enlarge 3x, BFL's Remove + New rows, three seeds |
the generation row format copied the old hand back |
| a LEFT hand where a right should be |
mirror_hand across the hand's own length, then fix_box the wrist |
asking Klein for the other hand (0 of 5); mirroring the whole picture (0 of 2) |
| a smile or mouth too big |
shrink_feature — the same strokes, smaller |
four Klein redraws with a smaller box kept the width |
| people or a stray thing in the background |
erase_background — fill, then Klein paints the room |
a flat fill on a small patch came back flat; fill from above instead |
| the author fixed it himself |
take_author_edit — only his change, onto the lossless picture |
pasting his whole compressed copy |
| the bible's expression words beat the prompt |
set_frame with a per-frame desc without them |
"not smiling" — it summons the smile |
| a redraw also moved a nearby outline |
compare_versions after every fix; shrink_feature(original_path=...) |
checking by eye |
Measure every box on zoom_grid at full size first: a box read off a
scaled-down view once sat on an eye instead of the mouth. GPU-free checks:
python tools/check_stills.py.
Concept Genesis: getting a character into the bible
| You have... |
Use |
Then |
| A story, no art at all |
generate_character_concept — a text-to-image candidate |
Pick the winner, register_character it |
| A composite concept sheet (hero pose + expressions + text, one image) |
crop_reference — slice it into clean single views |
register_character the crops |
| One finished drawing of your own character |
register_character the drawing directly |
Straight to the turnaround |
Then generate_turnaround_sheet for the four angles, and compose_reference_sheet
for the poster. generate_reference_sheet adds expression close-ups and builds the
poster in one call.
Three text fields, shown on the sheet, deliberately short — this server
generates panels, it doesn't write your story:
| Field |
What goes here |
profile |
Who they are — role, standing, personality, and (if relevant) Japanese speech patterns: register (丁寧語 vs 普通語) and self-referential pronoun (僕/俺/私/あたし/わし/吾輩/etc.) |
abilities |
Powers, skills, equipment |
| (shown as "Appearance") |
description itself — hair and eye color, build, costume. It drives the prompts too, so it is written once. |
Write a real description before generating. Without visual detail the prompt
has nothing to anchor identity with, and a detail that exists only in the art is
lost on every render made from the words. Leave out "tall" (it fills the canvas and
clips the figure — relative height belongs in the sprite manifest) and build words on
a clothed character (muscle came back as bare skin).
For artists specifically: register your one drawing, then the turnaround sheet
answers the rotational questions — the back of the outfit, the silhouette from the
side — as reference to draw from, the way you'd use a 3D turntable. Feed it a
clean full-body drawing on a plain background.
Nothing auto-registers, ever. A human always picks the canon.
How a panel gets made
On Klein the first thing to try is one render: generate_scene with every
character's reference and the room described. Klein holds identities and draws the
light, which a composite has to fake.
When something genuinely cannot be generated together, panels are composited
layers:
- Background plate —
webcomic-background-mcp (World Builder keeps the
location consistent).
- Character layer —
generate_character_pose, alone on a clean backdrop,
matted to RGBA.
- Composition —
compose_panel pastes the layer onto the plate at a feet
position/height. Chain each call's output back in as base for several
characters.
compose_panel's feet_x/feet_y/height_px are exactly what the background
server's generate_city_scene(anchor_x=, anchor_z=) reports back — the two servers
meet at that seam with no code dependency.
Transparent figures
Every pose and expression is matted by comfy.matte(), and anything that already
exists — a locked panel, a hand-drawn figure — by comfy.matte_image():
import comfy
comfy.matte_image("output/<project>/_scene1/FINAL_p01_arrival.png",
out_dir="output/<project>/_figures")
Both use BiRefNet-general through ComfyUI-RMBG, ~4–8 s. That choice is a
license decision: RMBG-2.0's downloadable weights are for non-commercial use only,
and BiRefNet (the model RMBG-2.0 is a fine-tune of) is MIT. A learned matte lands
ON the lineart, keeps white garments a brightness key would delete, and removes
backdrop trapped inside the silhouette.
Klein renders then go through klein_workflow.clean_matte(), which removes the pale
fringe a learned matte leaves between hair strands by flood-filling the backdrop from
the frame edge — it stops dead at Klein's black outline.
Architecture
MCP client (Claude)
│ stdio
▼
server.py ──► characters.py (bible: pure data/IO, no GPU)
klein_workflow.py ──HTTP──► Klein ComfyUI (:8189, v0.41+) ──► GPU
comfy.py ──HTTP──► main ComfyUI (:8188) — matting only
tools/ (compositing, cropping, sheets: pure PIL, no GPU)
Two ComfyUIs on purpose: the main install runs LTX, the music model and matting
through add-ons never tested on v0.41, and upgrading it in place would risk all three
to gain nothing Klein needs.
Why it's a local server
Each render runs on a local GPU, so a hosted multi-user deployment would mean paying
for everyone's GPU compute. Running locally keeps it free and private — the right
trade for a personal creative tool.
Part of a wider webcomic/animation toolkit
This server generates characters and composites panels — it doesn't paint
backgrounds (see webcomic-background-mcp) or make videos (see the
Anime Production Skill). More tools in the
same ecosystem are listed on tobiasfong.github.io.
Setup Guide
Already have webcomic-background-mcp set up? One Klein ComfyUI serves both
servers — skip to Step 3 (matting) here.
Hardware: will it run on your machine?
Same as webcomic-background-mcp — see its
hardware table.
Measured on a 6 GB RTX 3060 Laptop: VRAM is not the constraint, because ComfyUI
streams weights from system RAM.
Step 1 — Install ComfyUI v0.41 or later, and Klein
Follow the background server's
Step 1 and Step 2:
a ComfyUI 0.41+ (this project keeps it separate, at C:/AI/ComfyUI_flux3 on port
8189), and three files from BFL's gated flux-3-image-klein-comfy repo — each BFL
repo needs its own license click.