Metadata-Version: 2.4
Name: langchain-unstructured-transform
Version: 0.1.0
Summary: LangChain tools for the Unstructured Transform MCP server: parse, enrich, chunk, and embed files for RAG and AI pipelines.
Project-URL: Homepage, https://unstructured.io
Project-URL: Documentation, https://docs.unstructured.io/transform/overview
Project-URL: Repository, https://github.com/Unstructured-IO/langchain-unstructured-transform
Project-URL: Issues, https://github.com/Unstructured-IO/langchain-unstructured-transform/issues
Author-email: Unstructured <mcp-support@unstructured.io>
License: MIT
License-File: LICENSE
Keywords: document-parsing,etl,langchain,langgraph,mcp,rag,unstructured
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.10
Requires-Dist: langchain-core<2,>=0.3
Requires-Dist: langchain-mcp-adapters<1,>=0.3
Provides-Extra: test
Requires-Dist: pytest>=8; extra == 'test'
Requires-Dist: ruff>=0.6; extra == 'test'
Description-Content-Type: text/markdown

# langchain-unstructured-transform

LangChain tools for the [Unstructured Transform](https://docs.unstructured.io/transform/overview)
MCP server. Load the hosted Transform tools as native LangChain tools and hand them to any
LangChain or LangGraph agent to parse, enrich, chunk, and embed files (PDF, DOCX, images, and
70+ file types) for RAG and AI pipelines.

This package is a thin, opinionated wrapper around
[`langchain-mcp-adapters`](https://github.com/langchain-ai/langchain-mcp-adapters): it fixes the
Transform MCP server URL and bearer-token authentication so you don't have to configure the
client by hand.

## Installation

```bash
pip install -U langchain-unstructured-transform
```

## Requirements

- Python 3.10 or later.
- An Unstructured API key. [Get an API key](https://docs.unstructured.io/transform/overview).

Set your key as an environment variable (recommended):

```bash
export UNSTRUCTURED_API_KEY="<your-unstructured-api-key>"
```

## Quickstart

```python
import asyncio

from langchain.agents import create_agent
from langchain_unstructured_transform import aget_transform_tools


async def main() -> None:
    tools = await aget_transform_tools()  # reads UNSTRUCTURED_API_KEY
    agent = create_agent("claude-sonnet-4-6", tools)

    response = await agent.ainvoke(
        {
            "messages": [
                {
                    "role": "user",
                    "content": (
                        "Use the Unstructured Transform tools to parse ./report.pdf. "
                        "Provide the results as JSON."
                    ),
                }
            ]
        }
    )
    print(response["messages"][-1].content)


if __name__ == "__main__":
    asyncio.run(main())
```

### Toolkit

```python
from langchain_unstructured_transform import UnstructuredTransformToolkit

toolkit = UnstructuredTransformToolkit(api_key="...")  # or rely on the env var
tools = await toolkit.aget_tools()
```

### Synchronous usage

For scripts and notebooks that are not already inside an event loop:

```python
from langchain_unstructured_transform import get_transform_tools

tools = get_transform_tools()
```

## Tools

The Transform MCP server exposes the following tools, which drive the full parsing lifecycle:

- `request_file_upload_url` — get a URL to upload a source file.
- `transform_files` — start a transform job for uploaded files.
- `check_transform_status` — poll a running job.
- `get_transform_results` — fetch the partitioned/enriched/chunked/embedded output.

## Limits

- Each file must be a [supported file type](https://docs.unstructured.io/transform/supported-file-types).
- Each file must be 50 MB or less.
- Each request may contain 10 files or fewer.
- Only 5 requests can run at a time.

## License

[MIT](./LICENSE)
