Skip to main content

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. Version 0.1.0 reserves the package name; the hosted API is not publicly available yet, so the client cannot reach a live service. The contract, code and error semantics below are implemented and tested against a mock and a local engine.

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}
}

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 (site launch pending).

Install

Requires Python 3.10+.

pip install chartduck-mcp          # 0.1.0: name reservation, no live API yet
# 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="..."                            # pilot API token

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 (Chinese)
examples/             # sample response

License

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

Metadata

Release files for chartduck-mcp 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for chartduck-mcp 0.1.0
File Size Uploaded Provenance Actions
chartduck_mcp-0.1.0.tar.gz 10.6 kB Without provenance Details for chartduck_mcp-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for chartduck-mcp 0.1.0
File Interpreter ABI Platform Actions
chartduck_mcp-0.1.0-py3-none-any.whl Python 3 none any Details for chartduck_mcp-0.1.0-py3-none-any.whl

Total release size: 20.5 kB

Release files / chartduck_mcp-0.1.0.tar.gz

Download URL chartduck_mcp-0.1.0.tar.gz
Size 10.6 kB
Tags Source
SHA-256 checksum
How to use checksums
4abe9027e8471914ce41a195550b8e14a185571c8b541d634a2be5a1c40bbdaf
BLAKE2b-256 checksum
How to use checksums
b4737db88b0df14a34122776bc629912e77013f3a6f57a08d52ceeab327c5564
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.4

Release files / chartduck_mcp-0.1.0-py3-none-any.whl

Download URL chartduck_mcp-0.1.0-py3-none-any.whl
Size 9.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b3cf245712afd6ce7ee17acddaa216ce42ba2fad2f4b26fcc828a2ea42e6f5b5
BLAKE2b-256 checksum
How to use checksums
7205ba21770c4fe9fb85f60130174f0386fdc77759f4bca11b7148a441a459ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.4

Security for chartduck-mcp 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page