Back to Docling

Mcp

docs/usage/mcp.md

2.102.22.8 KB
Original Source

New AI trends focus on Agentic AI, an artificial intelligence system that can accomplish a specific goal with limited supervision. Agents can act autonomously to understand, plan, and execute a specific task.

To address the integration problem, the Model Context Protocol (MCP) emerges as a popular standard for connecting AI applications to external tools.

Docling MCP

Docling supports the development of AI agents by providing an MCP Server. It allows you to experiment with document processing in different MCP Clients. Adding Docling MCP in your favorite client is usually as simple as adding the following entry in the configuration file:

json
{
  "mcpServers": {
    "docling": {
      "command": "uvx",
      "args": [
        "--from=docling-mcp",
        "docling-mcp-server"
      ]
    }
  }
}

When using Claude on your desktop, just edit the config file claude_desktop_config.json with the snippet above or the example provided here.

In LM Studio, edit the mcp.json file with the appropriate section or simply click on the button below for a direct install.

Using a remote Docling Serve API

By default the MCP server converts documents locally. It can instead delegate conversion to a running API server — a self-hosted docling-serve instance or a managed service — by setting these environment variables:

sh
export DOCLING_SERVICE_URL=https://your-docling-service.example.com
export DOCLING_SERVICE_API_KEY=your-api-key   # if the service requires one
export DOCLING_CONVERSION_MODE=remote

To fall back to local processing when the remote service is unavailable, also set DOCLING_FALLBACK_TO_LOCAL=true (requires pip install "docling-mcp[local]"). See the docling-mcp installation options.

Docling MCP also provides tools specific for some applications and frameworks. See the Docling MCP Server repository for more details. You will find examples of building agents powered by Docling capabilities and leveraging frameworks like LlamaIndex, Llama Stack, Pydantic AI, or smolagents.