Skip to content

Datawrapper MCP V2 2.3.0

Choose a tag to compare

@JohnnyTheTank JohnnyTheTank released this 30 Nov 12:17
· 115 commits to main since this release

Hosting and deploy

  • Graceful shutdown. On SIGTERM/SIGINT the HTTP server stops taking connections, lets running requests finish for up to 25 s (SHUTDOWN_TIMEOUT_SECONDS), then logs and flushes the usage counts and exits. Before, a deploy cut off running tool calls (a create with its preview can take 25 s) and could leave half-made charts behind. A second signal exits at once. fly.toml sets kill_signal = "SIGTERM" and kill_timeout = "30s".
  • Deploys without downtime: fly.toml uses the blue-green strategy; the old machine serves until the new one passes /healthz. Usage snapshots stay correct: they are kept per server instance, so nothing is counted twice; what the old machine counts after the pre-deploy snapshot is in its [stats] shutdown … log line.
  • Deploy only after green tests. deploy.yml runs lint, typecheck, build and tests before it builds the image; FLY_API_TOKEN is only used in jobs of the production environment. The smoke test after a deploy waits until /healthz reports the released version, checks HSTS and calls initialize and tools/list on /mcp (401 with resource metadata without a token) — also runnable by hand: scripts/smoke-test.sh <url> [version].
  • CI builds the Docker image, starts it, runs the smoke test and checks that it exits cleanly on SIGTERM. Base images are pinned by digest and kept current by Dependabot. The GeoIP download is checked against well-known addresses (DB-IP keeps only two monthly files, so it cannot be pinned; a failure still only warns).

Security

  • Strict-Transport-Security (one year, subdomains) on every response when PUBLIC_URL is https.
  • Secret rotation without logging users out: OAUTH_SECRET_PREVIOUS (comma-separated) keeps tokens and registered client ids of earlier secrets valid while new ones use OAUTH_SECRET (README → Self-host).
  • Token decryption accepts only dir + A256GCM, the algorithms the server issues.
  • GET /authorize is rate-limited like the other OAuth endpoints (a new https client_id there fetches its metadata document); failed metadata fetches are remembered for a minute.
  • Rate limits group IPv6 addresses per /64, so rotating addresses within one allocation does not escape them. When more than 10,000 clients are tracked, idle buckets are dropped first and limited ones last, so a flood of new addresses cannot reset another client's limit.
  • /token requests without client_id are logged with the client's name (checked when present, as before), to learn whether it can be required as OAuth 2.1 asks of public clients.

API robustness

  • Every Datawrapper request has a timeout (30 s, DW_REQUEST_TIMEOUT_MS; synchronous exports three times as long), combined with the MCP cancellation signal. A hanging request now ends with an error that says so instead of blocking the tool call. The HEAD check for auto-published images and OpenStreetMap boundary lookups have timeouts too.
  • Retry-After is read as seconds or as an HTTP date. The client waits at most 30 s on its own; a longer wait ends with an error that names the time to retry. Backoff between retries has ±25 % jitter.
  • A 429 is retried for POST requests too (Datawrapper did not process them). A POST that got a 5xx is still not repeated, since it may have created a chart and used quota.
  • OpenStreetMap lookups stay at one request per second, also under concurrent calls on the shared HTTP server: request slots are handed out in order instead of racing on a timestamp, waiting stops when the call is cancelled, and lookups go through the server's injected fetch.
  • Caches evict the least recently used entry; overwriting a key no longer evicts another one. When several calls wait for the same basemap or boundary, cancelling one no longer cancels the shared request for the others (it stops only when every caller has given up).
  • Region matching loads the values of all basemap keys in parallel, folds them once per key, and computes spelling suggestions only for the first 25 unmatched values (the ones tools show).
  • Input limits: data.csv up to 5,000,000 characters, data.rows and each data.columns array up to 50,000 entries, at most 1,000 columns; hide_columns, show_columns and column_types up to 1,000 entries, axes up to 50 roles, custom_fields up to 100 fields. Larger input is rejected with a hint before anything reaches Datawrapper. /mcp on the HTTP server accepts bodies up to 12 MB (413 with a JSON-RPC error above).

Quota

  • Publishing reuses the last preview. A publish only bumps publicVersion, lastModifiedAt and the stored embed codes (verified live), so publish_chart now renders the chart as it was before publishing and gets the image from the preview cache instead of spending an extra export.
  • Copying more than 5 charts asks first. copy_chart with more than 5 chart_ids and copy_folder on folders with more than 5 charts show a confirmation dialog naming the number of create operations (or take user_confirmed: true after the user agreed).
  • A 402 from Datawrapper explains that the monthly API quota is used up and when it resets.

Fixes

  • search_charts resolves type aliases (type: "bar" finds d3-bars charts); before, only exact type ids matched.
  • get_chart with include: ["embed"] no longer fails as a whole when the embed codes cannot be loaded.
  • When Datawrapper cannot fetch a new external data URL right away, create_chart / update_chart say so in a warning instead of staying silent.
  • match_regions reports a basemap without region keys clearly instead of failing with a TypeError.
  • Tool annotations: update_chart and publish_chart are no longer marked idempotent (annotations append, every publish is a new version), and export_chart is no longer marked read-only (save_to writes files).
  • Invalid numbers in PORT, RATE_LIMIT_PER_MINUTE, TRUST_PROXY_HOPS or STATS_MIN_COUNTRY_USERS log a warning and use the default; before, a value such as RATE_LIMIT_PER_MINUTE=abc silently turned rate limiting off.
  • The export timeout message names the configured timeout instead of always “2 minutes”.
  • README: DW_PREVIEW=auto behaves like always (it did already); options were learned from ~2,500 public charts (not ~3,000).

Internal

  • Shared chartId, user_confirmed and confirmation handling in src/tools/util.ts; removed unused helpers; .scratch/ and .claude/worktrees/ are git-ignored, and local tooling folders stay out of the Docker build context.