PDF表单自动填充工具

FormFill MCP是一款通过AI代理自动填充任何PDF表单的工具,适用于税务、人力资源、法律文件等多种场景。

  • by knportal
  • Python
  • 本地部署
  • 3 星标
  • 更新于
在 GitHub 查看 knportal/formfill-mcp

使用说明

FormFill MCP

Fill any PDF form from your AI agent — in a single tool call.

Tax forms · HR paperwork · Legal documents · Lease agreements · Insurance claims

If it has fillable fields, FormFill can fill it.

获取API密钥 · Smithery的观点 ·建造于 完整 AI

上市时间: 史密瑟里 · 格拉玛


运作原理

 ┌─────────────────┐        ┌─────────────────┐        ┌─────────────────┐
 │  1. Inspect     │        │  2. Fill         │        │  3. Done        │
 │                 │   →    │                 │   →    │                 │
 │  list_form_     │        │  fill_form       │        │  Filled PDF     │
 │  fields         │        │                 │        │  saved to disk  │
 │                 │        │                 │        │                 │
 │  Returns every  │        │  Writes values, │        │  Open in        │
 │  field name,    │        │  saves output   │        │  Preview or     │
 │  type & value   │        │  file           │        │  send anywhere  │
 └─────────────────┘        └─────────────────┘        └─────────────────┘

大多数人工智能工作流程在最后一英里崩溃:代理 理解 形式,但不能 写信给它.FormFill通过三个专注的工具填补了这一空白。


工具

工具 说明 何时使用
list_form_fields 返回每个可填写的字段——名称、类型和当前值 第一步:发现表单中的内容
fill_form 用提供的字段值填写PDF并保存结果 标准表格(1-5页)
fill_form_multipage 与 fill_form,对于大型文档,逐页处理 复杂的多页表单(6+页)

使用

任何MCP兼容主机:

  • 克劳德桌面版 --添加到 claude_desktop_config.json
  • 光标 --MCP服务器配置
  • 克莱恩 --相同的配置模式
  • 继续 --相同的配置模式
  • 支持模型上下文协议的任何代理

支持的表单类型

类别 示例
税务 W-9、W-4、1040、附表C、州表格
人力资源 I-9、入职信息包、福利登记、PTO
法律 保密协议、租赁协议、合同、披露
保险 索赔表、注册申请
房地产 购买协议、租赁申请、披露
教育 入学、经济援助、成绩单

定价

级别 价格 每月填充
自由 0美元 50次填充
专业版 9.99美元/月 无限制

获取API密钥: 豁免申请


快速开始

1.获取API密钥

注册地址: 豁免申请 --免费套餐立即可用。

2.连接到克劳德桌面

编辑 ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "formfill": {
      "command": "/absolute/path/to/formfill-mcp/venv/bin/python",
      "args": ["/absolute/path/to/formfill-mcp/server.py", "--stdio"]
    }
  }
}

用实际安装位置替换路径。完全退出并重新打开Claude Desktop(Cmd+Q-仅仅关闭窗口是不够的)。你会看到🔨 工具图标——FormFill已连接。

远程HTTP端点 (游标、Cline、任何HTTP MCP客户端):

https://formfill.plenitudo.ai/mcp

3.填写您的第一张表格

List the fillable fields in /Users/me/Desktop/w9.pdf using API key ff_free_abc123
Fill the form at /Users/me/Desktop/w9.pdf with:
  name: Jane Smith
  TIN: 12-3456789
  address: 123 Main St, Austin TX 78701
Save to /Users/me/Desktop/w9_filled.pdf
API key: ff_free_abc123

示例提示

W-9(税):

Fill the W-9 at ~/Desktop/fw9.pdf with my name "John Smith", SSN "123-45-6789",
address "456 Oak Ave, Boston MA 02101". Business type: Individual/sole proprietor.
Save to ~/Desktop/fw9_filled.pdf. API key: ff_free_abc123

租赁申请:

Fill the rental application at ~/Desktop/rental_app.pdf with these values:
[paste field values]. Save to ~/Desktop/rental_filled.pdf. API key: ff_free_abc123

多页合同:

Fill the 8-page NDA at ~/Desktop/nda.pdf. My name: Jane Smith, Company: Acme Corp,
Date: March 28 2026. Use fill_form_multipage. API key: ff_free_abc123

响应格式

成功:

{
  "ok": true,
  "output_path": "/Users/me/forms/w9_filled.pdf",
  "fields_filled": 12,
  "invalid_fields": []
}

错误:

{"ok": false, "error": "Invalid API key"}
{"ok": false, "error": "Usage limit reached. Upgrade at https://formfill.plenitudo.ai"}
{"ok": false, "error": "File not found: /Users/me/missing.pdf"}

自我寄宿

git clone https://github.com/knportal/formfill-mcp.git
cd formfill-mcp

python -m venv venv
source venv/bin/activate
pip install -r requirements.txt

cp .env.example .env
python manage_keys.py create --tier free
python server.py
# → MCP server running on http://localhost:8000

对于远程代理访问,请部署附带的Cloudflare Worker(worker.js).


建筑

server.py          — MCP server (3 tools)
auth.py            — API key validation + usage tracking (SQLite)
stripe_webhook.py  — Stripe subscription webhook handler
worker.js          — Cloudflare Worker (remote proxy)
manage_keys.py     — Key management CLI
data/keys.db       — API key store
data/usage.db      — Monthly usage counters

故障排除

值填写错误的字段 总是打电话 list_form_fields 第一。它返回每个字段的 position (第页上的x、y)。使用这些坐标(而不是猜测的名称)来标识字段。更高 y =页面上方(PDF坐标自下而上)。这对于使用混合XFA/AcroForm格式的IRS/政府PDF最为重要。

“未找到可填写的字段” PDF要么是平面/扫描的(没有AcroForm层),要么是仅XFA(旧的Adobe LiveCycle格式),要么有密码保护。回应包括 pdf_type 告诉你是哪一个。FormFill需要交互式AcroForm字段。

“此PDF中没有提供的字段名” 字段名称是猜测的,而不是从中读取的 list_form_fields错误响应包括 valid_fields --使用正确的名称。

Claude Desktop:“MCP服务器配置无效” 使用 command/args 格式(不是 url 或 type: streamableHttp).包含 "--stdio" 在args中。编辑配置后完全退出并重新打开Claude Desktop。

服务器崩溃:“只读文件系统:./logs” 集 FORMFILL_LOG_FILE 到可写路径,或确保 FORMFILL_DATA_DIR 指向一个可写目录。默认值 ~/Library/Logs/formfill-mcp/server.log 在macOS上无需配置即可工作。

已达到API密钥限制 免费等级:每月50次。升级至 豁免申请。您的密钥会自动升级,无需更改配置。

检查服务器运行状况

  • GET https://formfill.plenitudo.ai/health → {"status":"ok"}
  • GET https://formfill.plenitudo.ai/smoke-test → 端到端填充真实的PDF,返回每个组件的通过/失败

贡献与安全

许可证

麻省理工学院 --版权所有©2025 Plenitudo AI


formfill.plenitudo.ai · Issues · Plenitudo.ai