mcp-server
v7.10.2JSON to Office MCP server - author, validate, preview, diff and generate .docx and .pptx over stdio
A local Model Context Protocol server for json-to-office. It lets an agent author, inspect, validate, preview, diff and generate .docx and .pptx — with the document JSON as the artifact and the Office file as a build product of it. stdio only, no auth, no network beyond the asset and font services you configure. It speaks MCP over stdin/stdout, so in practice a client starts it rather than you — see the configuration below. Run it by hand only to check that it starts; --help and --version are the only things it ever prints to stdout that are not protocol frames.
Summary extracted from the README.
@json-to-office/mcp-server
A local Model Context Protocol server for json-to-office. It lets an agent author, inspect, validate, preview, diff and generate .docx and .pptx — with the document JSON as the artifact and the Office file as a build product of it.
stdio only, no auth, no network beyond the asset and font services you configure.
Run it
pnpm dlx @json-to-office/mcp-server # or: npx -y @json-to-office/mcp-server
It speaks MCP over stdin/stdout, so in practice a client starts it rather than you — see the configuration below. Run it by hand only to check that it starts; --help and --version are the only things it ever prints to stdout that are not protocol frames.
Client configuration
Claude Code
claude mcp add json-to-office -- npx -y @json-to-office/mcp-server
-s user makes it available in every project instead of just this one; -s project writes a .mcp.json your team can commit. Environment goes through -e, before the --:
claude mcp add json-to-office -s user \
-e JTO_MCP_OUTPUT_DIR=$HOME/Documents/jto-out \
-- npx -y @json-to-office/mcp-server
Check it with claude mcp list, or claude mcp get json-to-office.
Claude Desktop
Edit claude_desktop_config.json — ~/Library/Application Support/Claude/ on macOS, %APPDATA%\Claude\ on Windows — and restart the app:
{
"mcpServers": {
"json-to-office": {
"command": "npx",
"args": ["-y", "@json-to-office/mcp-server"],
"env": {
"JTO_MCP_OUTPUT_DIR": "/Users/you/Documents/jto-out"
}
}
}
}
Claude Desktop does not inherit your shell's PATH, so if LibreOffice or poppler live somewhere unusual, name them explicitly with LIBREOFFICE_PATH and PDFTOPPM_PATH in the same env block. Without an output directory the server writes to a temp directory that the OS eventually reaps — fine for previews, less fine for a report you wanted to keep.
Cursor
~/.cursor/mcp.json for every project, or .cursor/mcp.json inside one:
{
"mcpServers": {
"json-to-office": {
"command": "npx",
"args": ["-y", "@json-to-office/mcp-server"]
}
}
}
Any other stdio host
The server is an ordinary stdio MCP server with no auth and no arguments of its own, so the generic shape works everywhere:
| Field | Value |
|---|---|
| transport | stdio |
| command | npx (or pnpm) |
| args | ["-y", "@json-to-office/mcp-server"] (["dlx", …] for pnpm) |
| env | optional; see the table below |
Pin a version by asking for one — npx -y @json-to-office/mcp-server@1.0.0 — which is worth doing for anything reproducible, since the renderer version is part of what a document renders to.
Options
| Flag / variable | Meaning |
|---|---|
--output-dir <path> |
Where generated files are written. Highest precedence. |
JTO_MCP_OUTPUT_DIR |
Same, when the flag is absent. |
| (neither output flag) | A per-connection directory under the system temp dir. |
--workspace-dir <path> |
Where workspace revisions are mirrored, so they outlive the connection. |
JTO_MCP_WORKSPACE_DIR |
Same, when the flag is absent. |
| (neither ws flag) | Workspaces are memory-only: handles end with the connection. This is the default. |
JTO_MCP_JOURNAL |
Append one JSON line per tool call here, and keep each delivered document beside it in <file>.documents/. For measurement runs; off by default. It records option values, digests and diagnostic codes, not document text, apart from the delivered documents. |
LIBREOFFICE_PATH |
LibreOffice binary, for preview and the docx visual component. |
PDFTOPPM_PATH |
poppler pdftoppm binary, for preview. |
Contracts
Output root. Every file the server writes lands under one directory, resolved from the table above. A requested file name is rejected — structurally, before anything touches the filesystem — if it is absolute, carries a drive letter, contains .., or resolves outside the root through a symlink. There is no way to ask for a write elsewhere. Unconfigured connections get an unpredictable owner-only temp root; new artifacts are owner-only too. A configured root is never deleted.
Artifacts. Generated bytes come back as a path by default: { mode: "path", path, relative, bytes, filename, mimeType }. Ask for outputMode: "base64" and you get { mode: "base64", base64, bytes, filename, mimeType } instead, but only under 4 MiB (jto_info.output.maxInlineArtifactBytes); over that the call returns E_ARTIFACT_TOO_LARGE rather than silently writing a file you were not expecting.
Diagnostics. A defective document is a normal result, never a protocol error. Every tool answers { ok, diagnostics, … }, where each diagnostic carries a stable code, a message, a severity of error / warning / info and — when the defect has a location — an RFC 6901 JSON Pointer in path, pointing into the document you sent. JSON-RPC errors are reserved for transport and server failures. An input that violates a tool's own input schema comes back as an isError result from the SDK, also not a protocol error.
Documents. Every document-taking tool accepts either inline JSON (document) or a workspace reference (handle, optionally revision), never both, and answers identically apart from the source field that says which you used. Inline is the portable baseline and needs no prior state.
stdout. Protocol frames only; the transport's own failures go to stderr. Warnings the renderer emits mid-run — unresolved fonts, unknown themes, an unreadable theme file — are collected for the duration of the call that caused them and come back in that call's diagnostics as W_HOST_NOTE, rather than on a stream no client reads.
The loop this server expects
jto_info— what this host can actually do: versions, formats and their renderer ids, the output root, whether workspaces are on and whether they survive a lost connection, and whether preview has its binaries.jto_discover(or thejto://catalogresource) — components per format, renderer profiles, built-in themes, and starter documents to copy.jto_describe_componentfor the exact schema of the one component you are about to write.- Author — start from a starter, or
jto_workspace_createand patch content in. jto_validateafter each edit, not once at the end. Diagnostics are path-addressed, so a pointer is a patch target.- Repair —
jto_workspace_patchat the pointers the diagnostics named, or fix the inline JSON. jto_previewwhenever the question is visual: did the table overflow, did the title wrap, is the slide crowded. It is an iteration step, not a final check.jto_critiquewhen the question is whether it is good enough to send:inspectrenders the evidence and the rubric,recordfiles the verdict you formed against the exact revision you saw. Three recorded iterate rounds is the limit.jto_generatefor the real file.jto_docx_diffwhen someone needs to see what changed.
jto_workspace_snapshot before a restructuring you could not cleanly undo.
Tools
Fifteen tools, in the order tools/list reports them.
| Tool | Purpose |
|---|---|
jto_info |
Versions, formats and renderer ids, output root and limits, preview dependency status. |
jto_discover |
Components, categories and allowed children per format, plus renderer profiles, themes and starters. |
jto_describe_component |
One component's exact schema, children, parents and renderer support. |
jto_scaffold |
A blueprint, a theme and the brief's facts become a draft workspace with a fill map of the slots owed. |
jto_validate |
Path-addressed diagnostics for a document, mirroring the gate generation applies. |
jto_generate |
Renders to a real .docx/.pptx, with render warnings alongside the artifact. |
jto_preview |
Renders selected pages to PNG, inline as images or written under the output root. |
jto_critique |
Renders evidence and the rubric to judge against, then records that verdict against a revision. |
jto_docx_diff |
A redline .docx with native Word tracked changes, plus a summary of what could not be tracked. |
jto_workspace_create |
Hold a document server-side; returns a handle and revision 1. |
jto_workspace_inspect |
Read a whole document, or only the JSON Pointers you name. |
jto_workspace_patch |
Apply an RFC 6902 patch atomically; bumps the revision. |
jto_workspace_snapshot |
Export the JSON and pin the revision it was taken at. |
jto_workspace_list |
Every document open on this connection, with revisions, sizes and the budget. |
jto_workspace_close |
Release a handle and its pinned snapshots. |
Every output below also carries the envelope: ok (boolean) and diagnostics (array, always present, possibly empty). Where a tool takes a document, document / handle / revision are the document source; where it renders, renderer / theme / themePath / deterministic / generatedAt / baseDir are the shared render options. themePath accepts data-only .json themes and resolves relative paths against baseDir; executable theme modules are rejected.
jto_info
Call this first.
In — includePreviewDependencies (boolean, default true): probe the filesystem for LibreOffice and poppler.
Out — server {name, package, version, protocolTransport}; runtime {node, platform, arch}; packages (installed versions of jto-ops, shared*, core-docx, core-pptx — a render is a function of the document plus these); formats[] {name, extension, label, rendererIds} with defaults first; workspaces {available, open, persistent, root?}; output {root, ephemeral, maxInlineArtifactBytes}; previewDependencies {libreoffice, pdftoppm}, each {available, path?, envVar, searched[]}, absent when not probed.
The probe is a PATH walk, not a --version spawn: jto_info is a per-connection discovery call and a cold soffice --version costs about a second. It therefore reports a binary that exists, not a binary that works; a real preview settles the rest.
jto_discover
Compact by design: names, not schemas.
In — format (docx | pptx, optional — omit for both); includeStarters (boolean, default true).
Out — formats[], each {name, extension, label, rootComponent, defaultRenderer, renderers[], components[], themes[], starters[]}. A renderer is {id, default, components[], unsupported[]}, where unsupported names what another renderer of the same format accepts and this one does not. A component is {name, category, description, hasChildren, root, renderers[], allowedChildren?, allowedParents[], stability?}. A theme is {name, displayName, description, whenToUse, extended} — the voice, the documents it suits and whether it is a complete visual system; jto://themes carries its values. A starter is a small valid document with {id, format, title, description, document}.
Today: docx roots at docx and renders with docxjs (default) or office-open, themes consulting, devportal, minimal, vermilion; pptx roots at pptx and renders with pptxgenjs (default) or office-open, themes consulting, dark, default, minimal. Read them from the server rather than from here — that list is what your installed version supports.
jto_describe_component
In — format and name (required); renderer (which profile to describe it under; profiles differ wherever a backend cannot draw something); expandProps[] (props to return in full, named by a previous call's elided).
Out — component {format, name, category, description, hasChildren, root, stability}; renderer (the profile schema came from); renderers[] {id, default, supported}; schema (the branch the validator dispatches on, with nested component unions collapsed to names); definitions (targets of the $refs left in schema, so it resolves standalone); elided[] {pointer, prop, bytes, hint}; allowedChildren[] (absent when the component takes none); allowedParents[].
Nested components collapse to their names on purpose — describe those separately instead of pulling one megabyte-scale schema through a model.
jto_scaffold
The first move for a report. A blueprint is an archetype as data — recommended theme, quality profile, the bundled template whose JSON blocks it invokes, and structural variants whose every slot holds a {{…}} marker carrying the guidance for filling it. Scaffolding one opens a workspace rather than returning JSON: the agent fills slots by pointer and never holds the document.
In — blueprint (required, an id from jto_discover or jto://blueprints); format (default docx, the only format with blueprints today); variant (the first when omitted); theme (a built-in name; the blueprint's recommended one when omitted — changes the look, never what validation asks); brief (facts by name: title, subtitle, client, date, author, confidentiality…); outline (markdown); title (the workspace label, the brief's title when omitted).
Out — workspace (a handle at revision 1); blueprint {id, variant, theme, profile, definitions, blocks[]}; fillMap[] {path, marker, guidance, kind, block?, slot?, type?, maxWords?, maxLength?, oneLine?, required?}, every marker still owed in document order, each path resolving at that revision; filled (markers the brief and outline wrote).
The mapping is small enough to state. A brief fact fills props.metadata.<key> (client also fills company) and the <key> slot of the document's chrome — the cover and the running head — never a body block, where title means something else; a key that matches nothing is reported as W_BRIEF_UNUSED. An outline's # Heading is the title (the brief's wins), each ## Heading in order fills the next section opener, and the paragraphs and bullets beneath it fill that section's body text markers in order; sections or paragraphs the variant has no room for, text before the first ##, a second # and any deeper heading are reported as W_OUTLINE_UNMAPPED and nothing is dropped silently.
On a deck the outline also decides the slides, in three ways and no others. A section whose bullets all read Label: figure — Churn: 3.1%, Margin: 41 pts (+3.2) — becomes rows of measurements, split evenly at the KPI block's own item ceiling so no slide carries a lone number. A section with more bullets than a slide's list holds becomes as many slides as it needs, in order, the later ones titled "(cont.)". A markdown table fills the evidence column of a two-column slide, with the columns whose body cells are all numbers right-aligned, and a Source: line fills the source of every slide the section became. Each is reported as W_OUTLINE_TRANSFORMED. Every slide is a structural clone of one the variant already drew, so the block definitions and their dependencies stay the blueprint's; where the variant draws no slide of the shape a section asks for, the section is filled as the variant's own slide and W_OUTLINE_UNMAPPED says which shape was wanted. Every scaffold answers with W_SCAFFOLD_DRAFT saying how many markers remain.
The scaffold is schema- and semantic-valid, carries the block definitions it invokes and their dependencies under props.blocks (nothing is looked up at render time), and names its profile in props.qualityProfile, so jto_validate judges it against the archetype from the first call: the markers come back as advisory W_QUALITY_SCAFFOLD_MARKER findings with ok: true and generationReady: false. jto_generate refuses while any marker remains, naming every one by pointer. Patch each fillMap[].path with jto_workspace_patch (pass baseRevision to make the write conditional), and jto_validate reports generationReady: true.
jto_validate
In — format (required); document source; renderer (validate against this profile instead of the document's own, for this check only); baseDir (what relative image paths resolve against — pass the one you will generate with); quality {profile?, policy?}; maxDiagnostics (1–1000, default 100 — errors are kept ahead of warnings when the cap bites).
Out — valid, generationReady (valid and no {{…}} scaffold marker left — the state jto_generate accepts), scaffoldMarkers (how many remain), format, renderer (when one was requested), source {origin, handle?, revision?}, counts {error, warning, info} (before any cap), truncated, profileId (the quality profile the analysis ran under).
ok mirrors the gate generation applies: schema and semantic errors block it, renderer-profile findings (W_UNSUPPORTED_RENDERER_FEATURE) come back as warnings, because the renderer has the last word on those.
What the document points at is checked the way generation will use it. A props.theme that names no theme is W_UNKNOWN_THEME at /props/theme, listing the themes that exist: generation falls back to consulting, the house default, and renders. An image file that cannot be read is E_ASSET_UNREADABLE at the image's props/path, with relative paths resolved against baseDir (or the server working directory) exactly as jto_generate resolves them — except where generation steps around it: a DOCX table cell draws a text placeholder (W_ASSET_UNREADABLE), and PPTX never reads a file outside baseDir or the working directory, dropping the image with the same W_IMAGE_PATH_OUTSIDE_ROOTS generation reports. URLs and data URIs are not checked.
Design-quality findings ride the same envelope as W_QUALITY_* warnings and infos: an undeclared slide canvas, estimated text overflow, overcrowding, unreadable type, table overflow, or a skipped heading. They carry category, certainty, evidence, suggestion, and optional fixes. They are advisory by default; quality.policy.gate: "warning" makes warning-or-higher findings set ok: false without turning the tool call into a protocol error.
The gate, not jto://schema/{format}/document. The two agree except on component nodes whose props are all optional, where the generated schema asks for a props: {} the validator and both renderers treat as omissible; validate follows the renderer, because that is what jto_generate runs.
jto_generate
In — format (required); document source; render options; outputMode (path | base64, default path); filename (relative to the output root, default document.docx / presentation.pptx); fonts {strict, mode: "custom" | "substitute" | "embed", substitution, baseDir, googleFonts: {enabled, fetchTimeoutMs}} (embed is DOCX on the docxjs renderer only); validation {allowUnknownFields}.
Out — format, renderer (when requested), theme (what the render actually settled on, absent when the document's own props.theme decided), artifact, source.
Warnings the render emitted arrive as warning-severity diagnostics in the same envelope as a successful artifact — one place to look whether generation refused or merely compromised. An image the render could not read is E_ASSET_UNREADABLE: at the image's props/path, exactly as jto_validate reports it, when the document names a local file there; without a pointer, and with the path or URL the render tried in context.source, when it could not have — a URL that did not answer, a path fed through a block's string slot. That second case needs a renderer that reads the image itself, which every DOCX renderer and PPTX office-open do; pptxgenjs reads its own. The tool reports progress against a three-step total when the client sends a progress token, and checks for cancellation before the write so an abandoned request leaves no file behind.
jto_preview
In — format (required); document source; render options; pages (printer syntax, 1-based and inclusive: "all" (default), "3", "2-5", "4-", "-3", "1-3,7"; at most 50 pages per call); dpi (36–600, default 150); outputMode (auto | images | path, default auto); filenamePrefix (each page becomes <prefix>-pNNN.png under the output root).
Out — format, source, totalPages, selection (canonical spelling of what was rendered), dpi, delivery (images | paths), pages[] {page, width, height, bytes, cached, delivery, artifact?}, renderer {engine, libreoffice, pdftoppm, fidelity}, cache {key, documentKey, hits, misses, enabled}, timings {generateMs, convertMs, rasterizeMs}.
Inlined pages ride in image content blocks, not in the structured output — they follow the text block in page order and correspond to the pages[] entries whose delivery is image. auto inlines when the payload fits the client-safe budget (at most 10 pages, 2 MB per page, 8 MB total) and writes files otherwise; images refuses instead of falling back; path always writes.
The pixels come from LibreOffice, not from Microsoft Office. Line breaks, pagination, font substitution and chart rasterization can differ from what Word or PowerPoint does on the recipient's machine — a strong indication of layout, not the final document.
jto_critique
Workspace only: a critique is about a revision, so there has to be one.
In — action (inspect | record, required); handle (required); format (the workspace's own when omitted); revision; evidencePages (0–4, default 4); and for record: runId, verdict (ship | iterate), rationale, level (1–5, optional), accept (ship only: {code | ruleId | path, pathMatch?, reason}[], the integrity findings you judge wrong about this document — the selectors a quality policy suppression takes).
Out (inspect) — run {id, handle, revision, round, roundsRemaining}, rubric {levels[], shippingQuestion}, contactSheet, evidence[] {page, reason, findings, delivery, artifact}, rendered (the rendered pass's summary), totalPages, dpi, renderer. The rendered pass's findings ride in diagnostics with certainty rendered. The sheet and the chosen pages come back as image content blocks, sheet first; every page is written under the output root either way, so the evidence is reachable whatever the inline budget allows.
Out (record) — record {runId, handle, revision, verdict, rationale, level?, accepted?, recordedAt}, rounds, roundsRemaining, stop. accepted keeps each finding a ship verdict accepted, with its reason.
The server does not judge — the model in the conversation does. What the server owns is the count, and it owns it strictly: only record creates a round, re-sending the same runId returns the round already filed rather than a second one (W_CRITIQUE_DUPLICATE), and a verdict about a revision the workspace has since moved past is refused with E_STALE_REVISION rather than filed against a document nobody saw. A ship verdict answers for the integrity findings the inspection showed — text clipped, spilled, overlapping or missing on the rendered page, at warning or worse: while one is neither repaired nor accepted in accept with a reason, the record is refused with E_CRITIQUE_OPEN_FINDINGS and no round is spent. The judgement stays the model's, since the rendered matcher can be wrong about a document; what it cannot be is silent, and a ship filed over accepted findings answers with W_CRITIQUE_FINDINGS_ACCEPTED. Three recorded iterate rounds is the limit; the third answers with a stop recommendation. None of it gates jto_generate.
Needs LibreOffice and poppler, like jto_preview.
jto_docx_diff
DOCX only.
In — before and after (required), each a nested document source {document?, handle?, revision?}; author (shown in Word); date (ISO 8601 — omit for a deterministic redline); dryRun; includeRedlineDocument; render options; outputMode / filename.
Out — summary {tracked: {modified, inserted, deleted}, untracked[], unchangedBlocks, notes[]}; artifact (unless dryRun); redline (the redline document JSON, only when asked for); dryRun; before and after source summaries.
Both sides are validated before the walk, and their diagnostics are tagged with context.side. So is an image the redline could not render: E_ASSET_UNREADABLE at its pointer in whichever document names it. Read summary.untracked: changes with no native Word revision — tables, images, charts — are invisible as revisions inside the file itself.
Workspaces
Optional, and an optimization rather than a second source of truth: the JSON stays authoritative, and every tool that takes a handle also takes inline document. The point is the round trip you do not make — open a document once, patch the two paths a diagnostic pointed at, validate or preview by handle, without putting the whole tree back through the model. By default handles are memory-only and scoped to one stdio connection.
Default budget per connection: 16 open documents, 16 MiB per document, 64 MiB in total, 8 pinned revisions each, and a 30-minute idle TTL that any use resets. Capacity overflow refuses with E_WORKSPACE_LIMIT; it never evicts another live workspace or an older pin. jto_workspace_list reports the live figures.
Surviving a lost session. Start the server with --workspace-dir (or JTO_MCP_WORKSPACE_DIR) and every committed revision is mirrored there, so a client restart, a host session reset or a crash no longer takes the authoring with it. Memory stays the fast path; disk is durability. On a connection that has it:
- Each
jto_workspace_create,jto_workspace_patchandjto_workspace_snapshotwrites before it answers, and theworkspacerecord carriespersisted. jto_workspace_listreports every workspace under the root, including ones this connection never opened — that is how a reconnecting agent gets its handles back.jto_workspace_inspect(and any other handle-taking tool) then loads the document on demand.- The idle TTL still releases memory, but no longer loses anything: the handle comes back from disk on next use.
jto_workspace_closedeletes the durable copy too. It is the one operation that is meant to destroy work, so it still does.- The root is bounded: 32 workspaces (least-recently-updated dropped first), 9 revision files per workspace — the head plus its pins — and 16 MiB per revision. A revision that cannot be written comes back with a
W_WORKSPACE_NOT_PERSISTEDwarning and the edit still applies: durability degrades loudly, never silently, and never at the cost of the edit.
Handles become cross-connection when this is on, so point it at a directory you would be comfortable leaving documents in: it holds the JSON in the clear until something closes the workspace or the workspace ceiling evicts it. The server creates the root 0o700 and writes files 0o600, but it does not touch the permissions of a directory that already exists, and Windows does not honour those bits at all — so pick a private location and check its ACLs rather than relying on the server for that. Two connections sharing a root also share its handles, and each keeps its own memory copy: baseRevision still guards a write against the connection that made it, not against another one editing the same handle at the same time. One root per client is the arrangement this is built for.
jto_workspace_create — in: format (required), document (omit to open an empty skeleton and patch into it), title (your own label). Out: workspace. Nothing is validated here.
jto_workspace_inspect — includeBlocks: true adds document-local definitions, derived slot schemas and invocation fill pointers, without catalog references. In: handle (required), revision (the current one, or one pinned by a snapshot; anything else fails rather than quietly returning newer JSON), paths[] (project only these pointers), includeDocument (default false when paths is given, true otherwise). Out: workspace, document, projection (pointer → value), missingPaths[] — so "absent" stays distinguishable from "present and null".
jto_workspace_patch — in: handle and operations[] (required; RFC 6902 add / remove / replace / move / copy / test, applied in order), baseRevision (makes the write conditional; a mismatch fails with E_STALE_REVISION). Out: workspace. Atomic: the whole patch is checked, applied to a copy, and committed only if every operation lands — a failure leaves the document exactly as it was and does not burn a revision. Invalid intermediate states are allowed on purpose; validate when you are ready.
jto_workspace_snapshot — in: handle (required), filename (write the JSON under the output root instead of returning it inline). Out: workspace, document or artifact. Pins the revision so jto_workspace_inspect can still read that exact tree after later patches; a full pin budget downgrades to an export with a W_SNAPSHOT_NOT_PINNED warning.
jto_workspace_list — no input. Out: workspaces[], available, limits, usage {workspaces, bytes}, and persistence {root, maxWorkspaces, maxRevisionsPerWorkspace, maxEntryBytes} when the connection has a workspace directory. The cheapest way back after losing track of a handle — including across a reconnect.
jto_workspace_close — in: handle (required). Out: handle, closed. Idempotent; closing something already gone reports closed: false rather than failing. Not recoverable — it removes the durable copy as well, so snapshot first.
A workspace record is {handle, format, revision, bytes, createdAt, updatedAt, title?, pinnedRevisions[], persisted?}.
Resources
The same catalogues, for clients that read resources. URIs are stable.
| URI | Contents |
|---|---|
jto://catalog |
The resource form of jto_discover: every format, in full. |
jto://renderers |
Renderer ids per format, which is default, what each profile can draw. |
jto://themes |
Every built-in theme described: voice, when to use it, typefaces, palette, and the extended values it carries. |
jto://themes/values |
The raw theme objects behind those names: palette, fonts, style tables. |
jto://guide/design/docx |
The DOCX design guide, generated from the themes, profiles, rule pack, blocks and blueprints jto_validate enforces. |
jto://guide/design/pptx |
The same for PPTX. |
jto://blocks |
JSON block authoring references derived from playground templates; copy definitions into the document before use. |
jto://blueprints |
Every blueprint in full — theme, profile, definitions and each variant's plan; jto_discover carries the summaries. |
jto://templates |
Every starter document, plus the manifest of every bundled gallery template. |
jto://schema/docx/document |
Generated JSON Schema for a complete .docx document, by renderer. |
jto://schema/pptx/document |
The same for .pptx. |
jto://schema/docx/theme |
Generated JSON Schema for a .docx theme file, as passed to themePath. |
jto://schema/pptx/theme |
The same for .pptx. |
All application/json. The document schemas are megabytes — prefer jto_describe_component unless you genuinely need the whole thing. Tools and resources are generated from the same registries, and a drift test fails the build if they disagree.
Prompts
Three entry points into the loop above, for clients that offer prompts. They are a convenience, not a second home for the workflow: each renders one user message that lands on jto_scaffold and walks the same fill → validate → look → judge → ship path, naming the blueprints and themes the cores actually ship rather than a copy that could drift.
| Prompt | Arguments | What it renders |
|---|---|---|
design-brief |
subject*, audience, format |
The six lines a document is designed against, then the archetype and theme to build it with. |
report-from-notes |
notes*, client, title, blueprint |
Rough notes restructured as a markdown outline, then scaffolded as a report. |
deck-from-outline |
outline*, client, variant |
An outline scaffolded as a deck, naming the three transformations the outline itself decides. |
* required.
Preview requirements
jto_preview shells out to two host binaries: LibreOffice (soffice, to convert the generated file to PDF) and poppler (pdftoppm, to rasterize that PDF to PNG). Neither is bundled — they are tens of megabytes and platform-specific.
# macOS
brew install --cask libreoffice && brew install poppler
# Debian / Ubuntu
sudo apt-get install libreoffice poppler-utils
# Windows
winget install TheDocumentFoundation.LibreOffice; winget install oschwartz10612.Poppler
They are looked for in LIBREOFFICE_PATH / PDFTOPPM_PATH first, then in the usual install locations, then on PATH.
What degrades without them: only preview. Discovery, validation, generation, diff and every workspace tool work on a host with neither, because generation writes OOXML directly and never launches an office suite. jto_preview returns E_DEPENDENCY_MISSING naming what is missing, where it looked, which environment variable overrides the search and the install line for the platform — a structured refusal, never a crash. jto_info.previewDependencies answers the same question before you spend a call on it.
The one other feature that wants LibreOffice is the DOCX visual component, which rasterizes a slide into a Word document.
Diagnostic codes
Stable: agents branch on them, so they are added freely and never renamed. E_ blocks, W_ does not. The validators underneath speak dialects of their own — TypeBox reports a defect as an enum ordinal, the cores use snake_case names — and every one of them is mapped into this table at the boundary; the original spelling rides along in context.validatorCode for anyone debugging a validator rather than a document.
The cores name their generation warnings in a dialect of their own too — bare FONT_UNRESOLVED, CHART_NO_DATA, lower-case theme_not_found — and those are prefixed into W_ and upper-cased rather than passed through, so that reading the first two characters is a total test: every diagnostic this server emits starts E_ or W_, and nothing has to be special-cased to find out whether it blocks. The core's own spelling stays on context.code, which is the string jto-cli prints if you are comparing the two surfaces.
| Code | Raised when |
|---|---|
E_REQUIRED_PROPERTY |
A property the component requires is absent. |
E_UNEXPECTED_PROPERTY |
A property the component does not declare. |
E_TYPE_MISMATCH |
A value of the wrong JSON type. |
E_UNION_MISMATCH |
No branch of a union accepted the value. |
E_VALUE_CONSTRAINT |
Right type, outside the schema's bounds, length, pattern or format. |
E_INVALID_VALUE |
Right type and shape, but not a value this position accepts. |
E_UNKNOWN_COMPONENT |
name is not a component of this format, or not one allowed here. |
E_MUTUALLY_EXCLUSIVE |
Two props that exclude each other were both set. |
E_UNSUPPORTED_CELL_CONTENT |
A DOCX table cell holds a component it cannot render; the message names what a cell takes. |
E_INVALID_LATEX |
A DOCX formula — an equation's latex or a \(…\) in text — that the renderer cannot convert. |
E_THEME_NOT_FOUND |
A theme the document names does not exist. |
E_ASSET_UNREADABLE |
An image the document names — a file, or a URL — cannot be read, and generation fails over it. |
E_EMPTY_DOCUMENT |
The document has no content. |
E_INVALID_DOCUMENT |
The document fails a rule with no more specific code. |
E_INVALID_JSON |
A document string does not parse. |
E_DOC_SOURCE_MISSING |
Neither document nor handle was given. |
E_DOC_SOURCE_AMBIGUOUS |
Both were. |
E_UNKNOWN_HANDLE |
The handle is not open on this connection. |
E_STALE_REVISION |
revision / baseRevision no longer matches. |
E_WORKSPACES_UNAVAILABLE |
Workspaces are switched off for this connection. |
E_WORKSPACE_EVICTED |
The handle was released by the idle TTL. |
E_WORKSPACE_LIMIT |
The connection's workspace or byte budget is full. |
E_WORKSPACE_NOT_CLOSED |
The durable copy could not be deleted, so nothing was closed. The workspace is still open. |
E_DOCUMENT_TOO_LARGE |
One document is over maxDocumentBytes. |
E_PATCH_SYNTAX |
An operation is malformed. |
E_INVALID_POINTER |
A JSON Pointer is not RFC 6901. |
E_PATCH_FAILED |
An operation could not be applied. |
E_PATCH_TEST_FAILED |
A test operation did not hold. |
E_OUTPUT_ROOT_ESCAPE |
A file name would land outside the output root. |
E_ARTIFACT_TOO_LARGE |
outputMode: "base64" was asked for above the inline limit. |
E_UNKNOWN_RENDERER |
The renderer id does not exist for this format. |
E_UNSUPPORTED_FORMAT |
The tool does not support that format (jto_docx_diff is DOCX-only). |
E_INVALID_DATE |
A date option is not ISO 8601. |
E_INVALID_THEME_PATH |
themePath is not a data-only .json theme path. |
E_INVALID_PAGE_SPEC |
pages is malformed, or selects pages the document does not have. |
E_PREVIEW_TOO_LARGE |
Inline images were demanded above the client-safe budget. |
E_PREVIEW_RENDER_FAILED |
A preview stage (build, convert, rasterize) failed. |
E_PREVIEW_PAGE_COUNT_UNAVAILABLE |
The PDF produced no readable page count. |
E_DEPENDENCY_MISSING |
A host binary preview needs, or an optional renderer backend, is absent. |
E_CANCELLED |
The client cancelled the request. |
E_SCAFFOLD_MARKER |
jto_generate met an unfilled {{…}} scaffold marker; every one is named by pointer. |
E_BLUEPRINT_NOT_FOUND |
No blueprint, or no variant of one, by that name for the format. |
E_INTERNAL |
A bug here. Everything else is about your document or your host. |
W_UNSUPPORTED_RENDERER_FEATURE |
The renderer cannot draw one feature of an otherwise valid document. |
W_HOST_NOTE |
A note the render emitted mid-run — unknown theme, unreadable theme file, staged font. |
W_UNKNOWN_THEME |
A theme name — the theme option or the document's props.theme — matched nothing; generation falls back. |
W_ASSET_UNREADABLE |
An image file that cannot be read where generation draws a placeholder instead (a DOCX table cell). |
W_UNSUPPORTED_CELL_CONTENT |
A DOCX table cell met at generation holds one it cannot render; it shows a placeholder. |
W_BLANK_DOCUMENT |
A workspace was opened on an empty skeleton, with no content yet. |
W_SCAFFOLD_DRAFT |
A scaffold opened; the message says how many markers are still owed. |
W_BRIEF_UNUSED |
A brief key matched no metadata field or chrome slot of the variant. |
W_OUTLINE_UNMAPPED |
An outline section or paragraph found no opener or body slot to fill. |
W_OUTLINE_TRANSFORMED |
An outline section became slides of a shape the variant did not draw it with. |
E_CRITIQUE_RUN_UNKNOWN |
jto_critique record named a run this connection never opened. |
W_CRITIQUE_DUPLICATE |
A verdict was already filed for this run; the retry changed nothing and did not count. |
W_CRITIQUE_STOP |
The rounds are spent, or the verdict was to ship. |
E_CRITIQUE_OPEN_FINDINGS |
A ship verdict left an integrity finding of the inspection neither repaired nor accepted. |
W_CRITIQUE_FINDINGS_ACCEPTED |
A ship verdict was filed over accepted integrity findings; they are still in the document. |
W_PATH_NOT_FOUND |
A pointer a read asked for does not resolve in that revision. |
W_SNAPSHOT_NOT_PINNED |
A snapshot was exported but not pinned: the workspace budget is full. |
W_WORKSPACE_NOT_PERSISTED |
The edit applied, but the revision did not reach the workspace directory. |
W_GENERATION |
A generation warning with no code of its own. |
W_<CORE_CODE> |
A generation warning the core named: W_FONT_UNRESOLVED, W_CHART_NO_DATA, W_UNKNOWN_SHAPE and friends. |
Budget
Measured on Node 24.15, macOS arm64, median of five runs. Cold start is spawn to initialized; the first jto_info additionally loads both generator cores to read their renderer registries and probes the host binaries.
| Step | Median |
|---|---|
spawn → initialized |
217 ms |
first jto_info (cores + binary probe) |
93 ms |
subsequent jto_info (probe suppressed) |
2 ms |
The published tarball is ~300 kB (~1.2 MB unpacked, two thirds of which is source maps). The runtime dependency closure is ~118 MB on disk across 63 packages, dominated by things that are not this server: date-fns (36 MB, via core-docx), koffi (28 MB, the FFI the Windows font stager needs), the MCP SDK with its zod (13 MB) and TypeBox (5 MB). Nothing terminal-facing — no ink, react, commander or chalk — is in the graph.
Embedding
The package also exports the server itself, for a host that owns its own transport:
import { createServer, createToolDeps } from '@json-to-office/mcp-server';
const server = createServer(createToolDeps({ outputDir: './out' }));
await server.connect(myTransport);
setWorkspaceStore before createServer installs your own store — with tighter limits, or unavailableWorkspaceStore to switch workspaces off entirely. createToolDeps({ workspaceDir }), or a workspacePersistence you build with createWorkspacePersistenceAt, gives the connection's own store disk backing instead.
License
MIT