MDZip

v0.3.0
io.github.mdzip-project/mcp-server Checked 14 hours ago Published 1 day ago

Read, search and edit MDZip (.mdz) documents: Markdown plus its images in one file.

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

mdz_find_archives

Find .mdz files in a folder and its subfolders, to get the archivePath for the other mdz_ tools. Use it when the user names a document but not its path. Skips hidden folders and node_modules, and doesn't follow links. Without folder, searches every folder this server may use; if the server has no folder limits, folder is required. Returns each archive's absolute path, size and last-modified time, nearest folders first.

ParameterTypeDescription
folderstringFolder to search. Absolute, or relative to the first folder this server may use.
maxDepthnumberHow many subfolder levels to search below each folder (0 = only the folder itself). Defaults to 6 and is clamped to 0..20.
maxResultsnumberMaximum archives to return. Defaults to 100 and is clamped to 1..1000.
nameContainsstringOnly return archives whose file name contains this text (case-insensitive).

mdz_review_document

Preferred first call for review/analyze/summarize requests on an .mdz file. Returns markdown text and referenced images plus canonical/entrypoint resolution metadata, including canonicalContentHash — pass that back as expectedContentHash to upsert_canonical_document to guard against overwriting edits made elsewhere (e.g. in the VS Code editor) since this read.

ParameterTypeDescription
archivePath *stringAbsolute or workspace-relative path to the .mdz file.
entryPathstringOptional archive-relative markdown path. When omitted, the server resolves manifest-first canonical markdown.
maxImagesnumberOptional cap for returned images to control payload size. Defaults to 12 and is clamped to 1..50.

upsert_canonical_document

Preferred write path for markdown updates. Updates manifest-first canonical markdown and returns changed paths plus post-write validation. Requires expectedContentHash (from a prior mdz_review_document call) and fails with a CONTENT_CONFLICT error instead of overwriting if the on-disk canonical content has changed since that read.

ParameterTypeDescription
archivePath *stringAbsolute or workspace-relative path to the .mdz file.
content *stringNew markdown content for the canonical entrypoint document.
expectedContentHash *stringThe canonicalContentHash returned by the most recent mdz_review_document call for this archive. The write is rejected with CONTENT_CONFLICT if the current on-disk hash no longer matches, which means t…

mdz_create_archive

Create a new .mdz file: use this to start an MDZip document from scratch. Don't build an .mdz yourself with zip tools or a script (Python, PowerShell, zip); a hand-made archive can miss the manifest and other format rules, and nothing checks it. Pass every file in files (the Markdown documents plus any images, diagrams, stylesheets or data), with title, mode and entryPoint for the manifest. The archive is built in memory, validated, and written once; nothing is written if validation finds errors. Fails with ARCHIVE_EXISTS if archivePath is taken, unless overwrite is true. Adds the standard AGE…

ParameterTypeDescription
archivePath *stringAbsolute or workspace-relative path of the new .mdz file. Missing parent folders are created.
files *arrayEvery file to put in the archive: at least one Markdown document, plus any images, diagrams (.svg, .drawio), stylesheets or data files. Give each file's content as exactly one of content, sourcePath o…
authorstringOptional author name for the manifest.
descriptionstringOptional one-sentence description for the manifest.
entryPointstringPath of the main Markdown document, which opens first. Optional when there is only one Markdown file or one is named index.md.
includeAgentsGuidebooleanAdd the standard AGENTS.md that tells AI tools without MDZip support how to read and edit the archive safely. Defaults to true. Ignored if files already has an AGENTS.md.
languagestringOptional language tag for the manifest, for example en or en-US.
modestring"document" (default): one document, possibly split across several Markdown files (chapters, sections). "project": several separate documents that link to each other.
overwritebooleanReplace archivePath if it already exists. Defaults to false. Only set it when the user asked to replace that file.
titlestringDocument title for the manifest. Defaults to the main document's first # heading, then the file name.

mdz_write_entry

Add or replace any file inside an .mdz archive: another Markdown document, an image, a diagram (.svg, .drawio), a stylesheet, a data file, an AGENTS.md. Give the content as exactly one of content (UTF-8 text), sourcePath (a file on disk, for images or diagrams you just generated) or contentBase64 (other binary). Every other file in the archive is kept byte-for-byte. Replacing an existing file requires expectedEntryHash (from mdz_read_text, mdz_read_image or mdz_list_entries with includeHashes) and fails with CONTENT_CONFLICT if the file changed since; omit it to add a new file, which fails wit…

ParameterTypeDescription
archivePath *stringAbsolute or workspace-relative path to the .mdz file.
entryPath *stringArchive-relative path of the file to add or replace, for example images/chart.png or chapters/02-setup.md. Case-sensitive.
contentstringThe file as UTF-8 text (Markdown, SVG, .drawio, CSS, JSON, CSV, ...). Markdown line endings are normalized to LF.
contentBase64stringThe file as base64, for binary content passed inline.
expectedEntryHashstringRequired to replace an existing file: its entryHash from your last read. Omit when adding a new file.
sourcePathstringAbsolute or workspace-relative path of a file on disk to copy into the archive, for example an image you generated.

mdz_remove_entry

Remove a file from an .mdz archive, keeping every other file byte-for-byte. Requires expectedEntryHash (from mdz_read_text, mdz_read_image or mdz_list_entries with includeHashes) and fails with CONTENT_CONFLICT if the file changed since. manifest.json and the archive's entry point can't be removed. Returns the changed paths and post-write validation; check unresolvedReferences for links or images that pointed at the removed file.

ParameterTypeDescription
archivePath *stringAbsolute or workspace-relative path to the .mdz file.
entryPath *stringArchive-relative path of the file to remove. Case-sensitive.
expectedEntryHash *stringThe file's entryHash from your last read.

mdz_list_entries

List all non-directory entries inside an .mdz archive. Advanced inspection tool; start with mdz_review_document for default agent workflows. Set includeHashes to get each entry's entryHash, needed to replace or remove it with mdz_write_entry or mdz_remove_entry.

ParameterTypeDescription
archivePath *stringAbsolute or workspace-relative path to the .mdz file.
includeHashesbooleanAlso return each entry's size and entryHash. Reads every entry, so it's slower on large archives. Defaults to false.

mdz_search_text

Search UTF-8 text entries inside an .mdz archive. Use this directly for grep/find/search requests instead of asking whether to inspect the archive another way.

ParameterTypeDescription
archivePath *stringAbsolute or workspace-relative path to the .mdz file.
query *stringText or regular expression to search for inside archive text entries.
caseSensitivebooleanWhether matching is case-sensitive. Defaults to false.
maxResultsnumberMaximum number of matching lines to return. Defaults to 100 and is clamped to 1..1000.
regexbooleanInterpret query as a JavaScript regular expression. Defaults to false.

mdz_read_text

Read a UTF-8 text entry from an .mdz archive by archive-relative path. Advanced inspection tool; prefer mdz_review_document for first read.

ParameterTypeDescription
archivePath *stringAbsolute or workspace-relative path to the .mdz file.
entryPath *stringArchive-relative path (for example: manifest.json or index.md).

mdz_read_image

Read an image entry from an .mdz archive and return it directly as image content (no extraction required). PNG, JPEG, GIF and WebP come back as the image; SVG as its source text plus a PNG rendering; AVIF and ICO as a size note only. Advanced inspection tool.

ParameterTypeDescription
archivePath *stringAbsolute or workspace-relative path to the .mdz file.
entryPath *stringArchive-relative image path (for example: images/diagram.png).

mdz_read_markdown_embedded_images

Read markdown from an .mdz entry and embed archive images as data URLs directly in the markdown text. Prefer mdz_review_document for general review tasks.

ParameterTypeDescription
archivePath *stringAbsolute or workspace-relative path to the .mdz file.
entryPathstringOptional archive-relative markdown path. When omitted, the server resolves manifest-first canonical markdown.