aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuri Victorovich <yuri@FreeBSD.org>2026-04-07 23:38:38 +0000
committerYuri Victorovich <yuri@FreeBSD.org>2026-04-07 23:39:01 +0000
commitc9ecc8e87b3d1f21806d58e5e09465bdb3c3e589 (patch)
treeedecd39c99085150813da190132c6fe47eafd583
parent12bf1393bf109c530810481f99e469a9441f985e (diff)
textproc/pymupdf4llm-mcp: New port: MCP server for pymupdf4llm: convert PDF to Markdown for LLMs
-rw-r--r--textproc/Makefile1
-rw-r--r--textproc/pymupdf4llm-mcp/Makefile31
-rw-r--r--textproc/pymupdf4llm-mcp/distinfo3
-rw-r--r--textproc/pymupdf4llm-mcp/files/patch-tests_test__tool.py26
-rw-r--r--textproc/pymupdf4llm-mcp/pkg-descr10
5 files changed, 71 insertions, 0 deletions
diff --git a/textproc/Makefile b/textproc/Makefile
index aaf32ffe1d46..92d2035da077 100644
--- a/textproc/Makefile
+++ b/textproc/Makefile
@@ -1775,6 +1775,7 @@
SUBDIR += py-zensical
SUBDIR += py-zope.i18nmessageid
SUBDIR += py-zpt
+ SUBDIR += pymupdf4llm-mcp
SUBDIR += qo
SUBDIR += qprint
SUBDIR += qr
diff --git a/textproc/pymupdf4llm-mcp/Makefile b/textproc/pymupdf4llm-mcp/Makefile
new file mode 100644
index 000000000000..aef95203bba3
--- /dev/null
+++ b/textproc/pymupdf4llm-mcp/Makefile
@@ -0,0 +1,31 @@
+PORTNAME= pymupdf4llm-mcp
+DISTVERSION= 0.0.4
+CATEGORIES= textproc python
+MASTER_SITES= PYPI
+DISTNAME= ${PORTNAME:S/-/_/}-${DISTVERSION}
+
+MAINTAINER= yuri@FreeBSD.org
+COMMENT= MCP server for pymupdf4llm: convert PDF to Markdown for LLMs
+WWW= https://github.com/pymupdf/pymupdf4llm-mcp
+
+LICENSE= AGPLv3
+LICENSE_FILE= ${WRKSRC}/LICENSE
+
+BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}hatchling>0:devel/py-hatchling@${PY_FLAVOR}
+RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}mcp>=1.6.0:misc/py-mcp@${PY_FLAVOR} \
+ ${PYTHON_PKGNAMEPREFIX}pydantic2>=2.11.3:devel/py-pydantic2@${PY_FLAVOR} \
+ ${PYTHON_PKGNAMEPREFIX}pymupdf4llm>=0.0.21:textproc/py-pymupdf4llm@${PY_FLAVOR} \
+ ${PYTHON_PKGNAMEPREFIX}typer>=0.15.2:devel/py-typer@${PY_FLAVOR}
+TEST_DEPENDS= ${PYTHON_PKGNAMEPREFIX}inline-snapshot>0:devel/py-inline-snapshot@${PY_FLAVOR} \
+ ${PYTHON_PKGNAMEPREFIX}pytest-asyncio>0.25.3:devel/py-pytest-asyncio@${PY_FLAVOR}
+
+USES= python
+USE_PYTHON= autoplist pep517 pytest
+
+TEST_ENV= ${MAKE_ENV} PYTHONPATH=${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
+
+NO_ARCH= yes
+
+# tests as of 0.0.4: 1 passed in 0.22s
+
+.include <bsd.port.mk>
diff --git a/textproc/pymupdf4llm-mcp/distinfo b/textproc/pymupdf4llm-mcp/distinfo
new file mode 100644
index 000000000000..05b719312e6f
--- /dev/null
+++ b/textproc/pymupdf4llm-mcp/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1775602664
+SHA256 (pymupdf4llm_mcp-0.0.4.tar.gz) = 90bdf45b6cc1f867a84048d4804fc781aeacab90d3af79e94795c91448f65348
+SIZE (pymupdf4llm_mcp-0.0.4.tar.gz) = 71180
diff --git a/textproc/pymupdf4llm-mcp/files/patch-tests_test__tool.py b/textproc/pymupdf4llm-mcp/files/patch-tests_test__tool.py
new file mode 100644
index 000000000000..e3afb4a6aaa1
--- /dev/null
+++ b/textproc/pymupdf4llm-mcp/files/patch-tests_test__tool.py
@@ -0,0 +1,26 @@
+--- tests/test_tool.py.orig 2026-04-07 22:59:54 UTC
++++ tests/test_tool.py
+@@ -14,11 +14,9 @@ def test_convert_pdf_to_markdown():
+ assert result["success"] is True
+ assert "markdown_content" in result
+ assert result["markdown_content"] == snapshot("""\
+-# **Dummy PDF file**
++**Dummy PDF file**
+
+
+------
+-
+ """)
+
+ # temporary file to write the markdown content
+@@ -31,9 +29,7 @@ -----
+ with open(temp_file_path, encoding="utf-8") as f:
+ content = f.read()
+ assert content == snapshot("""\
+-# **Dummy PDF file**
++**Dummy PDF file**
+
+-
+------
+
+ """)
diff --git a/textproc/pymupdf4llm-mcp/pkg-descr b/textproc/pymupdf4llm-mcp/pkg-descr
new file mode 100644
index 000000000000..7b57cf16ef1f
--- /dev/null
+++ b/textproc/pymupdf4llm-mcp/pkg-descr
@@ -0,0 +1,10 @@
+pymupdf4llm-mcp is an MCP (Model Context Protocol) server that exposes
+pymupdf4llm functionality as tools for LLM agents. It allows AI assistants
+to convert PDF documents to Markdown format, making them suitable for
+processing by Large Language Models (LLMs) and Retrieval-Augmented Generation
+(RAG) systems.
+
+The server provides tools for:
+- Converting PDF files to Markdown with preserved structure
+- Handling tables, images, and text formatting
+- Saving converted Markdown to files