# Optimize PDF: web app and MCP

## What it does
Reduces the file size of a PDF document and optionally linearizes it for faster web viewing.

## Inputs and limits
Accepts a single PDF file supplied via upload (web) or a publicly reachable URL (MCP). The file size limit is determined by the service configuration; typical limits are up to several tens of megabytes.

## Web app
The page asks you to **Upload a PDF to optimize**. After selecting a file, the service compresses the PDF, removes redundant data, and creates a linearized version suitable for fast web browsing. The result can be downloaded directly from the browser.

## MCP
Compress a PDF by providing its public URL to the hosted MCP tool. The tool returns a compressed PDF file.

Client configuration (the key comes from your Documentize account):

```json
{
  "mcpServers": {
    "documentize": {
      "url": "https://api.documentize.app/mcp",
      "headers": {
        "Authorization": "Bearer dmk_YOUR_KEY_HERE"
      }
    }
  }
}
```

Tool call (`tools/call`). The tool returns a task id; poll `get_task_status` until it reports 200, then download the file from `uploadFileName`:

```json
{
  "name": "compress_document",
  "arguments": {
    "fileUrl": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
    "compressType": 1
  }
}
```

## Verified

Every code sample on this page was run on 2026-11-03 and its result was checked:

- Compress PDF via MCP tool (hosted MCP server): passed in 6 s
