DoclingDocling for IBM watsonx

MCP

Use Docling with AI agents via Model Context Protocol

Docling MCP

Docling MCP enables AI agents and clients to use Docling's document processing capabilities through the Model Context Protocol. This allows applications like Claude Desktop, LM Studio, and other MCP clients to convert, process, and generate documents directly.

Prerequisites

Before using Docling MCP, you need access to a Docling Service instance:

  • Service URL: Your Docling Serve API endpoint (e.g., https://your-docling-service.example.com)
  • API Key: Authentication token for the service

What is Docling MCP?

Docling MCP is a Model Context Protocol server that exposes Docling's capabilities as tools that AI agents can invoke. It supports:

  • Document Conversion: Convert PDFs to structured JSON format (DoclingDocument)
  • Document Generation: Create new documents with titles, sections, paragraphs, and lists
  • Multiple Formats: Export to Markdown, JSON, and other formats
  • Local Caching: Improves performance for repeated document access
  • RAG Applications: Integration with vector databases for retrieval-augmented generation

Installation Modes

Lightweight installation that connects to your Docling Service:

pip install docling-mcp

Configure environment:

export DOCLING_MCP_SERVICE_URL=https://your-docling-service.example.com
export DOCLING_MCP_SERVICE_API_KEY=your-api-key-here
export DOCLING_MCP_CONVERSION_MODE=remote

Local Mode

For users without Docling Service access (processes documents locally):

pip install docling-mcp[local]

Configure environment:

export DOCLING_MCP_CONVERSION_MODE=local

Hybrid Mode

Remote with automatic fallback to local processing:

pip install docling-mcp[local]

Configure:

export DOCLING_MCP_SERVICE_URL=https://your-docling-service.example.com
export DOCLING_MCP_SERVICE_API_KEY=your-api-key-here
export DOCLING_MCP_CONVERSION_MODE=remote
export DOCLING_MCP_FALLBACK_TO_LOCAL=true

Quick Start

The easiest way to use Docling MCP is via uvx:

# For stdio transport (Claude Desktop, LM Studio)
uvx --from docling-mcp docling-mcp-server --transport stdio

# For SSE transport (Llama Stack)
uvx --from docling-mcp docling-mcp-server --transport sse

# For HTTP transport (containerized setups)
uvx --from docling-mcp docling-mcp-server --transport streamable-http

Client Integration

{
  "mcpServers": {
    "docling": {
      "command": "uvx",
      "args": [
        "--from=docling-mcp",
        "docling-mcp-server"
      ],
      "env": {
        "DOCLING_MCP_CONVERSION_MODE": "remote",
        "DOCLING_MCP_SERVICE_URL": "https://your-docling-service.example.com",
        "DOCLING_MCP_SERVICE_API_KEY": "your-api-key-here"
      }
    }
  }
}

Add this configuration to claude_desktop_config.json for Claude Desktop or mcp.json for LM Studio. For LM Studio, you can also use the direct install button:

Add to LM Studio

Configuration

All settings use the DOCLING_MCP_ prefix and can be supplied as environment variables, in a .env file in the working directory, or via the env block of your MCP client config:

VariableDefaultDescription
DOCLING_MCP_CONVERSION_MODEremoteremote or local
DOCLING_MCP_SERVICE_URLDocling Service endpoint (required for remote mode)
DOCLING_MCP_SERVICE_API_KEYAPI key (required for remote mode)
DOCLING_MCP_SERVICE_TIMEOUT300.0Request timeout in seconds
DOCLING_MCP_FALLBACK_TO_LOCALfalseFall back to local if service unavailable
DOCLING_MCP_KEEP_IMAGESfalseRetain page images in output
DOCLING_MCP_DO_OCRtrueEnable OCR pipeline
DOCLING_MCP_DO_TABLE_STRUCTUREtrueDetect table structure

Full configuration reference available in the Docling MCP repository.

Example Usage

Here are some example prompts to get you going:

Converting Documents

Convert the PDF document at /path/to/document.pdf into DoclingDocument and return its document-key.

Generating Documents

Create a new document about AI tokenizers. Add a title, then add sections with headings and paragraphs. Include a bulleted list of key concepts. Export to Markdown when done.

RAG Applications

Convert this research paper to DoclingDocument, chunk it, and upload to the vector database for retrieval.

Resources

On this page