Bedtime Book Studio
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Bedtime Book Studio Make a bedtime book from this photo: Leo's box becomes a rocket."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Bedtime Book Studio πβ¨
Turn a quick photo (or character description) and a bedtime story idea into an interactive, mobile-friendly landscape children's picture book in minutes.
1. Toss your agent a photo & a story idea... | 2. ...get an interactive bedtime book on your iPad! |
|
|
"Leo turns a cardboard moving box in the living room into a rocket ship landing on the moon." | Single-file |
Bedtime Book Studio is an open-source Agent Skill and Model Context Protocol (MCP) server that works with any AI coding/chat agent (Claude Code, Cursor, Antigravity, Windsurf, OpenClaw, etc.).
When your book finishes building, you get:
A Single-File HTML Picture Book (
books/<slug>.html): Every illustration (.webp), stylesheet, and interactive page-turn/flap script is bundled into one self-contained.htmlfile. You can double-click it to open in any browser, AirDrop/text/email it straight to your phone or iPad for bedtime, or drop that single file onto any static web host.Instant Local Hosting on Your Device: By default, Bedtime Book Studio automatically serves your books locally on your machine (
http://localhost:8765/<slug>/) and prints your device's local Wi-Fi URL (http://<your-lan-ip>:8765/<slug>/) so you can open the book immediately on a phone or tablet on the same Wi-Fi network.Optional Custom Self-Hosting: If you run your own web server or static site folder, you can optionally set
PUBLISH_WEB_ROOTandPUBLISH_BASE_URLin.envto auto-copy new books to your server.
β¨ Two Interactive Book Modes
Lift-the-Flap Mode (
lift-the-flapβ Default):Every story page shows the everyday Reality scene on a tactile, stitched cardboard flap.
Kids can tap the button, press
Space/F, or drag the flap upward with their finger to lift it in 3D and reveal the Imaginary world underneath!
Standard Picture-Book Mode (
standard):Classic single-illustration landscape spreads with big read-aloud typography, a
Aa Text Onlyfocus mode, and a celebratory "Hooray! The End" confetti finale.
Related MCP server: Once Upon YOUR Child MCP server
π Step-by-Step Setup (2 Minutes)
Prerequisites
Python 3.10+
Any AI agent that supports MCP or Skills (and has access to an image generation tool/subagent).
Step 1: Clone the Repo & Run Setup
git clone https://github.com/danmaps/bedtime-book-studio.git
cd bedtime-book-studio
./setup.shWhat ./setup.sh does:
Creates a local Python virtual environment (
.venv/) and installsPillow+mcp.Launches the interactive onboarding wizard to set up your main character and defaults, saving everything locally in
.env(which is gitignored).Prints the exact copy-paste config snippet for your AI agent.
Tip: Want your AI agent to interview you in chat instead of using the terminal wizard? Run
./setup.sh --skip-onboard. The first time you ask your agent to make a book, it will detect that.envisn't configured yet and walk you through onboarding right in chat!
Step 2: Connect Your AI Agent
Choose MCP Server, Agent Skill, or both:
Option A: Connect via MCP (Claude Code, Cursor, Antigravity, Windsurf)
Add bedtime-book-studio to your agent's MCP config file (for example ~/.claude.json, .cursor/mcp.json, or ~/.gemini/config/mcp_config.json):
{
"mcpServers": {
"bedtime-book-studio": {
"command": "/absolute/path/to/bedtime-book-studio/.venv/bin/python",
"args": [
"/absolute/path/to/bedtime-book-studio/scripts/mcp_server.py"
]
}
}
}(Note: ./setup.sh prints this exact JSON block with your real absolute paths filled in!)
Option B: Connect via Agent Skill (SKILL.md)
Symlink the repo into your agent's skills folder:
mkdir -p ~/.agents/skills
ln -sfn "$(pwd)" ~/.agents/skills/bedtime-book-studioStep 3: Onboard Your Main Character (Photo and/or Text)
During onboarding (via ./setup.sh, python3 scripts/book_studio.py onboard, or in chat with your agent), you configure your default character once:
Name & Age: e.g.
Leo, age4Visual Reference (Photo, Text, or Both):
Photo(s): Provide path(s) to 1 or more photos of your main character. They are copied into
./local_profile/references/(gitignored) and automatically included as visual references in future books.Text Description & Outfit: Describe their hair, eyes, skin tone, and signature outfit (e.g., "4-year-old with curly brown hair, wearing a red striped T-shirt and denim overalls"). You can use text alone or combine it with reference photos for rock-solid consistency.
Supporting Cast & Favorite Toys (Optional): Pets, siblings, parents, or favorite real-world toys that frequently appear in bedtime stories.
Book Defaults:
lift-the-flapvs.standardmode, default page count (12), and default illustration style.
All of these settings live in your local .env file. You can re-run onboarding anytime:
./.venv/bin/python scripts/book_studio.py onboardπ Making a Bedtime Book
Once connected, just ask your AI agent in plain English:
"Make a new lift-the-flap bedtime book in bold Maisy style! Here's a photo of our cardboard box (
/path/to/box.jpg). The story is about turning a cardboard moving box in the living room into a rocket ship landing on the moon."
π¨ Built-In Art Style Presets
You can set a default style preset in .env (DEFAULT_STYLE_PRESET) or pick a different style per book (--style-preset):
Preset Key | Aliases | Visual Aesthetic |
|
| Clean hand-drawn ink linework with gentle flat watercolor washes on warm cream paper |
|
| Bold expressive black brush outlines with vibrant flat gouache colors (Maisy-inspired) |
|
| Handcrafted 3D stop-motion plasticine clay diorama with soft miniature studio lighting |
|
| Layered hand-painted tissue paper and textured cut-paper collage with crisp scissor edges |
|
| Cozy hand-drawn wax crayon, oil pastel, and colored pencil on warm toothy paper |
|
| 1950s mid-century Little Golden Book vintage gouache and warm lithograph print texture |
π Optional Dry-Run Planning Mode (book-plan.md)
Want to review or tweak the story text, page count, flap reveals, and visual prompts before spending time or credits generating illustrations? Ask your agent for a dry-run book plan (or run plan from the CLI):
# 1. Create a self-contained, editable Markdown plan (0 images generated, no site built yet)
./.venv/bin/python scripts/book_studio.py plan \
--slug "leos-cardboard-rocket" \
--title "Leo's Cardboard Rocket" \
--idea "Leo turns a cardboard moving box in the living room into a lunar rocket ship" \
--style-preset "bold-gouache"
# 2. Open and edit books/leos-cardboard-rocket/book-plan.md in any editor
# (change story paragraphs, page titles, style preset, flap transformations, or visual prompts)
# 3. Apply your edits into storyboard.json + prompts.md + preview.html
./.venv/bin/python scripts/book_studio.py apply-plan --slug "leos-cardboard-rocket"What Happens Behind the Scenes:
create_book_project/create_book_plan: Scaffoldsbooks/<slug>/(and optionallybooks/<slug>/book-plan.mdfor dry-run editing), resolving your character/pet/prop identities and chosenstyle_preset.save_book_storyboard/apply_book_plan: Writesstoryboard.json,prompts.md, andpreview.htmlwith locked character continuity and matching Reality + Imaginary scene prompts for every page.ingest_generated_images: Your agent generates the illustrations, and Bedtime Book Studio center-crops every image to1280x960(4:3 landscape) and exports.png+.webp.build_and_publish_book:Generates the single-file standalone HTML book at
books/<slug>.html(with all CSS, JS, and.webpimages inlined so each published book is only 1 file).Starts the local device web server so you can read immediately!
π± Reading on Your iPad, Phone, or Computer
1. Recommended for iPad & Phones: Scan the Local Wi-Fi QR Code
When publish (or preview) runs, Bedtime Book Studio automatically:
Starts a lightweight local HTTP server on port
8765(configurable viaLOCAL_SERVER_PORTin.env).Generates a scannable QR code (
books/<slug>/qr-lan.svg+ a terminal ASCII QR code in the CLI/MCP output) pointing tohttp://<your-lan-ip>:8765/<slug>.html.Point your iPad or iPhone Camera app at the QR code to open the book directly in Mobile Safari with full lift-the-flap touch/drag gestures,
π Bedtime Mode, and "Add to Home Screen" support.Need to restart the local server or print the QR code later? Run:
./.venv/bin/python scripts/book_studio.py serve
2. Single-File HTML Book (books/<slug>.html)
Every published book is a single, completely self-contained
books/<slug>.htmlfile (~1.5β5 MB total, with all.webpillustrations, CSS, and JS embedded).On Mac / PC / Android: Double-click
books/<slug>.htmlto open in any desktop browser with full interactivity.Static Hosting: Drag-and-drop
books/<slug>.htmlonto Netlify Drop, Cloudflare Pages, GitHub Pages, S3, or any static host for a permanent HTTPS link you can text to family.
π Verified iPad & Mobile Delivery Matrix
Why iPadOS Files / AirDrop .html attachments don't run Lift-the-Flap JavaScript:
When you open a local .html file inside the iPadOS Files, Mail, or Messages app, iOS renders it inside a sandboxed QuickLook preview (QLPreviewController) that disables JavaScript and custom touch-drag eventsβand iPadOS does not provide an "Open local file in Safari" button from Files.
For iPad and iPhone, always use Local Wi-Fi (QR code) or an HTTPS static host so the book opens in Mobile Safari.
Delivery Method | Target Browser / Viewer | Lift-the-Flap Drag & Tap | Page Turns & Bedtime Mode | Offline Support |
1. Local Wi-Fi QR Code ( | iPadOS / iOS Mobile Safari | β Full | β Full | Same Wi-Fi LAN (or cached tab) |
2. Self-Hosted / Static Host ( | iPadOS / iOS Mobile Safari | β Full | β Full | Cached after first load |
3. Desktop Browser ( | macOS / Windows / Linux Browser | β Full | β Full | β 100% Offline |
4. AirDrop / iPadOS Files | iOS QuickLook ( | β οΈ Disabled by iOS sandbox | β οΈ Static layout only | Offline static view only |
π§ Local Wi-Fi & Port Troubleshooting
iPad can't reach
http://<lan-ip>:8765?Ensure your computer and iPad are on the same Wi-Fi network (avoid "Guest" Wi-Fi networks that enable AP client isolation).
If macOS/Linux firewall prompts to allow incoming connections for Python, click Allow (or open TCP port
8765viaufw allow 8765/tcp).If port
8765is already in use, pass--port 8888topublish/serveor setLOCAL_SERVER_PORT="8888"in.env.
3. Optional Custom Self-Hosting (PUBLISH_WEB_ROOT)
If you run a local or remote web server directory (Nginx, Caddy, Tailscale Serve, etc.), set these optional variables in .env:
PUBLISH_WEB_ROOT="/var/www/my-site/books"
PUBLISH_BASE_URL="https://example.com/books"Whenever a book is published, Bedtime Book Studio will automatically copy the single-file book into <PUBLISH_WEB_ROOT>/<slug>.html and return <PUBLISH_BASE_URL>/<slug>.html.
Optional Bookshelf
The bookshelf template is a single HTML file with a black background and a responsive, scrollable grid of cover thumbnails. Tap a cover to read its book in an iframe, then use Back to shelf to return to the same shelf position.
Ask your agent: "Set up the optional bookshelf with my books." Agents can find the instructions in AGENTS.md.
To populate it yourself:
Copy
templates/bookshelf.htmltobooks/index.html(or your chosen hosting folder).Find the
BOOK PATHScomment. Copy its example link outside the comment for each book, settinghrefto the single-file book HTML (<slug>.html) andsrcto its inlineddata:image/webp;base64,...cover URI (or cover image path). Setaltto the book's name for accessibility.Serve the shelf and single-file books together using your local or static hosting. With the existing local server serving
books/, openhttp://<your-lan-ip>:8765/index.htmlon your phone or tablet.
The template is optional and starts as an empty black page until you add links. It shows only covers, with no visible title, captions, or metadata. Comments mark places for optional decoration: ask your agent afterward to add a kid's name, theme colors, or another personal touch.
π οΈ CLI & MCP Tool Reference
MCP Tool | CLI Command | Description |
|
| Check if |
|
| Save character photo(s), text description, outfit, style preset, and defaults to |
|
| List built-in art style presets ( |
|
| View the active character, identities, and studio configuration |
|
| List persistent characters, siblings, pets, and props ( |
|
| Create/update an entity with a stable ID ( |
|
| Add, relabel, or include/exclude ( |
|
| List all generated books, |
|
| Scaffold a new book project with selected |
|
| Dry-run mode: create an editable |
|
| Parse an edited |
|
| Validate & normalize |
|
| Validate |
|
| Generate |
|
| Center-crop images to 4:3 ( |
|
| Revise one page ( |
|
| Mark storyboard and/or specific illustration assets as approved |
|
| Restore a prior archived version of an illustration from |
| (in | Inspect approval state, version history, and revision log for a book |
|
| Validate assets, atomically build single-file |
(CLI helper) |
| Start or check the local device HTTP server and print the Local Wi-Fi QR code |
π Privacy by Design
.env,local_profile/, andbooks/are all gitignored in.gitignore.Your personal family photos, character names, and generated books never leave your device unless you choose to share them.
π License
MIT License β see LICENSE.
Available Tools
8 toolsbuild_and_publish_bookA
Step 4: Compile the book into:
A self-contained single-file HTML book (
<slug>.htmlwith all CSS, JS, and images embedded) that can be opened directly in any browser or AirDropped/shared to a phone or tablet.A multi-file web reader (
index.html,styles.css,script.js,assets/).By default (
serve_local=True), hosts the book immediately on the local device athttp://localhost:<port>/<slug>/andhttp://<lan-ip>:<port>/<slug>/for phones on Wi-Fi.Optionally copies to
PUBLISH_WEB_ROOTif the user configured custom self-hosting in.env.
Inputs: slug (required), port, serve_local, deploy_static. Returns: result
configure_studioC
Save or update user onboarding settings in the local gitignored .env file.
Copies any main_character_photos into local_profile/references/ so every future
book automatically has access to the main character's reference photo(s) and/or
text description.
Inputs: recurring_props, books_output_dir, publish_base_url, publish_web_root, +10 more. Returns: result
create_book_projectB
Step 1: Initialize a new bedtime picture-book project workspace.
Any omitted fields (mode, character_name, character_description, page_count)
automatically inherit the user's defaults from .env, and default character reference
photos are automatically copied alongside any book-specific reference_images.
Inputs: idea (required), slug (required), title (required), mode, +4 more. Returns: result
get_onboarding_statusA
Call this FIRST when starting a session.
Checks whether the user has completed first-time onboarding in .env (main character
name, reference photo(s) and/or text appearance description, outfit, art style, and
default book mode). If is_onboarded is false, follow agent_onboarding_instructions
to ask the user for their main character details and call configure_studio.
Inputs: no named parameters. Returns: result
get_studio_profileB
Return the active studio profile from .env, including main character details
(name, age, text description, outfit, reference photo paths), supporting cast,
default art style, default book mode, and local hosting paths.
Inputs: no named parameters. Returns: result
ingest_generated_imagesA
Step 3: After generating illustrations (via subagents or image tools), pass a dictionary
mapping asset keys (e.g. {"cover": "/path/to/img.jpg", "page-01-reality": "..."})
to normalize, center-crop to 1280x960 (4:3 landscape), and save both .png and .webp.
Inputs: slug (required), image_map (required). Returns: result
list_existing_booksA
List all bedtime picture-book projects in BOOKS_OUTPUT_DIR, their single-file HTML path, and local URLs.
Inputs: no named parameters. Returns: result
save_book_storyboardB
Step 2: Save the complete storyboard.json for a book and generate prompts.md
plus the exact list of required image keys (cover, page-01-reality, page-01-imaginary, ...).
Inputs: slug (required), storyboard (required). Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
TDQS
Scored across 8 tools
Most tools have clearly distinct roles, and the four pipeline steps (create_book_project, save_book_storyboard, ingest_generated_images, build_and_publish_book) are explicitly numbered, which strongly disambiguates them. The main overlap risk is between get_onboarding_status and get_studio_profile, which both read settings/profile data, though the descriptions distinguish the onboarding-check versus full-profile purposes.
All eight tools follow a consistent snake_case verb_noun pattern (get_onboarding_status, list_existing_books, configure_studio, create_book_project, save_book_storyboard, etc.). The only mild deviation is the compound verb in build_and_publish_book, but it still fits the convention.
Eight tools is well-scoped for a book-production pipeline spanning onboarding, project setup, storyboarding, image ingestion, and publishing. Each tool maps to a distinct stage and none appears redundant or filler.
The surface covers a full create-to-publish lifecycle including onboarding configuration and listing existing books. Minor gaps exist β no explicit tool for editing/regenerating an existing storyboard or deleting/archiving a book β but the core end-to-end workflow is intact.
Maintenance
Related MCP Connectors
AI story generator β create illustrated storybooks, AI songs, and short AI video films
AI story generator β create illustrated storybooks, AI songs, and short AI video films
Turn a story idea into a 3D game that plays in the browser, and get a link that opens it.
Create and read private AI-illustrated storybooks with your PictureBooks account and credits.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceGenerates personalized short bedtime stories for three-year-old children using custom themes and names. It provides a dedicated MCP tool for automated storytelling and is optimized for cloud deployment on platforms like Render.1-
- AlicenseNot gradedqualityBmaintenanceEnables Alexa+ and other voice agents to tell personalized, feelings-aware bedtime stories using a child's saved hero profile, with interactive choices, timed wind-down stories, and optional MP3 narration.MIT
- AlicenseNot gradedqualityBmaintenanceTurns an AI client into a slide author that produces single self-contained HTML decks with live diagrams, step-by-step reveals, in-place text editing and PDF export. It also lets the AI verify its own work through layout audits and screenshots, all locally with no API key.68 npmMIT
- AlicenseNot gradedqualityCmaintenanceEnables a child to search a self-hosted picture-book shelf by creatures, themes, places, or colors, read one page at a time through Alexa+, repeat a page on "Again!", and bookmark or resume a reading across sessions.MIT

