Skip to main content
Glama

ChartDuck MCP

Open-source MCP server and CLI for ChartDuck — chart data extraction from scientific figures and document pages. The extraction engine runs on the hosted service; this repository is the thin client (MCP + CLI + Python SDK).

Status: pre-release (0.1.x). The hosted API is live at https://api.chartduck.com, so the client listed here does reach a working service. It is a shared public endpoint with a daily quota and no uptime commitment — if it answers 429 / rate_limited, wait and retry. The contract, code and error semantics below are implemented and tested against a mock, a local engine and the hosted endpoint.

What it does

Given a chart image (or a PDF page), return structured data per panel:

  • panel box, chart type (bar / barh / line / scatter / box)

  • data series (values in data coordinates when the axes can be calibrated)

  • geometry for panels without a value axis (normalized_box units)

  • recognized axis titles (beta)

{
  "panels": [
    {
      "box": [100.0, 19.0, 474.0, 393.0],
      "chart_type": "line",
      "axis_labels": {
        "x": {"text": "Baseline Fgas", "score": 0.98},
        "y": {"text": "Change in Fgas", "score": 1.0}
      },
      "data": {"series": [{"kind": "line", "points": [[0.5022, -0.0007], "..."]}]}
    }
  ],
  "meta": {"engine_version": "1.4.0", "elapsed_ms": 2640}
}

Related MCP server: pdf-chart-parser

Honest capability statement

Measured on public ICPR2022-style documents (unseen distribution):

  • ~65-70% of figures yield data automatically; the rest return data: null.

  • Supported types: vertical bar, line, scatter, vertical box, horizontal bar. scatter-line is partially supported. Other types are refused, not guessed.

  • If the extractor is not confident, it returns null instead of a wrong table. This is a design choice: a missing value is recoverable, a plausible wrong value is not.

  • Axis titles are beta: x-axis content accuracy 91.7%, y-axis 76.9% — not covered by any support commitment.

Full benchmark methodology: https://chartduck.com/#benchmarks.

Install

Requires Python 3.10+.

pip install chartduck-mcp          # 0.1.1: hosted API is live
# or from source
git clone https://github.com/MoDongla/chartduck-mcp && cd chartduck-mcp && pip install -e .

Configure

export CHARTDUCK_API_URL="https://api.chartduck.com"   # hosted service base URL
export CHARTDUCK_TOKEN="..."                            # optional: only for a private deployment

Use as an MCP server

Claude Code:

claude mcp add chartduck -- chartduck-mcp

Claude Desktop / generic JSON config:

{
  "mcpServers": {
    "chartduck": {
      "command": "chartduck-mcp",
      "env": {
        "CHARTDUCK_API_URL": "https://api.chartduck.com",
        "CHARTDUCK_TOKEN": "..."
      }
    }
  }
}

Streamable HTTP mode (for hosting):

chartduck-mcp --http   # listens on 0.0.0.0:8000/mcp by default

Tools

Tool

Input

Returns

extract_chart

image_base64 or image_url, include_geometry

{panels: [...], meta}

extract_chart_pdf

pdf_base64 or pdf_url, pages ("1-5", "3", "1,3")

{pages: [{page, panels}], meta}

Tool failures come back as MCP isError results with text code: message (invalid_input, unauthorized, quota_exceeded, unreadable, rate_limited, ...); full table in docs/mcp-contract.md.

Use as a CLI

chartduck extract figure.png -o figure.json
chartduck extract-pdf paper.pdf --pages 1-3 -o paper.json
chartduck health

Add --mock to parse examples/sample_response.json without a service (useful for wiring integrations).

SDK

from chartduck_client import ChartDuck

client = ChartDuck()                      # reads CHARTDUCK_API_URL / CHARTDUCK_TOKEN
result = client.extract_image_file("figure.png")
for panel in result["panels"]:
    print(panel["chart_type"], panel.get("data"))

Layout

chartduck_client.py   # REST client (stdlib urllib; the only third-party dep is `mcp`)
mcp_server.py         # MCP server (FastMCP, stdio or streamable HTTP)
cli.py                # command line
docs/mcp-contract.md  # tool contract, error codes, limits (English; 中文版 mcp-contract.zh.md)
examples/             # sample response

License

MIT. The hosted ChartDuck service, extraction engine, and evaluation corpus are not part of this repository.

Available Tools

2 tools
extract_chartA

Extract chart data from an image.

Provide exactly one of image_base64 (raw base64, no data: prefix) or image_url. Returns {panels: [{box, chart_type, axis, data, geometry, axis_labels}], meta}. When the extractor is not confident a panel returns data: null — never guessed.

Inputs: image_url, image_base64, include_geometry.

extract_chart_pdfA

Extract chart data from a PDF.

Provide exactly one of pdf_base64 or pdf_url. pages accepts "1-5", "3", or "1,3,7". Returns {pages: [{page, panels: [...]}], meta}.

Inputs: pages, pdf_url, pdf_base64.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 2 tools

    Disambiguation5/5

    The two tools are cleanly separated by input medium: extract_chart handles images and extract_chart_pdf handles PDFs. Their required parameter sets are mutually exclusive, so an agent can select the correct tool purely from the source file type.

    Naming Consistency5/5

    Both names follow the same snake_case verb_noun convention, with extract_chart_pdf being a predictable specialization of extract_chart. There is no mixing of casing or verb styles.

    Tool Count4/5

    Two tools are lean but directly correspond to the two supported input media, so the surface is appropriate for a focused chart-extraction server. It is slightly under what might be expected if batch extraction or auxiliary discovery operations were included.

    Completeness4/5

    The server covers the core extraction paths for both images and PDFs, including base64/URL inputs and page selection for PDFs. Minor gaps remain around batch processing or schema/format discovery, but the primary workflows are covered.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      B
      maintenance
      PDF extraction that actually works. The only extractor that audits every page. #2 on opendataloader-bench. 5 MCP tools for AI agents: metadata, convert, analyze, batch, structured extraction.
      7
      217 PyPI
      88
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      An MCP server that extracts energy-usage charts from utility-bill PDFs, returning structured time-series data and annotated images.
      1
      AGPL 3.0
    • A
      license
      Not graded
      quality
      D
      maintenance
      MCP server that extracts clean text, tables, and structured data from documents, images, code, and audio files, supporting 97 formats with OCR, transcription, and code intelligence.
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Modular OCR MCP server supporting Apple Vision, PaddleOCR, and PaddleOCR-VL backends. Enables text, layout, table, formula, and chart extraction from images via natural language.
      15
      1
      MIT