Skip to content

mcp-data-platform-v1.40.1

Choose a tag to compare

@github-actions github-actions released this 12 Mar 16:43
· 259 commits to main since this release
2b58b6a

Asset Thumbnail System

This release adds automatic thumbnail generation for portal assets and fixes a bug that prevented thumbnails from being captured.

New: Client-Side Thumbnail Capture (#232)

Assets that support visual preview (HTML, JSX, Markdown, SVG) now get automatic PNG thumbnails. The My Assets page displays these as a card grid with 4:3 thumbnail previews instead of the previous text-only list.

How it works:

  • HTML/JSX assets render in a sandboxed iframe; the parent captures the content using the bundled html2canvas library
  • Markdown assets render with ReactMarkdown and are captured using html-to-image
  • SVG assets are sanitized with DOMPurify, rendered inline, and captured using html-to-image
  • A background queue on the My Assets page detects assets missing thumbnails and processes them one at a time
  • Viewing a single asset also triggers thumbnail generation if one is missing
  • Updating asset content automatically clears the old thumbnail so a fresh one is generated on next view

Backend:

  • New database migration (000020_portal_asset_thumbnails) adds thumbnail_s3_key column to portal_assets
  • New endpoints on both portal and admin routers:
    • PUT /assets/{id}/thumbnail — upload PNG thumbnail (max 512 KB, image/png only)
    • GET /assets/{id}/thumbnail — retrieve thumbnail with appropriate Cache-Control headers
  • Thumbnail S3 key is derived from the asset's existing S3 key (same directory, filename thumbnail.png)
  • AssetUpdate.ThumbnailS3Key uses *string to distinguish "no change" (nil) from "clear" (pointer to empty string)

Frontend:

  • ThumbnailGenerator — hidden off-screen component with two capture strategies (iframe for HTML/JSX, DOM for Markdown/SVG)
  • ThumbnailQueue — background processor that finds assets without thumbnails and captures them sequentially; tracks processed IDs to prevent duplicate work on refetch
  • 15-second capture timeout with onFailed callback prevents the queue from stalling if a capture hangs
  • My Assets page redesigned as a card grid with content type badges and share indicators overlaid on thumbnails
  • New npm dependencies: html2canvas, html-to-image

Fix: Thumbnail Capture Never Fired (#233)

The iframe sandbox was set to allow-scripts allow-same-origin (required for html2canvas to access contentDocument), but the postMessage origin validation still checked for "null". With allow-same-origin, blob: iframes inherit the parent's origin, so every thumbnail-ready message was silently rejected. Changed the check to window.location.origin.

Files Changed

Area Files
Backend (portal) pkg/portal/handler.go, pkg/portal/types.go, pkg/portal/store.go
Backend (admin) pkg/admin/assets.go
Migration pkg/database/migrate/migrations/000020_portal_asset_thumbnails.{up,down}.sql
Frontend (capture) ui/src/lib/thumbnail.ts, ui/src/components/ThumbnailGenerator.tsx, ui/src/components/ThumbnailQueue.tsx
Frontend (UI) ui/src/pages/assets/MyAssetsPage.tsx, ui/src/components/AssetViewer.tsx
Frontend (API) ui/src/api/portal/client.ts, ui/src/api/portal/hooks.ts, ui/src/api/portal/types.ts
Tests pkg/portal/handler_test.go, pkg/portal/store_test.go, pkg/admin/assets_test.go

Upgrade Notes

  • Database migration required: Run migrations to add the thumbnail_s3_key column. Thumbnails will generate automatically as users visit their assets.
  • No configuration changes needed: Thumbnail storage uses the existing S3 bucket and derives keys from the asset's content key.

Installation

Homebrew (macOS)

brew install txn2/tap/mcp-data-platform

Claude Code CLI

claude mcp add mcp-data-platform -- mcp-data-platform

Docker

docker pull ghcr.io/txn2/mcp-data-platform:v1.40.1

Verification

All release artifacts are signed with Cosign. Verify with:

cosign verify-blob --bundle mcp-data-platform_1.40.1_linux_amd64.tar.gz.sigstore.json \
  mcp-data-platform_1.40.1_linux_amd64.tar.gz