Skip to main content

visual-novel-mcp

Branching visual-novel production server for Ren'Py projects built from webcomic-toolkit assets: a scene database with cross-session continuity, a branch-graph validator, and the sprite manifest (one whole body per expression; face patches are legacy).

Why a server (and why this shape)

A kinetic VN would not have needed one — matting, patch tooling, and script writing are plain scripts and text files. A branching VN adds exactly the things MCP is for: a scene database consulted across many sessions, graph validation that must run against the whole story, and continuity state that no single chat can hold. Same reasoning as novel-translation-mcp, which this server's structure copies (projects.json registry, per-project state file, WORKFLOW.md served as instructions, terse tool docstrings).

The core design rule

The .rpy scripts are the single source of truth for the branch graph.

rpy_parse.py scans the scripts for labels, jumps/calls, menus, flag writes ($ x = …, default), flag reads (conditions, choice conditions, [x] interpolations), show/scene displayables, and audio refs. graph.py builds the graph fresh on every check — nothing graph-shaped is ever stored, so nothing graph-shaped can drift.

The state file (vn_state.json) holds only what a script cannot express:

  • scene synopses and status (planned → drafted → reviewed → approved)
  • flag meanings (define_flag) — check_story flags undocumented flags
  • append-only continuity notes (record_note)
  • an approved_digest per approved scene, so silent edits to approved scenes are detected

Approval is the author's alone. save_scene refuses to demote an approved scene, and nothing here auto-approves.

Conventions

  • One scene = one file (game/scenes/<scene_id>.rpy) = one entry label named after the scene id. plan_scene before writing; save_scene to commit (it parses immediately and reports problems while context is warm).
  • The scanner is deliberately not a full Ren'Py parser — Ren'Py's own lint stays the syntax authority once the SDK is installed. The scanner's simplifications are conservative: dynamic jumps are excluded from checks rather than guessed at.
  • Fallthrough is real: a label whose body does not end in return/jump falls through to the next label in the file, and the graph models that.

Sprites: one body per expression

Each expression is a whole matted body under the character's tag (register_body), scaled to the neutral's height and centered on its canvas; show <tag> anger swaps the figure, and the posture may change with the mood. This reverses the first design (2026-08-16: hand-drawn face patches over one body, so the body could never jitter). On flat cel art a repainted face shows a seam inside the face, so full bodies became the route on 2026-09-19, and since 2026-10-17 they are rendered from scratch on FLUX 3 Klein. Face patches (register_expression) are still supported for art where they work.

The manifest (sprites.json) records the bodies, any patches and their pixel offsets, target_height (fraction of the 1080p screen, for deterministic scale normalization), and mirror_ok (false for asymmetric costume details).

emit_sprites generates sprites_generated.rpy: one layeredimage per character, zoom computed from target_height, and (for the legacy patch route) each patch padded onto a transparent body-sized canvas so every layer is the same size and offsets are baked into pixels — the jitter-proof representation. preview_expression composites body + patch over magenta for the alignment eyeball check.

Privacy

The repo is public. projects.json is gitignored here; game trees and state dirs must live under gitignored paths (vn/ at the repo root is ignored). Scene scripts are full of character and world names — never let them reach git.

Setup

From PyPI (simplest)

With uv installed, there is nothing to clone:

claude mcp add -s user visual-novel -- uvx visual-novel-mcp

or pip install visual-novel-mcp and register the visual-novel-mcp command. Installed this way, the project registry (projects.json) lives in ~/visual-novel-mcp/; each project's game tree and state still go where its registry entry points. The package is the server only. The author-run scripts under tools/ (build, audits, image install and conversion, story map), the snippets/ and the examples/ stay in the repo, and need python-docx, pyoxipng and the other packages in requirements.txt.

From the repo

python -m venv .venv
.venv\Scripts\pip install -r requirements.txt

mcp<2 is load-bearing (mcp 2.0 removed mcp.server.fastmcp). Register in ~/.claude.json mcpServers with this venv's python, like the other servers.

The engine

The server itself never runs Ren'Py — it parses scripts, so the game tree is plain files. You need the engine to PLAY the game or build it for a browser, and the harness installs that itself:

python tools/install_renpy.py

It fetches the pinned SDK and the separate web-build component, verifies both against recorded SHA-256 hashes, and records where it put them. Nothing else should ever contain an SDK path — resolve it through tools/renpy_sdk.py, which reads an explicit argument, then RENPY_SDK, then that record.

Then build and play it in a browser:

python tools/build_web.py <project-dir> --serve --open

⚠ The version is pinned deliberately. The engine traps in WORKFLOW.md were measured against 8.5.3 and renpy lint catches none of them, so --version moves ground that this repository has notes about.

A map of your story

python tools/story_map.py <project-dir>

draws story_map.html from your scripts: each affection meter's range after every choice, every menu: choice and what it does, and -- if you supply the numbers -- your fights and a calculator for the player's gear and skills. It works on any Ren'Py project with no setup; examples/story_map_demo/ shows the optional config and combat data, and the page they make. See WORKFLOW.md, "The story map".

Metadata

Release files for visual-novel-mcp 0.1.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 visual-novel-mcp 0.1.0
File Size Uploaded Provenance Actions
visual_novel_mcp-0.1.0.tar.gz 58.7 kB With provenance Details for visual_novel_mcp-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for visual-novel-mcp 0.1.0
File Interpreter ABI Platform Actions
visual_novel_mcp-0.1.0-py3-none-any.whl Python 3 none any Details for visual_novel_mcp-0.1.0-py3-none-any.whl

Total release size: 118.4 kB

Release files / visual_novel_mcp-0.1.0.tar.gz

Download URL visual_novel_mcp-0.1.0.tar.gz
Size 58.7 kB
Tags Source
SHA-256 checksum
How to use checksums
0dcac2dcc93e9f4607f8c55fe8338a1f3c229648f2f6cf3aeff542e3318a7ebc
BLAKE2b-256 checksum
How to use checksums
cd02a3d6cabb7b7c11f6d7f2047c3a6894e172078c4448246c1a3e1a9d9dc9cf
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 / visual_novel_mcp-0.1.0-py3-none-any.whl

Download URL visual_novel_mcp-0.1.0-py3-none-any.whl
Size 59.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
12072d3ec18782ca6088ea6a68d7f37adf9bd51ce44e39fcff6bd64808d2c6f3
BLAKE2b-256 checksum
How to use checksums
02b805451f2f6c62f6ba1e61b0e04c966aeca0eec39852b070e1bd2986923605
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 visual-novel-mcp 0.1.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 visual_novel_mcp-0.1.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.1.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