Markdownpublishingmcp — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited Markdownpublishingmcp (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
md-publishing-mcp is an MCP server that converts Markdown into publication-quality A4 PDF documents through a 4-layer typesetting pipeline.
Most Markdown-to-PDF tools are simple converters. They pipe Markdown through Pandoc or an HTML renderer and call it done. Tables break across pages awkwardly. Code blocks overflow margins. Widow and orphan lines go unchecked. Headers and footers are an afterthought.
This project takes a different approach. It treats document generation as a typesetting problem, not a conversion problem. Markdown is parsed into an abstract syntax tree, normalized into an intermediate representation (IR), composed through typographic rules, and finally compiled into a PDF using the Typst engine. The result is a professional document with proper page control, consistent spacing, and reliable layout.
javascript:, file:, data:), input size limits, and schema validation with Pydantic.Input Markdown
|
v
[Layer 1] Markdown Parser (markdown-it-py)
| DocumentIR
v
[Layer 2] IR Builder + Composition Engine
| ComposedDocument
v
[Layer 3] Typst Generator + Template Manager
| .typ source
v
[Layer 4] PDF Renderer (typst CLI)
| PDF bytes + cache
v
Output PDFLayer 1: Markdown Parser. Uses markdown-it-py to parse Markdown into a structured IR (DocumentIR). Handles all Markdown syntax variants (CommonMark + GFM tables).
Layer 2: IR Builder & Composition Engine. Normalizes the section tree (depth pruning, continuity repair) applies typographic rules: orphan/widow prevention, keep-with-next heading policies, page-break strategies for tables and code blocks.
Layer 3: Typst Generator + Template Manager. Converts the composed IR into Typst source code. Templates handle page setup (paper size, margins, fonts, headers/footers) with multiple preset styles.
Layer 4: PDF Renderer. Compiles the Typst source into a PDF via the typst CLI. Caches results with TTL-based eviction. Supports per-page preview extraction from cached renders.
# Prerequisites: Python 3.11+, Typst CLI
# Install from source
git clone https://github.com/DCode1119/MarkdownPublishingMCP
cd MarkdownPublishingMCP
python -m venv .venv
pip install -r requirements.txt
# Run the server
python -m md_publishing_mcpThe server exposes two MCP tools:
| Tool | Description | Key Parameters |
|---|---|---|
render | Convert Markdown to PDF | markdown, paper, margin(optional), template(optional) |
preview | Retrieve a cached page preview | render_id, page |
| Variable | Default | Description |
|---|---|---|
MCP_MAX_INPUT_SIZE | 10485760 (10 MB) | Maximum input markdown size in bytes |
MCP_MAX_PAGES | 200 | Maximum allowed pages per render |
MCP_CACHE_TTL | 600 | Cache lifetime in seconds |
MCP_MAX_CACHED | 20 | Maximum cached render results |
MCP_RENDER_TIMEOUT | 120.0 | Typst compile timeout in seconds |
MCP_DEBUG | false | Enable debug logging |
{
"markdown": "# Project Architecture\n\nThis document describes...",
"paper": "a4",
"margin": { "top": 20, "bottom": 20, "left": 25, "right": 25 }
}Response:
{
"pdf": "<base64-encoded PDF bytes>",
"pages": 5,
"render_id": "r1712345678_1",
"warnings": []
}{
"render_id": "r1712345678_1",
"page": 3
}Response:
{
"page": 3,
"total_pages": 5,
"pdf": "<base64-encoded page PDF bytes>",
"warnings": []
}| Component | Technology |
|---|---|
| Language | Python 3.11+ |
| Framework | MCP SDK (official Python) |
| Markdown Parsing | markdown-it-py |
| Typesetting Engine | Typst (CLI) |
| Schema Validation | Pydantic v2 |
All four layers are implemented and integrated. The pipeline has been verified end-to-end up to Typst source generation. PDF rendering requires the typst CLI binary to be installed and available on PATH.
Contributions, ideas, and feedback are welcome. Open an issue or pull request on GitHub.
See Doc/ for detailed specifications and AGENTS.md for development workflow conventions.
MIT. See LICENSE for details.
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.