feat(unstructured): add Transform MCP tool - #3438
Conversation
There was a problem hiding this comment.
Pull request overview
Adds the hosted Unstructured Transform MCP workflow while retaining the legacy Partition tool.
Changes:
- Adds document transformation with multiple output formats and RAG preprocessing.
- Expands provider credentials, documentation, and privacy disclosures.
- Adds MCP dependencies and focused helper tests.
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
.difyignore |
Excludes tests from packages. |
PRIVACY.md |
Documents data handling. |
README.md |
Documents Transform and Partition tools. |
main.py |
Extends request timeout. |
manifest.yaml |
Releases version 0.0.10. |
provider/unstructured.py |
Routes credential validation. |
provider/unstructured.yaml |
Registers Transform credentials and tool. |
pyproject.toml |
Adds MCP and test dependencies. |
tests/test_transform.py |
Tests payload and stage helpers. |
tools/transform.py |
Implements the Transform workflow. |
tools/transform.yaml |
Defines the Transform interface. |
uv.lock |
Locks added dependencies. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Please resolve the comments if you think it's irrelvant. |
|
Thanks! I addressed all six review comments in |
- coalesce output_ref to "" so a null service value cannot violate the declared string output schema - raise MAX_REQUEST_TIMEOUT to 900s so the outer request has headroom for the 10-minute job deadline plus upload/download transfer phases - point the shared API-key help link at a neutral docs page so Local Deployment and Official API/Partition users are not routed to the Transform-only enrollment flow Validation: uv run pytest -q (9 passed), ruff format --check, ruff check, dify plugin package ./unstructured. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 13 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
tools/unstructured/tools/transform.py:24
- The hosted endpoint's current canonical integration reference (updated July 20) lists the live tools as
start_transform_job,check_job_status, andget_job_results, not these three legacy names. Requiring the legacy set makes credential validation reject the advertised endpoint before this tool can run, and the invocation sites below also call the stale protocol. Update the required names and adapt the corresponding request/response handling to the current schemas.
_REQUIRED_TRANSFORM_TOOLS = {
"request_file_upload_url",
"transform_files",
"check_transform_status",
"get_transform_results",
}
|
Latest update is in
The test key stayed private and was removed after the run. Would appreciate another look when you have a chance. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 13 changed files in this pull request and generated 11 comments.
Comments suppressed due to low confidence (8)
tools/unstructured/tools/transform.yaml:39
- The Portuguese word is missing its diacritic:
publicashould bepública.
pt_BR: URL publica do arquivo
tools/unstructured/tools/transform.yaml:44
- The Portuguese word is missing its diacritic:
publicashould bepública.
pt_BR: Uma URL HTTP(S) publica do documento. Informe este campo ou um arquivo.
tools/unstructured/tools/transform.yaml:89
- The Portuguese copy is missing diacritics in
Estrategia de analise.
pt_BR: Estrategia de analise. Use hi_res para enriquecimento e documentos digitalizados ou com layout complexo.
tools/unstructured/tools/transform.yaml:132
- The Portuguese word is missing its diacritic:
virgulashould bevírgula.
pt_BR: Enriquecimentos opcionais separados por virgula, como table_to_html,image_description,ner.
tools/unstructured/tools/transform.yaml:142
- The Portuguese word is missing its diacritic:
Estrategiashould beEstratégia, andfragmentacaoshould befragmentação.
pt_BR: Estrategia de fragmentacao
tools/unstructured/tools/transform.yaml:177
- The Portuguese copy is missing diacritics in
maximo,estrategia, ande.
pt_BR: Tamanho maximo do fragmento quando uma estrategia e selecionada.
tools/unstructured/tools/transform.yaml:193
- The Portuguese word is missing its diacritic:
estrategiashould beestratégia, andfragmentacaoshould befragmentação.
pt_BR: Anexe embeddings para RAG. Recomendado com uma estrategia de fragmentacao.
tools/unstructured/tools/transform.py:147
- The DNS preflight does not constrain the later HTTPX connection: HTTPX resolves the hostname again for the actual request. A rebinding/alternating DNS record can return a global address here and an internal address on the second lookup, bypassing this SSRF guard. Pin the validated address in the transport while preserving TLS SNI/Host, or restrict signed transfers to an allowlist of trusted storage domains.
resolved = await asyncio.to_thread(
socket.getaddrinfo,
hostname,
port or 443,
type=socket.SOCK_STREAM,
)
|
Reviewed Copilot's suppressed DNS-rebinding suggestion as well. I am not pinning resolved IPs or adding a storage-domain allowlist in this plugin: signed transfer URLs are issued by the locked hosted Transform MCP endpoint rather than supplied by the end user, redirects are disabled, and the existing global-address check remains defense in depth. IP pinning would require custom TLS/SNI transport behavior, while an allowlist would be brittle without a documented stable storage-domain contract. The hosted service remains the authoritative security boundary for source-URL fetching. |
|
@crazywoola All review threads are addressed and resolved in the latest head ( |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 13 changed files in this pull request and generated no new comments.
Suppressed comments (1)
tools/unstructured/manifest.yaml:35
created_atis the plugin's original creation timestamp, not the release timestamp. Previous Unstructured releases (including 0.0.7 and 0.0.9) retained2025-04-23T17:46:21.256715+08:00while only incrementingversion; replacing it here rewrites the Marketplace metadata for an existing listing. Please preserve the original timestamp.
created_at: 2026-07-14T00:00:00.000000+00:00
Summary
Unstructured Transform converts PDFs, DOCX, PPTX, HTML, images, and scanned pages into clean structured output.
Marketplace behavior
This updates the existing
langgenius/unstructuredMarketplace plugin. Once approved and merged, Dify's repository workflow packages and uploads version 0.0.10 to the Marketplace. Users will discover and install it from the existing Unstructured listing, then authenticate at runtime with their own Unstructured account and API key. No shared Unstructured credential is included in the plugin.Documentation
Validation
uv run pytest -q tests/test_transform.py(25 passed)uvx ruff check tools/transform.py tests/test_transform.pyuvx black --check tools/transform.py tests/test_transform.pygit diff --checkdify plugin package ./unstructuredhttps://mcp.transform.unstructured.io: credential validation, signed upload,start_transform_job,check_job_status,get_job_results, and Markdown result download all passed with a synthetic document