Agentic Document Processing#
Docling exposes its document conversion capabilities to AI agents through three complementary integration paths: an MCP server (docling-mcp) for protocol-native agent integration, direct framework connectors for AG2/AutoGen, CrewAI, and Bee, and a proposed gRPC streaming layer for polyglot and low-latency use cases.
The shared output across all paths is the DoclingDocument JSON — a structured, richly-typed representation of converted documents that agents can reason over.
MCP Server (docling-mcp)#
The docling-mcp package implements a Model Context Protocol server that exposes Docling's conversion, generation, and RAG capabilities as MCP tools. It is a core runtime dependency of docling-serve .
Quick install for Claude Desktop or LM Studio — add the following to the client's config file :
{
"mcpServers": {
"docling": {
"command": "uvx",
"args": ["--from=docling-mcp", "docling-mcp-server"]
}
}
}
Three installation profiles are available :
| Mode | Install | When to use |
|---|---|---|
| Remote (default) | pip install docling-mcp | Delegates to a Docling Serve API; ~50 MB, no model downloads |
| Local | pip install docling-mcp[local] | Offline or no Docling Serve available |
| Hybrid | pip install docling-mcp[local] + DOCLING_FALLBACK_TO_LOCAL=true | Remote preferred, falls back to local |
Transport protocols: stdio (Claude Desktop, LM Studio), sse (Llama Stack), and streamable-http (containerized/remote deployments) .
Remote API mode: To delegate conversion to a running docling-serve instance rather than running models locally :
export DOCLING_SERVICE_URL=https://your-docling-service.example.com
export DOCLING_SERVICE_API_KEY=your-api-key
export DOCLING_CONVERSION_MODE=remote
Exposed tools: Conversion (PDF → DoclingDocument), generation (create DoclingDocument exportable to multiple formats), and RAG (Milvus upload/retrieval) . Examples using LlamaIndex, Llama Stack, Pydantic AI, and smolagents are in the docling-mcp examples directory .
AG2 / AutoGen Multi-Agent Integration#
Docling can be integrated directly into AG2 (AutoGen) multi-agent workflows by registering DocumentConverter operations as agent tools. The reference example is docs/examples/ag2_multiagent_document_analysis.ipynb.
Agent architecture in the example :
document_processor— callsconvert_documentandextract_tablestools backed by Doclinganalyst— receives extracted content and produces a structured summaryuser_proxy— orchestrates theGroupChatand executes tool calls
Tool registration pattern — Docling's DocumentConverter is registered directly as an AG2 tool . The converter instance is stateless and thread-safe, so it can be shared across agents.
Install: pip install docling "ag2[openai]>=0.11.4,<1.0" pandas .
Other Framework Connectors#
- CrewAI — Docling is available as the
CrewDoclingSourceknowledge source. Seedocs/integrations/crewai.md. - Bee Agent Framework — Docling is available as an extraction backend in Bee. See
docs/integrations/bee.md. - Agent skills file —
docling/.agents/skills/docling/SKILL.mdprovides a decision guide for coding agents, covering CLI, Python SDK,DocumentExtractor, chunking/RAG, and remote service client use cases .
Proposed gRPC Streaming (Experimental, Not Merged)#
A community contributor has proposed a gRPC transport layer in two companion PRs :
docling-servePR #504 — gRPC server implementation and Python stubsdocling-corePR #546 — protobuf definitions
Design principles :
- Pydantic-first: the Pydantic domain model stays the source of truth; protobuf is only the transport contract.
- Startup schema validation: the gRPC server cross-checks protobuf descriptors against the live Pydantic model at boot, failing fast on type drift.
- Semantic parity, not field-for-field REST mirroring: same document semantics and options, exposed through a gRPC-native API shape.
Planned server-side streaming would emit document parts incrementally (text blocks, tables, pictures) as parsing completes, rather than waiting for the full DoclingDocument. A draft streaming schema (StreamDocumentRequest / DocumentStreamEnvelope) using a oneof payload has been shared in the discussion thread .
Infrastructure caveat: Server-streaming gRPC requires a stable HTTP/2 connection. Environments that scale down replicas mid-request (e.g., Azure Container Apps GPU scaling) can sever long-lived streams — a known concern raised in the discussion .
Working client examples in Go, Java, Python, JavaScript, and Rust are available at ai-pipestream/docling-grpc-examples . The PR author has noted they will continue maintaining the gRPC fork even if the upstream PR is not merged .
Key References#
| Resource | Description |
|---|---|
docling-mcp repo | Source, examples, migration guide |
| MCP usage docs | Client setup, remote API mode, env vars |
| AG2 example notebook | End-to-end multi-agent document analysis |
| Agent skills file | Decision guide for coding agents |
| gRPC discussion thread | Design rationale, streaming schema, infra constraints |