FileToPDF

dev.filetopdf由 filetopdf.dev 发布官方发布者v0.1.1更新于 Nov 2, 2026

Convert files, HTML, and Markdown to PDF via the FileToPDF API. Bring your own API key.

已验证Streamable HTTP可网页运行文件与存储开发者工具

概览

AI 生成的概览

FileToPDF 通过 FileToPDF API 把文件、HTML 和 Markdown 转成 PDF,并以嵌入资源的形式返回生成的 PDF。

可以做什么
  • 把公开 URL 上的文件转换为 PDF,自动识别 Office 文档、图片、HTML、Markdown 或已有 PDF
  • 用 Chromium 将原始 HTML 字符串渲染为 PDF,可选 CSS 与版式参数
  • 将原始 Markdown 字符串渲染为 PDF,未提供 CSS 时套用默认样式表
  • 检查 API 密钥并查看套餐、剩余转换额度和订阅状态
适用场景
适合需要让助手按需把发票、报告、文档、DOCX/XLSX/PPTX 文件、图片或网页转成 PDF 的场景,来源可以是 URL,也可以是助手生成的 HTML 或 Markdown 文本。
运行要求
需要一个 FileToPDF API 密钥:本地 npm 包通过环境变量 FILETOPDF_API_KEY 提供,托管端点通过 x-api-key 请求头提供。可作为远程 Streamable HTTP 端点使用,也可用 npx 在本地运行(需 Node.js)。需要能访问 FileToPDF API 的网络。
安装前请注意
每次成功转换消耗账户 1 个额度,超出免费额度即产生费用;失败不扣额度。API 密钥属于机密,需写入配置。文件从公开 URL 抓取,内容会发送给第三方 FileToPDF 服务。部分版式选项(横向、纸张尺寸、页边距、缩放、PDF/A、密码)仅限更高套餐。设置 FILETOPDF_OUTPUT_DIR 或 save_path 会把 PDF 写入磁盘。

安装

在 SourceWeft 中

  1. 打开 控制台中的 FileToPDF,将其添加到工作区。
  2. 连接 x-api-key 凭据。它们会被私密存储,绝不会在公开页面上展示。
  3. 为需要使用其工具的对话启用该服务。

Web executable,通过 Streamable HTTP。 远程服务在工作区中配置后即可从网页运行时运行。

交给智能体安装

把这段提示词粘贴到 Claude Code、Codex、Cursor 等智能体,或 SourceWeft 对话中。智能体会读取该服务器的安装指南,先向你展示发布者、端点和登录方式,经你同意后再把它添加到你的客户端。密钥不会写进任何命令。

阅读 https://sourceweft.com/mcp/dev.filetopdf%2Ffiletopdf-mcp/install.md,并按其中说明把这个 MCP 服务器接入我的客户端。修改任何配置之前,先告诉我它的发布者、端点和登录方式,等我确认。不要把 API 密钥写进命令或我会提交的文件;问我密钥应从哪里获取。

查看智能体所依据的安装指南

其他 MCP 客户端

把它添加到你客户端的 mcpServers 配置中。

{
  "mcpServers": {
    "filetopdf": {
      "type": "http",
      "url": "https://api.filetopdf.dev/mcp",
      "headers": {
        "x-api-key": "<YOUR_API_KEY>"
      }
    }
  }
}

README

FileToPDF MCP server

[npm] [smithery badge] [Install MCP Server]

A Model Context Protocol server for FileToPDF. It lets any MCP client — Claude Desktop, Claude Code, Cursor, Cline, VS Code, ChatGPT, n8n, Make, or your own agent — convert files, HTML, and Markdown to PDF through natural language: invoices, reports, documentation, DOCX/XLSX/PPTX, images, web pages, and more.

Bring your own API key — get one free, in one click, at https://filetopdf.dev (10 free conversions, no signup required).

Tools

ToolWhat it does
get_accountCheck the API key and show plan + remaining credits. Free, no credits used.
convert_fileConvert a file from a public URL (DOCX, XLSX, PPTX, images, HTML, MD, PDF…) to PDF.
convert_htmlRender a raw HTML string (with optional CSS + layout options) to a pixel-perfect PDF via Chromium.
convert_markdownRender a raw Markdown string (with optional CSS + layout options) to a clean PDF.

Each convert tool returns a metadata summary and the PDF as an embedded application/pdf resource (base64), so capable clients can save the file. Set the FILETOPDF_OUTPUT_DIR env var, or pass save_path, to also write the PDF to disk.

Layout options (landscape, paperWidth/Height, margins, scale, pdfa, passwords, …) are available on Pro, Scale, and the free trial; on Starter/Basic they return an upgrade error. Each successful conversion costs 1 credit; errors are free.

Quick start (local / stdio)

Cursor — one-click install: Add to Cursor (then replace the placeholder with your key).

Claude Desktop / Cline / any stdio client — add to the MCP config (claude_desktop_config.json, cline_mcp_settings.json, …):

json
{  "mcpServers": {    "filetopdf": {      "command": "npx",      "args": ["-y", "filetopdf-mcp"],      "env": { "FILETOPDF_API_KEY": "sk_live_YOUR_API_KEY" }    }  }}

Claude Code:

bash
claude mcp add filetopdf -e FILETOPDF_API_KEY=sk_live_YOUR_API_KEY -- npx -y filetopdf-mcp

VS Code (.vscode/mcp.json or via MCP: Add Server):

json
{  "servers": {    "filetopdf": {      "type": "stdio",      "command": "npx",      "args": ["-y", "filetopdf-mcp"],      "env": { "FILETOPDF_API_KEY": "sk_live_YOUR_API_KEY" }    }  }}

Hosted / remote (Streamable HTTP) — no install

A hosted endpoint is available at https://api.filetopdf.dev/mcp. Authenticate with your own key via the x-api-key header, an Authorization: Bearer header, or an ?apiKey= query parameter.

json
{  "mcpServers": {    "filetopdf": {      "type": "streamable-http",      "url": "https://api.filetopdf.dev/mcp",      "headers": { "x-api-key": "sk_live_YOUR_API_KEY" }    }  }}

This is also the URL to paste into any platform with an MCP client step — n8n (MCP Client Tool), Make (MCP Client), Zapier (MCP Client beta), Relay.app (Call MCP tool), Flowise, Langflow, Dify, LibreChat, AnythingLLM, or agent frameworks (OpenAI Agents SDK, LangChain, CrewAI, Vercel AI SDK).

To self-host instead:

bash
npm run build && npm run start:http   # listens on $PORT (default 8080) at /mcp

A Dockerfile is included for container hosting (Smithery, Fly, Render, Cloud Run).

Develop & test

bash
npm installnpm run build          # tsc -> dist/npm test               # spawns the built stdio server, runs a live conversion

npm test reads FILETOPDF_API_KEY, or API_KEY= from a gitignored .env.

Links

License

MIT

来源:README.md,提交 1008c3d

工具

4

get_account

Get FileToPDF account status

Check the FileToPDF API key and return the plan, remaining conversion credits, and subscription status. Free — costs no credits. Use this to verify the connection works.

无需输入参数。

convert_file

Convert a file (by URL) to PDF

Convert a file fetched from a public URL into a PDF. Auto-detects the engine from the extension: Office docs (DOCX, XLSX, PPTX, ODT, RTF, TXT, CSV…), images (PNG, JPG, WebP…), HTML, Markdown, or an existing PDF (passthrough). Costs 1 credit on success. Returns the PDF as an embedded resource.

输入参数url必填pdfapdfuapasswordlandscapesave_pathuserPasswordownerPasswordnativePageRanges

convert_html

Convert HTML to PDF

Render a raw HTML string to a PDF using Chromium, with optional CSS and layout options. Costs 1 credit on success. Returns the PDF as an embedded resource.

输入参数csshtml必填pdfapdfuascalelandscapemarginTopsave_pathmarginLeftpaperWidthmarginRightpaperHeight另有 6 个

convert_markdown

Convert Markdown to PDF

Render a raw Markdown string to a PDF, with optional CSS and layout options. A sensible default stylesheet is applied when no CSS is given. Costs 1 credit on success. Returns the PDF as an embedded resource.

输入参数csspdfapdfuascalemarkdown必填landscapemarginTopsave_pathmarginLeftpaperWidthmarginRightpaperHeight另有 6 个

版本历史

1
  1. v0.1.1最新Sep 16, 2026

评分

已满足适用检查项的 100%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通必需25 分
  • 已声明认证方式必需10 分
  • 已列出工具必需15 分
  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分