anymd
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@anymd@anymd convert this PDF to markdown"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
anymd
Convert any document to LLM-friendly Markdown.
A CLI, Python library, and MCP server built for AI agents.
$ anymd convert report.docx
# Quarterly Report
...Why
Agents drown in formats. anymd turns every real-world document type into clean,
structured Markdown with predictable conventions, so an LLM can read it without
format-specific prompting:
every table has a header row and
---separator;|escaped, cell newlines as<br>truncation is always stated in the output, never silent
structure markers (
<!-- page 3 of 12 -->) are HTML comments — greppable, invisible when renderedexit codes, stderr/stdout separation, and an NDJSON manifest designed for programmatic consumption
robust to mislabelled files: a
.docxrenamed.docis still identified by content sniffingencoding-safe out of the box: UTF-8 / UTF-16 BOM / GB18030 / Big5 / HTML
<meta charset>detection, built for Chinese-Windows realities
Related MCP server: Markitdown MCP Server
Features
24 converters covering Office, PDF, e-mail, e-books, images, archives, data files and code
Optional extras: missing dependencies fail with the exact
pip install "anymd[x]"command, never a rawImportErrorOCR built in (optional extra): RapidOCR transcribes images and scanned PDF pages, models ship in-wheel — nothing downloaded at runtime
Safe with hostile input: zip/tar decompression-bomb caps, SSRF guard on URLs, size caps everywhere
Agent-first CLI:
--jsonNDJSON manifest, strict stdout/stderr separation, meaningful exit codesThree ways in: CLI, Python API, and an MCP server
Installation
pip install anymd # core: text, code, csv/json/yaml/xml, html, eml, epub, markdown
pip install "anymd[all]" # everything below, one shotextra | adds | formats unlocked |
| pymupdf, pymupdf4llm |
|
| python-docx, openpyxl, xlrd, python-pptx, odfpy, striprtf |
|
| rapidocr[onnxruntime], pillow | text recognition in images + scanned PDF pages |
| extract-msg |
|
| httpx | converting |
| mcp | the |
Requires Python ≥ 3.11. Windows, macOS and Linux are all supported — the CLI is Windows-first (UTF-8 output on cp936 consoles).
Usage
CLI
anymd convert <INPUT...> [-o PATH] [options]
INPUT file, glob, directory, http(s) URL, or - (stdin)anymd convert report.pdf # → stdout
anymd convert report.docx -o out.md # → file
anymd convert ./docs -o md/ # → directory tree → .md files
anymd convert "*.xlsx" --json # → NDJSON manifest
anymd convert scan.pdf --image-mode ocr # OCR scanned pages (needs [ocr])
anymd convert data.csv --max-rows 50 # cap table rows
anymd convert - --stdin-filename msg.eml # stdin with a filename hint
anymd convert report.pdf --page-range 3-7 # partial PDF
anymd --list-formats # everything supported + required extrasAgent contract
stdout carries only the product. Progress, warnings and diagnostics go to stderr.
Exit codes:
0all converted ·1partial failure ·2usage error ·3zero output (missing/unsupported inputs). A file you name explicitly that has no converter is an error (exit 1); the same file swept up by a glob or directory walk is skipped (exit 0).--strictpromotes those skips to errors too.--jsonemits one JSON object per line, each with atypefield so an agent can stream-parse:
{"type":"item","input":"a.docx","output":"a.md","status":"ok","converter":"docx","duration_ms":42,"bytes_in":12345,"bytes_out":678,"sha256_in":"…","warnings":[]}
{"type":"item","input":"legacy.doc","output":null,"status":"error","error":{"code":"UnsupportedFormatError","message":"legacy binary Office formats (.doc/.ppt) require LibreOffice…","hint":"run anymd --list-formats to see supported types"}}
{"type":"summary","total":2,"ok":1,"error":1,"skipped":0,"bytes_in":9000,"bytes_out":678,"duration_ms":120,"exit_code":1}Python API
from anymd import convert, convert_result, list_formats, ConvertContext
md = convert("report.docx")
result = convert_result("report.xlsx") # .metadata (sheets, pages, …) + .warnings
md = convert("https://example.com/post", # URL (needs anymd[web])
ctx=ConvertContext(frontmatter=True))MCP server
pip install "anymd[mcp]"
anymd-mcp # stdio transportTwo tools for any MCP client:
convert_document(source, max_rows, image_mode, frontmatter, max_chars, include_metadata, allow_remote)— one document → Markdown. Missing extras return an actionableERROR[...]string instead of a protocol error; output is truncated atmax_charswith a visible note.list_formats()— every supported extension and its extra.
Claude Desktop / Claude Code registration:
{"mcpServers": {"anymd": {"command": "anymd-mcp"}}}Supported formats
family | formats |
Office |
|
| |
Web |
|
E-books |
|
Data |
|
| |
Notebooks |
|
Images |
|
Archives |
|
Text/code |
|
No extension | content sniffing: PDF/zip-family/OLE/RTF/HTML/images/plain text |
Not supported (by design): legacy binary .doc / .ppt have no pip-installable reader —
anymd fails with a precise message telling you to re-save as .docx/.pptx.
(.xls is supported via xlrd.)
Notes
License: anymd is MIT. Two optional extras carry copyleft licenses that activate only for their own code paths:
pymupdf(AGPL-3.0, thepdfextra) andstriprtf(GPL-3.0, inside theofficeextra). They are separate packages installed at runtime — if you deploy anymd as a hosted service, review your obligations (a pdfminer.six-based fallback can replace thepdfextra).OCR engine: RapidOCR bundles its models in-wheel; nothing is downloaded at runtime. If model files fail to load in a restricted environment, OCR degrades to a warning, never an error.
Windows-first: the CLI reconfigures stdout to UTF-8 so piping Chinese text through cp936 consoles never raises
UnicodeEncodeError.
Development
git clone https://github.com/Ljf857/anymd.git
cd anymd
pip install -e ".[all,dev]"
pytest # slow OCR tests excluded by default
pytest -m slow # OCR end-to-end
ruff check src tests
mypy src/anymdContributions are welcome — open an issue or pull request.
License
MIT © 2026 Ljf857
Optional extras keep their own licenses (see Notes).
This server cannot be deployed
Maintenance
Related MCP Connectors
Document-to-Markdown MCP server — convert PDF, Office and HTML into LLM-ready Markdown.
Convert files, URLs, and documents to clean, AI-ready Markdown via MCP.
Convert PDF, DOCX, HTML, and URLs to clean, LLM-ready markdown with tables preserved
Parse PDF/Word/PPT/HTML to Markdown; tables as JSON, image extraction, RAG chunking, page ranges.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceConverts PDF, Word, and Excel documents to Markdown with image extraction and header/footer removal via MCP or REST API.50MIT
- FlicenseNot gradedqualityDmaintenanceConverts documents (PDF, DOCX, images, etc.) to Markdown using Microsoft's Markitdown library, with no local setup required. Integrates with AI agents via MCP for seamless document conversion.1-
- AlicenseNot gradedqualityAmaintenanceConverts documents and images to Markdown using Mistral AI's OCR, enabling AI-powered document processing via MCP-compatible clients like Claude Desktop.33 npm2MIT
- FlicenseAqualityCmaintenanceConverts files (PDF, DOCX, PPTX, XLSX, images via OCR) and URLs to Markdown, enabling AI clients to read them via a single MCP tool.1-