多图转 PDF MCP
一个专门用于将多张图片合并为 PDF 文档的模型上下文协议(MCP)服务器。
功能特性
- PDF 文档生成:将多张图片合并为单个 PDF 文件
- 灵活的页面设置:
- 多种页面尺寸(A3/A4/A5, Letter, 16:9 等)
- DPI 设置(72-1200)
- 自定义背景色(20+ 预设颜色)
- 图片排序选项:
- 字母数字顺序
- 创建时间
- 修改时间
- 布局控制:
- 图片自动适配页面
- 居中显示
- 保持宽高比
- 智能命名:自动文件命名,防止重复
安装
从 PyPI 安装
pip install images-to-pdf-mcp
开发安装
git clone https://github.com/mcpcn/images-to-pdf-mcp
cd images-to-pdf-mcp
pip install -e .
配置
MCP 配置示例
{
"mcpServers": {
"Images to PDF MCP": {
"command": "uvx",
"args": ["images-to-pdf-mcp"],
"env": {}
}
}
}
可用工具
convert_images_to_pdf
将多张图片合并为 PDF 文档。
参数:
input_files(list, 必需): 图片文件路径列表output_dir(str, 可选): 输出目录路径,默认为第一个文件所在目录file_name(str, 可选): 自定义文件名,默认自动命名sort_order(str, 可选): 排序方式,可选 'alphabetical'(字母)、'creation_time'(创建时间)、'modification_time'(修改时间),默认 'alphabetical'page_size(str, 可选): 页面尺寸,支持 A3/A4/A5, B3/B4/B5, Letter/Legal/Executive/Tabloid, 16:9/4:3/Square,默认 'A4'dpi(int, 可选): PDF 分辨率,范围 72-1200,默认 300fit_to_page(bool, 可选): 是否缩放图片以适应页面,默认 Truecenter_image(bool, 可选): 是否居中显示图片,默认 Truebackground_color(str, 可选): 背景色,支持 white/gray/black 等 20+ 颜色,默认 'white'
支持的格式
输入格式
- JPEG (.jpg, .jpeg)
- PNG (.png)
- BMP (.bmp)
- TIFF (.tif, .tiff)
- WEBP (.webp)
- HEIC/HEIF (.heic, .heif)
- AVIF (.avif)
输出格式
- PDF (.pdf)
使用方法
命令行
images-to-pdf-mcp
作为 MCP 服务器
服务器通过标准输入输出运行,可以与任何 MCP 兼容的客户端集成。
系统要求
- Python 3.10+
- Pillow (PIL) 用于图片处理
- PyMuPDF 用于 PDF 生成
许可证
本项目采用 MIT 许可证 - 详情请参阅 LICENSE 文件。
Metadata
Release files for mcpcn-images-to-pdf-mcp 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mcpcn_images_to_pdf_mcp-0.1.0.tar.gz | 8.8 kB | Without provenance | Details for mcpcn_images_to_pdf_mcp-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mcpcn_images_to_pdf_mcp-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for mcpcn_images_to_pdf_mcp-0.1.0-py3-none-any.whl |
Total release size: 19.7 kB
Release files / mcpcn_images_to_pdf_mcp-0.1.0.tar.gz
| Download URL | mcpcn_images_to_pdf_mcp-0.1.0.tar.gz |
|---|---|
| Size | 8.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
20b87f0a3dfd54799d6ea29183755e168d379a693e864ddae547e06c435461a1
|
|
BLAKE2b-256 checksum How to use checksums |
42b9de8dc2ecf0c231188513c9d837b4029d2206d73dcb3da8a675de8a13d4da
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.11
|
Release files / mcpcn_images_to_pdf_mcp-0.1.0-py3-none-any.whl
| Download URL | mcpcn_images_to_pdf_mcp-0.1.0-py3-none-any.whl |
|---|---|
| Size | 10.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
80bd8e9a5b32145e3079095b49d455f367a1e9aa1ea9605ff5dbaacd418a3bbe
|
|
BLAKE2b-256 checksum How to use checksums |
06fb6f09bfec5f2a6eb804b903b1180dcbd453dcebcd827d9ac7b210e17676fd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.11
|
Security for mcpcn-images-to-pdf-mcp 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.