Docling MCP server

Integrates with the Docling library to provide document processing capabilities, including conversion to markdown, table extraction, and image handling with OCR support, enabling efficient analysis of structured and unstructured data from various document formats.
Back to servers
Setup instructions
Provider
Red Hat GmbH
Release date
Mar 04, 2025
Language
Python
Stats
12 stars

The MCP Docling Server provides document processing capabilities, allowing you to convert documents to markdown, extract tables, create Q&A documents, and more using the Docling library through the Model Context Protocol (MCP).

Installation

You can install the package using pip:

pip install -e .

Starting the Server

Start the server using either stdio (default) or SSE transport:

# Using stdio transport (default)
mcp-server-lls

# Using SSE transport on custom port
mcp-server-lls --transport sse --port 8000

If you're using uv, you can run the server directly without installing:

# Using stdio transport (default)
uv run mcp-server-lls

# Using SSE transport on custom port
uv run mcp-server-lls --transport sse --port 8000

Available Tools

The server provides several document processing tools:

Document Conversion

convert_document: Convert a document to markdown format

  • Parameters:
    • source: URL or local file path (required)
    • enable_ocr: Enable OCR for scanned documents (optional, default: false)
    • ocr_language: List of language codes for OCR, e.g. ["en", "fr"] (optional)

convert_document_with_images: Convert a document and extract embedded images

  • Parameters:
    • source: URL or local file path (required)
    • enable_ocr: Enable OCR for scanned documents (optional, default: false)
    • ocr_language: List of language codes for OCR (optional)

Data Extraction

extract_tables: Extract tables from a document as structured data

  • Parameters:
    • source: URL or local file path (required)

convert_batch: Process multiple documents in batch mode

  • Parameters:
    • sources: List of URLs or file paths (required)
    • enable_ocr: Enable OCR for scanned documents (optional, default: false)
    • ocr_language: List of language codes for OCR (optional)

Q&A Generation

qna_from_document: Create a Q&A document in YAML format

  • Parameters:
    • source: URL or local file path (required)
    • no_of_qnas: Number of expected Q&As (optional, default: 5)

Note: This tool requires IBM Watson X credentials set as environment variables:

System Information

get_system_info: Get information about system configuration and acceleration status

Integration with Llama Stack

You can use this server with Llama Stack to provide document processing capabilities to your LLM applications:

from llama_stack_client.lib.agents.agent import Agent
from llama_stack_client.lib.agents.event_logger import EventLogger
from llama_stack_client.types.agent_create_params import AgentConfig
from llama_stack_client.types.shared_params.url import URL
from llama_stack_client import LlamaStackClient
import os

# Set your model ID
model_id = os.environ["INFERENCE_MODEL"]
client = LlamaStackClient(
    base_url=f"http://localhost:{os.environ.get('LLAMA_STACK_PORT', '8080')}"
)

# Register MCP tools
client.toolgroups.register(
    toolgroup_id="mcp::docling",
    provider_id="model-context-protocol",
    mcp_endpoint=URL(uri="http://0.0.0.0:8000/sse"))

# Define an agent with MCP toolgroup
agent_config = AgentConfig(
    model=model_id,
    instructions="""You are a helpful assistant with access to tools to manipulate documents.
Always use the appropriate tool when asked to process documents.""",
    toolgroups=["mcp::docling"],
    tool_choice="auto",
    max_tool_calls=3,
)

# Create the agent
agent = Agent(client, agent_config)

# Create a session
session_id = agent.create_session("test-session")

def _summary_and_qna(source: str):
    # Define the prompt
    run_turn(f"Please convert the document at {source} to markdown and summarize its content.")
    run_turn(f"Please generate a Q&A document with 3 items for source at {source} and display it in YAML format.")

def _run_turn(prompt):
    # Create a turn
    response = agent.create_turn(
        messages=[
            {
                "role": "user",
                "content": prompt,
            }
        ],
        session_id=session_id,
    )

    # Log the response
    for log in EventLogger().log(response):
        log.print()

_summary_and_qna('https://arxiv.org/pdf/2004.07606')

Caching

The server caches processed documents in ~/.cache/mcp-docling/ to improve performance for repeated requests.

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "docling" '{"command":"mcp-server-lls","args":[]}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "docling": {
            "command": "mcp-server-lls",
            "args": []
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "docling": {
            "command": "mcp-server-lls",
            "args": []
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later