mcp

v0.11.1
@open-document/mcp Checked 5 hours ago Published 5 days ago

MCP server for open-doc — lets any agent framework list, read, write, and file documents over Streamable HTTP or stdio.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

list_documents List documents

Every document in the workspace with its id, title, theme, and folder. Start here.

read_document Read document source

The TSX source of a document. A document is React — read it before editing it. For a long document, call outline_document first and pass fromLine/toLine to read only the part you change; leave both out for the whole file.

ParameterTypeDescription
docId *string
fromLineintegerfirst line to read, 1-based
toLineintegerlast line to read, inclusive

outline_document Outline document source

Where things are in a document without its source: line count, each top-level block (design, components, pages) with its line range, and every h1–h3 with its line. Start here with a long document, then read_document with fromLine/toLine.

ParameterTypeDescription
docId *string

search_document Search document source

Every line of a document’s source that contains some exact text (a colour such as #fff, a component, a phrase), with its line number. Finds what to change across a long document without reading all of it.

ParameterTypeDescription
docId *string
text *stringexact, case-sensitive text to look for

edit_document Replace exact text in the source

Change one exact piece of a document’s source: `find` (copied exactly from read_document or search_document, spacing and quotes included) becomes `replace`. `find` must occur once — pass fromLine/toLine (the range you read) when the same text appears elsewhere — unless `all` is set to change every occurrence. Use it for small changes instead of rewriting the whole file with write_document.

ParameterTypeDescription
docId *string
find *stringthe exact text to change
replace *stringwhat it becomes
allbooleanchange every occurrence, not just one
expectedHashstringoptional 16-char hash from read_document; refuses the edit if the file changed
fromLineintegerlook for `find` only from this line (1-based), e.g. the range you read
toLineinteger…to this line, inclusive

create_document Create document

Write a new docs/<id>/index.tsx. Fails if the id is taken. Read a theme first and follow its components.

ParameterTypeDescription
docId *stringkebab-case folder name under docs/
source *stringcomplete TSX module source

list_templates List templates

Templates a new document can start from — built-in and the workspace’s own templates/<name>/. The `name` is what create_from_template takes.

create_from_template Create document from template

Copy a template into docs/<id>/, retitled and dated today. Start here rather than from a blank file when a template fits; call list_templates for the names.

ParameterTypeDescription
template *stringa name from list_templates
docIdstringkebab-case folder name; derived from the title when omitted
titlestringmeta.title of the new document

write_document Overwrite document source

Replace a document’s source. Pass `expected` (the source you read) or `expectedHash` (the 16-char SHA-256 hash returned by read_document) to be refused instead of clobbering a concurrent edit.

ParameterTypeDescription
docId *string
source *string
expectedstringthe source you last read; enables conflict check
expectedHashstringthe 16-char hash returned by read_document; enables lightweight conflict check

rename_document Rename document

Rewrites meta.title in the source. The document id never changes.

ParameterTypeDescription
docId *string
title *string
expectedHashstringoptional 16-char hash from read_document; refuses write if file changed

duplicate_document Duplicate document

Copies the folder to a fresh id, lands in the same folder as the original.

ParameterTypeDescription
docId *string
newIdstring

delete_document Delete document

Removes the document folder from disk. Not reversible.

ParameterTypeDescription
docId *string

read_text Read text at a location

The editable text runs at a line:column. Use before write_text to learn the run index and current value.

ParameterTypeDescription
docId *string
locs *array
propstringa path into the element’s attributes for words a component prints from a prop, e.g. `caption` or `columns.2.label` (the `data-od-prop` on the rendered element)
shownstringrendered text, disambiguates helper components

write_text Replace text at a location

Surgical edit of one text run, leaving surrounding markup untouched. Pass `expected` (or `expectedHash`) so a stale write is refused. A run that read_text returned with `segments` (code, emphasis, links) must be written with `segments` too, or it is refused rather than losing its formatting.

ParameterTypeDescription
docId *string
loc *object
text *string
expectedstring
expectedHashstringoptional 16-char hash from read_document or read_text; refuses write if file changed
indexintegerwhich run, for mixed content
propstringas in read_text
segmentsarraythe run as formatted pieces, in order; their texts concatenate to `text`

add_comment Leave a comment marker

Anchors a @doc-comment note in the source for a later pass to act on, without changing the copy.

ParameterTypeDescription
docId *string
loc *object
note *string
expectedHashstringoptional 16-char hash from read_document or read_text; refuses write if file changed
hintstring

list_themes List themes

House styles available in this workspace.

read_theme Read a theme

The theme document: palette, type scale, page setup, and paste-ready components. Read this before writing a document that declares the theme.

ParameterTypeDescription
themeId *string

list_assets List assets

Images in a scope — a document id, or "global" for the shared directory.

ParameterTypeDescription
scopestring

upload_asset Upload an asset

Writes a base64 payload into the scope’s assets directory.

ParameterTypeDescription
base64 *stringfile contents, base64 encoded
filename *string
scope *string

find_asset_usages Find asset usages

Which documents import an asset. Check this before deleting one.

ParameterTypeDescription
filename *string
scope *string

delete_asset Delete an asset

Removes the file. Run find_asset_usages first.

ParameterTypeDescription
filename *string
scope *string

list_folders List folders

The folder manifest and which document sits in which folder.

create_folder Create folder

Adds a folder to the manifest.

ParameterTypeDescription
name *string
iconobjectdefaults to a grey colour chip

file_document File a document

Assigns a document to a folder, or unfiles it with folderId: null.

ParameterTypeDescription
docId *string
folderId *string | null

check_layout Check the layout

Renders the document at true page size and reports what is wrong with the sheets — content clipped by the page edge, a blank page, a heading stranded at the foot of a page, unreadable type, an image that failed to load. Findings carry a `loc` (line:column) pointing at the source. Run this after writing or editing a document: it is the only way to see what you actually produced. With `maxPages`, going over is an error and `budget` says how many pages must go and how many each top-level section takes.

ParameterTypeDescription
docId *string
maxPagesintegerPage limit the document must fit in

translation_status Translations and what they are behind

Every document that declares `meta.translationOf` (the source document's id) and `meta.translatedAt` (the source commit it matches), with its state: current, stale (the source changed since), unsynced (no translatedAt yet), missing-source, unknown-revision or no-git. Stale ones list the changed source files and commits. Pass `docId` with `diff: true` to get the source's changes as a unified diff — translate only those, then call mark_translated.

ParameterTypeDescription
diffbooleanInclude the source's unified diff since translatedAt
docIdstringOne translation; omit for all

mark_translated Mark a translation as up to date

Sets the translation's `meta.translatedAt` to the source's last commit (or `revision`). Call it after the translation has caught up with every change translation_status listed. Refuses while the source has uncommitted changes.

ParameterTypeDescription
docId *stringThe translation, not the source
revisionstringSource commit it now matches; defaults to the last one

proofread_document Proofread the text

Reads the text the document prints and reports consistency slips: full-width letters or digits, punctuation of the wrong width for the document's language, Simplified characters in a Traditional Chinese document (or the reverse), a doubled word, one term capitalised two ways. Each finding has a page, a snippet and a `loc` (line:column). Advice, not errors — fix what is a real slip, leave what is intended. Code is not read.

ParameterTypeDescription
docId *string

render_page Screenshot a page

A PNG of one sheet at true page size, exactly as it prints. Use it when check_layout reports something you need to look at, or to confirm a design change landed.

ParameterTypeDescription
docId *string
page *integer1-based page number

export_document Export a document

Writes the document to disk headlessly — pdf, html, one png per page, or docx (structure Word flows itself, for review in Word). The output directory must stay inside the workspace.

ParameterTypeDescription
docId *string
eachbooleanone copy per row of the document’s `records` — certificates, letters, quotes
formatstring
namestringwith each: file name pattern, `{column}` for a value and `{#}` for the row number
outDirstringrelative to the workspace root; defaults to `out`

diff_document What changed since a revision

Renders the document as it is and as it was at a git revision (default HEAD), pairs the pages by content, and reports each page as same, changed, added or removed — with the lines of text added and removed and the changed regions. Also writes a self-contained HTML report with before/after pictures for a human reviewer. Use it to summarise your edits before handing a document back, or to answer "what changed since main".

ParameterTypeDescription
docId *string
outDirstringrelative to the workspace root; defaults to `out`
sincestringgit revision to compare against; defaults to HEAD

import_markdown Import Markdown

Turns Markdown into a real document under docs/ — flow() body, cover page, local images copied into the document’s assets. Use this instead of hand-writing TSX when the user already has the content written.

ParameterTypeDescription
authorstring
contentsbooleanadd a self-filling contents page
coverbooleanopen with a title page; defaults to true
docIdstringdefaults to a slug of the title
filestringpath to a .md file inside the workspace
langstringBCP 47 tag, e.g. zh-Hant-TW; detected for Chinese, Japanese and Korean when omitted
markdownstringthe Markdown itself
orientationstring
pageSizestring
subtitlestring
themestring
titlestring

import_docx Import Word document

Turns a Word .docx file into a real document under docs/ that looks like the Word page: page size and margins, alignment, indents, fonts, sizes, colours, tables with their column widths, merged cells, borders and shading, fill-in blanks, page breaks. Headings in Word heading styles stay real headings. Pass `plain: true` for structure only in the house style (with a cover), like import_markdown. `warnings` lists what Word had that the document could not hold (text boxes, footnotes, comments, tracked changes); tell the user about them.

ParameterTypeDescription
file *stringpath to a .docx file inside the workspace
authorstring
contentsbooleanwith plain: add a self-filling contents page
coverbooleanwith plain: open with a title page; defaults to true
docIdstringdefaults to a slug of the title
langstringBCP 47 tag, e.g. zh-Hant-TW; detected for Chinese, Japanese and Korean when omitted
orientationstring
pageSizestring
plainbooleanstructure only in the house style instead of the Word page look
subtitlestring
themestring
titlestring