Skip to main content

Extract structured JSON from PDFs via CLI, Python API, or MCP server.

Project description

pdf-agent-kit

pdf-agent-kit is a local adapter package for the pdf-agent-kit cloud API.

  • MCP entrypoint: pdf-agent-kit (stdio, one tool: extract_pdf_to_json)
  • CLI entrypoint: pdf-edit
  • Python import: from pdf_agent_kit import extract

The package is thin by design: it reads a local PDF file, attaches PDF_EDITOR_API_KEY, and forwards to the cloud API.

Quickstart For Agents

from pdf_agent_kit import extract

result = extract("/absolute/path/to/file.pdf", pages="1-3")

Install

pip install pdf-agent-kit

or:

uvx pdf-agent-kit

Python Compatibility

  • CLI (pdf-edit) works on Python 3.9+.
  • MCP server (pdf-agent-kit) requires Python 3.10+ because fastmcp is only installed on 3.10+.
  • If your agent is pinned to older Python, use pdf-edit directly or use uvx pdf-agent-kit for MCP runtime.

Environment

export PDF_EDITOR_API_KEY="sk_live_..."

You can also persist the key locally (avoids exporting every session):

pdf-edit setup --save-api-key

If missing, commands fail with:

PDF_EDITOR_API_KEY not set. Get your key at https://pdfagentkit.com/dashboard

MCP Tool

Tool name: extract_pdf_to_json

Parameters:

  • file_path (required)
  • pages (optional, default all)
  • filename (optional override)

Returns API JSON: metadata + per-page text + usage stats.

CLI

pdf-edit extract /path/to/file.pdf
pdf-edit extract /path/to/file.pdf --pages "1-5"
pdf-edit extract /path/to/file.pdf -o /path/to/output.json
pdf-edit status
pdf-edit setup --save-api-key

CLI contract:

  • success JSON goes to stdout
  • errors go to stderr
  • exit code 0 success, 1 user error, 2 server/network error
  • extract prints a concise usage summary to stderr (pages + remaining credits)

Setup

pdf-edit setup:

  1. Reads PDF_EDITOR_API_KEY (or prompts once if missing)
  2. Verifies key with /v1/account/status
  3. Patches MCP config for:
    • Claude Desktop
    • Cursor
    • VS Code
  4. Tries to add Claude Code integration via claude mcp add-json
  5. Optionally saves API key to ~/.pdf-agent-kit/config.json with --save-api-key

Injected server entry:

{
  "mcpServers": {
    "pdf-agent-kit": {
      "command": "uvx",
      "args": ["pdf-agent-kit"],
      "env": {
        "PDF_EDITOR_API_KEY": "sk_live_..."
      }
    }
  }
}

Development

pip install -e .[dev]
pytest -q

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pdf_agent_kit-0.1.2.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pdf_agent_kit-0.1.2-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file pdf_agent_kit-0.1.2.tar.gz.

File metadata

  • Download URL: pdf_agent_kit-0.1.2.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for pdf_agent_kit-0.1.2.tar.gz
Algorithm Hash digest
SHA256 4de45a799023e28b4b0c3099699de2cccaf3b448f326c0cf8044e24db8b6b1eb
MD5 49670c31c74fea2262e8d42fdd3c0fe4
BLAKE2b-256 8a00c42c01635b8fc92fec48e406e3e88629a3359573e17ab1473f5010810600

See more details on using hashes here.

File details

Details for the file pdf_agent_kit-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: pdf_agent_kit-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 11.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for pdf_agent_kit-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 60032e9c765694f90af7a1960bf4dd522e63da272659c407fbbb68e239df1fea
MD5 270aa556261b5a5137c226ea4a68d7aa
BLAKE2b-256 72d3f69785f577c8c20ff91ee338bd062648f7f4af23b8382bc34bba737328ff

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page