Skip to main content
Glama

Unsliced

English · 中文

English

Unsliced is a local MCP tool that turns Markdown or HTML into searchable, selectable PDFs. It compares page breaks across the whole document to balance page count, blank space, and table splits. It keeps diagrams together and splits long tables between complete rows, repeating the header on continuation pages.

Install

Install Node.js 22 or newer, then add a local stdio MCP server with this launch command:

npx -y unsliced-pdf-mcp

Version 0.1.1 is published on npm. Any MCP client that can launch a local stdio server can use it. No HTTP URL or separate installation from source is required.

OpenCode V2 — merge into opencode.jsonc. Official documentation.

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": { "servers": { "unsliced": { "type": "local", "command": ["npx", "-y", "unsliced-pdf-mcp"] } } }
}

Claude Desktop — merge into claude_desktop_config.json via Settings → Developer → Edit Config, then quit and reopen Claude Desktop. Official documentation.

{
  "mcpServers": { "unsliced": { "command": "npx", "args": ["-y", "unsliced-pdf-mcp"] } }
}

Cursor — merge into .cursor/mcp.json (project) or ~/.cursor/mcp.json (global). Official documentation.

{
  "mcpServers": { "unsliced": { "type": "stdio", "command": "npx", "args": ["-y", "unsliced-pdf-mcp"] } }
}

Ask your assistant to use create_pdf and return the saved path. By default, PDF files go to Documents/Unsliced. Source archiving is off by default; set UNSLICED_KEEP_SOURCE=1 to save the unchanged source and its generation record under sources/ in the PDF output directory. Setup and troubleshooting.

Compare pagination

The same fictional Northline quarterly report, rendered on A4 with 15 mm margins. The red boxes show where fixed-height jsPDF slices cut through the 3 May table row between pages 1 and 2. Unsliced keeps the entire row on page 2. This baseline uses raster slices; it does not represent every jsPDF export mode.

jsPDF fixed slices

Unsliced

Red boxes show the two halves of the 3 May row on separate pages

The entire 3 May row is visible on page 2

4 pages · 3 cut table rows

4 pages · 0 cut blocks

In this jsPDF fixed-slice export, the pages are images, so the text cannot be searched or copied. Unsliced produces real, searchable and copyable text.

Pagination rules · More comparisons · Local preference review

Credits and development

Unsliced is based on BreakFlow and retains its MIT license and copyright notice. The bundled Unsliced Sans SC font is based on Noto Sans SC and is licensed under SIL Open Font License 1.1. BreakFlow · MIT license · Font license

Unsliced’s approach belongs to the family of globally optimized pagination methods and draws on the work of Donald Knuth and Michael Plass (global line breaking, 1981); Michael Plass (doctoral dissertation on optimal pagination, 1981); Frank Mittelbach (global pagination framework, 2016); and Brüggemann-Klein et al. (pagination of complex documents, 2003).

Install dependencies with pnpm install --frozen-lockfile and python -m pip install -r scripts/requirements.txt. Use UNSLICED_PYTHON to select a Python environment if needed. Run pnpm exec playwright install chromium, pnpm test, pnpm test:mcp, and pnpm acceptance.

Related MCP server: md-mermaid-to-pdf-mcp

中文

Unsliced(分寸)是本地 MCP 工具,把 Markdown 或 HTML 排成文字可搜索、可复制的 PDF。它比较整份文档的分页位置,在页数、留白和拆表之间取舍。流程图可以保持完整;长表格在完整数据行之间分页,并在续页重复表头。

安装

安装 Node.js 22 或更新版本,添加本地 STDIO MCP 服务,启动命令为:

npx -y unsliced-pdf-mcp

0.1.1 版已在 npm 发布。任何能启动本地 STDIO 服务的 MCP 客户端都可以使用,不需要 HTTP 地址,也不需要下载源码安装。

OpenCode V2:合并到 opencode.jsonc。官方说明。

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": { "servers": { "unsliced": { "type": "local", "command": ["npx", "-y", "unsliced-pdf-mcp"] } } }
}

Claude Desktop:通过 Settings → Developer → Edit Config 合并到 claude_desktop_config.json,然后完全退出并重新打开应用。官方说明。

{
  "mcpServers": { "unsliced": { "command": "npx", "args": ["-y", "unsliced-pdf-mcp"] } }
}

Cursor:合并到项目 .cursor/mcp.json 或全局 ~/.cursor/mcp.json。官方说明。

{
  "mcpServers": { "unsliced": { "type": "stdio", "command": "npx", "args": ["-y", "unsliced-pdf-mcp"] } }
}

请助手调用 create_pdf 并返回保存路径。PDF 默认保存在 Documents/Unsliced(文稿 → Unsliced)。默认不保存原稿;设置 UNSLICED_KEEP_SOURCE=1 后,会在 PDF 输出目录的 sources/ 保存原稿和生成记录。安装详情与问题排查。

分页对比

同一份虚构的 Northline 季度运营报告,使用 A4 和 15 毫米页边距。红框放大了第 1、2 页交界处被切成两半的「3 May」表格行;Unsliced 把整行保留在第 2 页。这里的 jsPDF 对照版按固定高度将截图切片,不代表 jsPDF 的所有导出方式。

jsPDF 固定切片

Unsliced

红框标出分在两页的 3 May 表格行

3 May 表格行完整保留在第 2 页

4 页 · 切开 3 行表格

4 页 · 切开 0 块

这份 jsPDF 固定切片版的页面是图片,文字不能搜索或复制;Unsliced 生成的是真实文字,可以搜索和复制。

分页规则 · 更多对比 · 本地偏好评审

致谢与开发

Unsliced 基于 BreakFlow,保留其 MIT 许可证和版权声明。随包分发的 Unsliced Sans SC 源自 Noto Sans SC,采用 SIL Open Font License 1.1。BreakFlow · MIT 许可证 · 字体许可证

Unsliced 的分页方法属于「全局最优分页」这一类,受益于 Donald Knuth 与 Michael Plass 的全局断行算法(1981)、Michael Plass 的最优分页博士论文(1981)、Frank Mittelbach 的全局分页框架(2016),以及 Brüggemann-Klein 等人对复杂文档分页的研究(2003)。

使用 pnpm install --frozen-lockfile 和 python -m pip install -r scripts/requirements.txt 安装依赖。需要时用 UNSLICED_PYTHON 指定 Python 环境。运行 pnpm exec playwright install chromium、pnpm test、pnpm test:mcp 和 pnpm acceptance。

Available Tools

1 tool
create_pdf用 Unsliced 生成 PDFA

当用户需要可搜索、可复制、自动分页的 PDF 时使用。必须把完整原稿传入 markdown 或 html 的其中一个字段,不要缩写、删减或改写,再给出 filename。默认 A4。普通报告用 Markdown。涉及流程图、卡片、复杂版面或内联 SVG 时,请提交包含样式和图形的完整 HTML。图片请用内嵌 data URL。HTML 可用 data-unsliced-root 指定排版容器。返回本机文件路径和中文排版体检。请直接调用本工具,避免自行写 jsPDF 或 html2canvas。

Inputs: filename (required), html, markdown, paper_size.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.4/5.0

    Scored across 1 tool

    Disambiguation5/5

    There is only one tool, so there is no possibility of selection confusion. Its purpose (produce a searchable, paginated PDF from Markdown or HTML) is stated explicitly and unambiguously.

    Naming Consistency5/5

    create_pdf follows a clean verb_noun snake_case convention. With a single tool there is no cross-tool inconsistency to penalize.

    Tool Count3/5

    The surface is extremely thin: one tool must carry the entire server's purpose. It is defensible for a narrowly scoped PDF-generation service, but leaves no room for companion operations such as validation, templating, or file retrieval.

    Completeness4/5

    Creation is the core operation and the description covers input formats, defaults, images, and layout containers, plus a returned file path. Minor gaps remain: no way to list, inspect, or delete previously generated files, and no explicit preview/validation step.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Provides tools for converting Markdown content and files into professional PDF documents with full support for Mermaid diagrams and LaTeX rendering. It allows for high-quality output customization, including paper size, table of contents, and syntax highlighting styles.
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      Converts Markdown files and raw content into professionally styled PDFs with full support for Mermaid diagrams and syntax highlighting. It offers customizable page formats, margins, and modern typography for high-quality document generation.
      11
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Turn markdown into designed PDFs with cover page, table of contents, and code blocks that hold across pages. One command from Claude Desktop, Claude Code, Cursor, Cline, Zed, or any MCP-capable client.
      2
      98 npm
      2
      MIT