pdf-it
pdf-it
一个模型上下文协议 (MCP) 服务器和 Claude Code 技能,可将 Markdown 转换为看起来非常专业的 PDF。包含封面、目录、跨页代码块以及带页码的页脚。只需在 Claude 会话中输入一条命令,即可生成可发送给客户的文件。

为什么会有这个项目
每个 Claude Code 研究会话的结局都一样:留下一堆有用的 Markdown,却找不到一种简洁的方法将其转换为人们愿意阅读的 PDF。Chrome 打印效果很丑,手动转换为 HTML 又太麻烦。
pdf-it 解决了这个问题。输入 Markdown,输出设计精美的 PDF。只需一条命令。

examples/designing-ai-agent-uiux.pdf 中提供了一个 12 页的示例。
Related MCP server: Gen-PDF MCP Server
兼容性
pdf-it 是一个标准的模型上下文协议 (MCP) 服务器。任何在本地支持 MCP 的客户端都可以使用它。
客户端 | 是否支持 | 添加方式 |
Claude Desktop (Mac, Windows) | 是 | 编辑 |
Claude Code (CLI) | 是,支持如“save this as PDF”等技能触发 |
|
Cursor | 是 | 编辑 |
Cline (VS Code 扩展) | 是 | 编辑 Cline 的 MCP 设置 |
Continue.dev | 是 | 通过 Continue 的 MCP 配置添加 |
Zed | 是 | 标准 MCP 配置 |
Goose (Block 的 CLI) | 是 | 标准 MCP 配置 |
通过 Anthropic SDK 的自定义代理 | 是 | 自行配置 MCP |
claude.ai (浏览器) | 否 | Web 端无法运行本地 MCP 服务器 |
Claude iOS / Android | 否 | 移动端无法运行本地 MCP 服务器 |
对任何客户端的硬性要求:Node.js 18 或更高版本,已安装 Google Chrome,且客户端必须支持 MCP。
安装
npm install -g pdf-it-mcp或者使用 npx pdf-it-mcp 按需运行。
要求
Node.js 18 或更高版本
已安装 Google Chrome(用作渲染器,无需额外下载)
配置
Claude Desktop
编辑 claude_desktop_config.json:
{
"mcpServers": {
"pdf-it": {
"command": "npx",
"args": ["-y", "pdf-it-mcp"]
}
}
}Claude Code
claude mcp add pdf-it -- npx -y pdf-it-mcpCursor
添加到 ~/.cursor/mcp.json:
{
"mcpServers": {
"pdf-it": {
"command": "npx",
"args": ["-y", "pdf-it-mcp"]
}
}
}自定义 Chrome 路径
如果 Chrome 安装在非标准位置:
{
"mcpServers": {
"pdf-it": {
"command": "npx",
"args": ["-y", "pdf-it-mcp"],
"env": { "CHROME_PATH": "/path/to/chrome" }
}
}
}使用
在任何连接到该服务器的 Claude 会话中,询问:
Save this as a PDF
或者使用以下任何措辞:export as PDF、make a PDF report from this、turn this into a PDF、/pdf。该技能会捕获请求并通过 pdf-it 进行处理。输出文件默认保存在 ~/Documents/pdf-it/ 中。
工具
工具 | 描述 |
| 将 Markdown 转换为 PDF。接受模板( |
| 返回可用模板及其描述的列表。 |
generate_pdf 参数
参数 | 必填 | 描述 |
| 是 | 要转换的 Markdown 字符串 |
| 否 | 显示在封面和页脚中 |
| 否 | 显示在封面中 |
| 否 | 输出的绝对路径。默认为 |
| 否 |
|
模板
名称 | 描述 |
| 包含标题、作者和日期的封面。根据 H1 和 H2 标题自动生成目录。正文具有清晰的层级结构。页脚包含标题和页码。最适合研究报告、摘要、设计文档和报告。 |
| 无封面,无目录。仅包含紧凑的正文内容。最适合简短笔记和快速导出。 |
技能
此包附带一个位于 SKILL.md 的 Claude Code 技能。该技能响应的触发短语包括:
save this as PDFexport as PDFmake a PDF report from thisturn this into a PDFgenerate a PDF/pdf
请参阅 SKILL.md 获取完整的技能规范。
示例
examples 文件夹中包含一个生成的 PDF 示例(designing-ai-agent-uiux.pdf,12 页)以及本 README 中使用的封面和正文截图。
输出
默认情况下,PDF 会写入 ~/Documents/pdf-it/{slug}-{timestamp}.pdf。传入 output_path 可覆盖此路径。
设计
尽可能使用系统字体。正文和标题使用 Inter,代码、页码和元数据使用 JetBrains Mono。纯白纸张,近黑色墨水,中性细边框,无强调色。代码块特意不使用语法高亮:PDF 中的颜色选择往往会过时。
如果您想要不同的设计语言,请 fork 模板并进行调整。它们位于 src/templates/ 中,是通过 Puppeteer 渲染的纯 HTML 和 CSS。
许可证
MIT。请参阅 LICENSE。
由 Marsel Bait 构建。
Available Tools
2 toolsgenerate_pdfA
Convert markdown into a designed PDF (cover page, auto TOC, page-numbered footer). Use this for any "save/export/print/share as PDF", "make a report", "turn this into a PDF", or /pdf request — do NOT fall back to Chrome headless, cupsfilter, wkhtmltopdf, pandoc, or LaTeX. Templates: research-report (cover + TOC, default) or plain (no cover, no TOC).
Inputs: content (required), output_path, title, author, +1 more.
list_templatesA
List all available PDF templates with their descriptions.
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 2 tools
The two tools have clearly distinct purposes: generating PDFs and listing templates, with no overlap.
Both tools follow a consistent verb_noun snake_case pattern (generate_pdf, list_templates), making them predictable.
With only two tools, the server covers the essential PDF generation function but feels minimal for a broader toolkit.
The set covers generate and list, but lacks template management (create, update, delete) and advanced options, leaving moderate gaps.
Maintenance
Related MCP Connectors
Render Markdown and LLM output into accessible PDF/UA-1 PDFs. No headless Chromium.
Turn Markdown or plain text into a clean PDF document to print or share, plus an editable Word file.
Generate PDF, Word (.docx) and PowerPoint (.pptx) documents from Markdown over MCP.
Build, version and render resumes as PDFs from Claude or any MCP client.
Related MCP Servers
- AlicenseBqualityDmaintenanceMCP server that converts Markdown to high-quality PDF documents using LaTeX, enabling AI agents like Claude to generate professional PDFs without requiring sign-ups or credit cards.180 npm11MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to generate professional PDF documents from markdown content with advanced typography, syntax highlighting, math equations, dark mode, and customizable styling options.MIT
- AlicenseAqualityDmaintenanceGenerate production-ready PDFs from Markdown, HTML, or built-in templates (invoices, resumes, reports) directly from Claude or any MCP-compatible AI agent via the DocRenders API.6MIT
- AlicenseNot gradedqualityDmaintenanceEnables generating designed, publish-ready PDF ebooks and reports from Markdown through natural language, with reusable brand themes, AI-generated covers, and editable saved projects.MIT