Connect Récit to an agent over MCP
Goal: install the Récit MCP server, register it in your agent over stdio, let the agent inspect the deck format, validate and fix a three-slide Markdown story line by line, and preview or build the saved file.
Récit never calls a model itself: your MCP host writes the Markdown while @recit/mcp answers with
deterministic format guides, JSON Schemas, and line-numbered diagnostics. For the complete list of
tools and resources, see MCP server.
1. Install the server
In a project where @recit/cli (recit) is installed — for instance a folder created with
create-recit, see Quickstart — add @recit/mcp, the
optional package that backs recit mcp serve:
Bash
If @recit/mcp is missing when an agent starts recit mcp serve, the CLI stops with
recit mcp serve needs @ and prints the install
command.
recit mcp serve speaks the Model Context Protocol over stdio (stdout is reserved for the
protocol) and loads the project's recit. and Récit plugins from its root directory. Pass
--root <dir> to bound every path the tools may read or write (default: the current working
directory):
Bash
Any tool path that resolves outside --root, traverses a hidden directory, or follows a symbolic
link out of --root is refused.
2. Register it in your agent
Wire npx recit mcp serve into your MCP host from the root of the project.
In Claude Code, register the local stdio server with claude mcp add:
Bash
In opencode, declare the server in opencode.json at the root of the project:
opencode.json
opencode prefixes each tool with the server name (recit_, recit_),
and opencode mcp list confirms the connection (recit connected). For hosts without MCP, see
Agent Skills (recit skills export).
3. Let the agent read the format
Ask your agent to inspect the deck format before writing a slide. The agent calls
describe_ with {"format"::
JSON
describe_ (format defaults to "motion" when omitted) returns two sections in one reply:
- The deck Markdown authoring guide (the same text served by the
recit://resource): front matter fields,guide/ deck ---scene separators with key-value attributes (layout,cols,id), layouts (cover,grid,center…), directives (:::card,:::notes…), and MDX rules. ## JSON Schema of the typed source ({ "kind":, followed by the JSON Schema of the deck twin — plus"story", "format": "deck" }) ## Directives of the project's plugins (experimental)whenrecit mcp servefinds Récit plugins in the project.
Each format guide is also a resource the agent can read directly (recit://…). To write a
story with an author rather than for them, the agent reads recit:// instead: the
guided writing workshop in nine steps, from the spark to the formats, where the author decides at
every gate and the agent keeps the state in atelier.md.
4. Write and validate a story
With the syntax in context, the agent drafts a three-slide story in memory and checks it with
validate_ before writing to disk (validate_ checks every format except motion films,
which use validate_; pass exactly one of markdown, json, or file).
Suppose the agent's first draft sets an unknown format: key on line 3 of the front matter:
YAML
Calling validate_ with {"markdown": on that draft returns isError: with the
1-based line number (story.md:3) and diagnostic code (invalid-):
Code
deck is the default story format, so a slide deck needs either format: deck or no format key
at all. Removing format: and calling validate_ again with {"markdown":
returns ✓ valid deck.
No MCP tool writes a deck file to disk (only the motion film tools build_film, apply_ops, and
extract write film files under --root), so the agent saves slides.md with its own file tool:
slides.md
The agent then verifies the file on disk (resolved inside --root) by calling validate_ with
{"file"::
JSON
The server answers:
Code
Passing a path outside --root — such as {"file": — is refused with
isError: and a message containing outside the server root.
5. Preview or build it
No MCP tool starts a dev server or bundles a static deck site (render in @recit/mcp renders
motion films to MP4). Preview slides.md locally with hot reload using recit dev:
Bash
recit dev slides.md serves the three slides (intro, points, close) on
http:// by default (-p, -- to choose another port, --open to open a
browser) and updates the open slide live whenever you or the agent save slides.md.
When the deck is ready to publish, stop the dev server (Ctrl+C) and build a static bundle with
recit build:
Bash
By default, recit build writes dist/ and dist/assets/ (-o, -- to pick
another output folder) and prints ✅ Built 3 slides in …/ (the absolute path of the folder).
Check
- Calling
describe_withformat {"format":succeeds and returns the deck Markdown guide together with the JSON Schema for"deck"} { "kind":. Reading the resource"story", "format": "deck" } recit://returns the writing workshop and its nine steps.guide/ atelier - Calling
validate_withstory {"markdown":when"…"} format:is on line 3 of the front matter returns an error (slides isError:) namingtrue story.md:3and(invalid-.format) - Removing
format:, validating the Markdown withslides validate_, writingstory slides.mdinside--root, and callingvalidate_withstory {"file":returns"slides.md"} ✓ valid deck, while a path outside--root({"file":) is refused with"../ slides.md"} outside the server root. - Running
recit dev slides.mdserves the three slides (Lorem Ipsum,Sed do eiusmod,Consectetur adipiscing), and runningrecit build slides.mdexits with0and writesindex.htmlandassets/intodist/.
See also
- MCP server — full reference of the tools and
recit://resources inguide/ * @recit/mcp. - Agent Skills — export the same guides as
SKILL.mdfolders or.opencode/roles withagent/ recit skills export. - Write and present your first deck — keyboard navigation, live-reload editing, and static deck builds.
- CLI — options for
recit mcp serve,recit validate,recit dev, andrecit build.