Cover image
Try Now
2025-04-05

MCP服务器可帮助您通过文档“使用文档”🐥

3 years

Works with Finder

1

Github Watches

2

Github Forks

8

Github Stars

MCP Docling Server

An MCP server that provides document processing capabilities using the Docling library.

Installation

You can install the package using pip:

pip install -e .

Usage

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 exposes the following tools:

  1. convert_document: Convert a document from a URL or local path to markdown format

    • source: URL or local file path to the document (required)
    • enable_ocr: Whether to enable OCR for scanned documents (optional, default: false)
    • ocr_language: List of language codes for OCR, e.g. ["en", "fr"] (optional)
  2. convert_document_with_images: Convert a document and extract embedded images

    • source: URL or local file path to the document (required)
    • enable_ocr: Whether to enable OCR for scanned documents (optional, default: false)
    • ocr_language: List of language codes for OCR (optional)
  3. extract_tables: Extract tables from a document as structured data

    • source: URL or local file path to the document (required)
  4. convert_batch: Process multiple documents in batch mode

    • sources: List of URLs or file paths to documents (required)
    • enable_ocr: Whether to enable OCR for scanned documents (optional, default: false)
    • ocr_language: List of language codes for OCR (optional)
  5. qna_from_document: Create a Q&A document from a URL or local path to YAML format

    • source: URL or local file path to the document (required)
    • no_of_qnas: Number of expected Q&As (optional, default: 5)
    • Note: This tool requires IBM Watson X credentials to be set as environment variables:
  6. get_system_info: Get information about system configuration and acceleration status

Example with Llama Stack

https://github.com/user-attachments/assets/8ad34e50-cbf7-4ec8-aedd-71c42a5de0a1

You can use this server with Llama Stack to provide document processing capabilities to your LLM applications. Make sure you have a running Llama Stack server, then configure your INFERENCE_MODEL

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.

相关推荐

  • NiKole Maxwell
  • I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

  • Bora Yalcin
  • Evaluator for marketplace product descriptions, checks for relevancy and keyword stuffing.

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

  • Callycode Limited
  • A geek-themed horoscope generator blending Bitcoin prices, tech jargon, and astrological whimsy.

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Khalid kalib
  • Write professional emails

  • Beniyam Berhanu
  • Therapist adept at identifying core issues and offering practical advice with images.

  • lumpenspace
  • Take an adjectivised noun, and create images making it progressively more adjective!

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • apappascs
  • 发现市场上最全面,最新的MCP服务器集合。该存储库充当集中式枢纽,提供了广泛的开源和专有MCP服务器目录,并提供功能,文档链接和贡献者。

  • ShrimpingIt
  • MCP系列GPIO Expander的基于Micropython I2C的操作,源自ADAFRUIT_MCP230XX

  • OffchainLabs
  • 进行以太坊的实施

  • huahuayu
  • 统一的API网关,用于将多个Etherscan样区块链Explorer API与对AI助手的模型上下文协议(MCP)支持。

  • deemkeen
  • 用电源组合控制您的MBOT2:MQTT+MCP+LLM

    Reviews

    5 (1)
    Avatar
    user_HzGeZGYD
    2025-04-15

    The Infactory MCP Server by infactory-io is an outstanding product for managing and optimizing your server operations. Its seamless integration and intuitive interface make it user-friendly and efficient. The performance improvements are noticeable, and the support provided by infactory-io is top-notch. I highly recommend it to anyone looking for a reliable MCP server solution.