Expand description
docling-rs mcp (#669): a Model Context Protocol
server, so agents — Claude Desktop, Claude Code, IDE assistants — call
docling.rs directly.
Three tools:
convert_to_markdown(uri)— MarkItDown’s MCP tool (markitdown-mcp), same name and contract, so a config that pointed at MarkItDown keeps working: the document behind anhttp:/https:/file:/data:URI as Markdown. A plain path is accepted too.convert(uri, to?, images?, options?)— any output format docling.rs writes as text, with the conversion options every other surface takes (docling::ConvertOptions, docs/OPTIONS.md).list_input_formats()— the extensions this binary converts.
Transports: stdio (the default — what a desktop client launches) or
Streamable HTTP with --http (/mcp on --host/--port, 127.0.0.1:3001
by default), both through rmcp, the protocol’s official Rust SDK.
The server reads files and, when allowed, the network on behalf of a model, whose inputs may be steered by the documents it reads — so what a call can reach is the operator’s decision, made on the command line:
- local reads are confined to
--root DIR(repeatable; the working directory by default) — paths are checked lexically first, so a probe outside the root learns nothing about what exists there, then after resolving symlinks; - URLs are fetched only with
--allow-url-fetch, throughdocling::fetch: the SSRF block-list on every redirect hop, a size cap (DOCLING_RS_MAX_FETCH_BYTES, 256 MiB) and timeouts. The options that reach the network on their own — remote<img src>(image_sources=remote), a request-suppliedvlm_endpoint, the headless browser — sit behind the same flag, docling-serve’s rules; options that name files (xbrl_taxonomy, a copybook path inebcdic_layout) are held to the root; --httpbinds loopback unless--allow-remote, checks theHostheader (DNS rebinding) and the browserOriginon a loopback bind, and takes an optional bearer token (--bearer-token/DOCLING_RS_MCP_TOKEN).
Conversions run on the blocking pool, at most --concurrency (2) at a
time; a call that carries a progress token gets a heartbeat
notifications/progress every 10 s, so clients that reset their request
timeout on progress wait out a long PDF. stdout is the stdio transport’s
wire — everything else the process says goes to stderr.
The same server runs from the docling-rs binary (run) and from
embedders such as the Python package’s docling-rs-mcp launcher
(run_with and a Launcher naming the command and where its PDF
models come from).
Structs§
- Launcher
- How the server presents itself: the command that starts it (in
--help, usage errors and the startup line), the client configuration--helpshows, and how to get the PDF models when they are missing. The binary usesLauncher::CLI.
Functions§
- run
docling-rs mcp …— parse the flags, then serve until the client hangs up (stdio) or Ctrl-C (HTTP).- run_
with runfor an embedder: the flags after the command, how the server should name itself; returns the process exit status (0, 1 on a serving error, 2 on a usage error). Call it before other threads read the environment — it defaultsDOCLING_RS_NO_ARENA.