Skip to content

Commit fd05563

Browse files
committed
feat: Support unlock pro
1 parent ad4b139 commit fd05563

File tree

4 files changed

+117
-0
lines changed

4 files changed

+117
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,5 @@ Configure your cursor/windsurf/... and other MCP client to this server:
3333
}
3434
}
3535
```
36+
37+
Set `PYMUPDF_PRO_PASSWORD` environment variable to enable pro features: parse DOC/DOCX, XLS/XLSX, PPT/PPTX, HWP/HWPX and more.

pymupdf4llm_mcp/app.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
1+
import os
12
from pathlib import Path
23
from typing import Annotated, Any
34

45
import pymupdf4llm
56
from mcp.server.fastmcp import FastMCP
67
from pydantic import Field
78

9+
PRO_UNLOCKED = False
10+
if pymupdf_pro_password := os.getenv("PYMUPDF_PRO_PASSWORD"):
11+
import pymupdf.pro
12+
13+
pymupdf.pro.unlock(pymupdf_pro_password)
14+
# FIXME: Detect unlock failure
15+
PRO_UNLOCKED = True
16+
817
mcp = FastMCP("pymupdf4llm-mcp")
918

1019

@@ -16,6 +25,9 @@
1625
"This tool will also convert the PDF to images and save them in the `image_path` directory. "
1726
"For larger PDF files, use `save_path` to save the markdown file then read it partially. "
1827
)
28+
+ "\n**This tool now supports DOC/DOCX, XLS/XLSX, PPT/PPTX, HWP/HWPX as PRO version.**"
29+
if PRO_UNLOCKED
30+
else ""
1931
)
2032
def convert_pdf_to_markdown(
2133
file_path: Annotated[str, Field(description="Absolute path to the PDF file to convert")],

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ dependencies = [
2020
"mcp[cli]>=1.6.0",
2121
"pydantic>=2.11.3",
2222
"pymupdf4llm>=0.0.21",
23+
"pymupdfpro>=1.25.5",
2324
"typer>=0.15.2",
2425
]
2526

0 commit comments

Comments
 (0)