Skip to content

mcp-data-platform-v0.37.1

Choose a tag to compare

@github-actions github-actions released this 09 Mar 05:44
· 73 commits to main since this release
a6fee12

What's Changed

In-browser source editing for portal assets, plus admin assets search and owner visibility improvements (#208).

New Feature

Source editor in asset viewer

Users and admins can now view and edit the raw source of text-based assets (HTML, JSX, Markdown, SVG, plain text) directly in the browser. A Preview/Source tab toggle appears automatically for text-based content types, with an integrated code editor and Save button.

Editor capabilities:

  • CodeMirror 6 with language-aware syntax highlighting (JSX, HTML, Markdown, XML/SVG)
  • Lazy-loaded via React.lazy() to keep the main bundle small (~200KB gzip addition)
  • Dark mode support — detects theme from the document root class
  • Unsaved edits survive tab switches — switching between Preview and Source preserves your changes
  • Live preview — unsaved edits render in Preview mode before saving

New API endpoints (2):

Method Path Auth Description
PUT /api/v1/admin/assets/{id}/content Admin Replace asset S3 content
PUT /api/v1/portal/assets/{id}/content Owner only Replace asset S3 content

Both endpoints read raw request body via io.LimitReader (10 MB cap), upload to S3 at the existing bucket/key, and update size_bytes in the database.

Error handling:

Status Condition
401 No authenticated user (portal only)
403 Non-owner attempting update (portal only)
404 Asset not found
410 Asset has been soft-deleted
413 Content exceeds 10 MB
503 S3 not configured or S3 upload failure
500 Database update failure

Frontend components:

  • SourceEditor.tsx — new CodeMirror wrapper with automatic language detection
  • AssetViewer.tsx — new shared component extracted from both viewer pages, with Preview/Source tabs, Save button with status feedback, download, share, delete confirmation modal, and metadata sidebar
  • useUpdateAssetContent() and useAdminUpdateAssetContent() — new mutation hooks

Files: pkg/admin/assets.go, pkg/portal/handler.go, pkg/portal/types.go, ui/src/components/SourceEditor.tsx, ui/src/components/AssetViewer.tsx, ui/src/api/portal/hooks.ts, ui/src/api/admin/hooks.ts, ui/src/pages/viewer/AssetViewerPage.tsx, ui/src/pages/viewer/AdminAssetViewerPage.tsx

Improvements

Admin assets: unified search

The admin assets list endpoint replaces individual owner_id, content_type, and tag query params with a single search parameter. The search queries across name, description, owner email, and tags with server-side ILIKE filtering. The frontend search input is debounced (300ms).

Files: pkg/portal/store.go, ui/src/pages/assets/AdminAssetsPage.tsx, ui/src/api/admin/hooks.ts

Owner email on assets

A new owner_email column on portal_assets stores the authenticated user's email at asset creation time. This is displayed in the admin assets table and asset viewer instead of the opaque owner_id, improving admin visibility into who created each asset.

Migration: 000017_portal_assets_owner_email — adds owner_email TEXT NOT NULL DEFAULT ''

Files: pkg/portal/types.go, pkg/portal/store.go, pkg/toolkits/portal/toolkit.go, ui/src/api/portal/types.ts, ui/src/mocks/data/assets.ts

Viewer page refactor

Both AssetViewerPage and AdminAssetViewerPage were refactored from ~220 lines each down to ~30 lines by extracting the shared AssetViewer component. This eliminates duplicated viewer logic (sidebar, editing, delete modal, download, share dialog) and makes both viewers consistent.

Dependencies

  • @uiw/react-codemirror ^4.25.8 — React wrapper for CodeMirror 6
  • @codemirror/lang-html ^6.4.11
  • @codemirror/lang-javascript ^6.2.5
  • @codemirror/lang-markdown ^6.5.0
  • @codemirror/lang-xml ^6.1.0
  • @tailwindcss/typography ^0.5.19

Test Coverage

  • Admin handler (7 new tests): content update success, no S3, not found, soft-deleted asset, oversized content (413), S3 error, DB update error
  • Portal handler (9 new tests): content update success, no user, not found, deleted, not owner, oversized content (413), nil S3, S3 error, DB update error
  • Store (1 new test): applyAssetFilter with search parameter
  • Toolkit (1 new test): resolveOwnerEmail context extraction
  • Coverage: updateAdminAssetContent 92.3%, updateAssetContent 93.9%

CI

  • Bump docker/login-action from 3.7.0 to 4.0.0 (#204)

Stats

  • 27 files changed, 1,595 additions, 527 deletions (net -390 lines from viewer refactor)

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:v0.37.1

Verification

All release artifacts are signed with Cosign. Verify with:

cosign verify-blob --bundle mcp-data-platform_0.37.1_linux_amd64.tar.gz.sigstore.json \
  mcp-data-platform_0.37.1_linux_amd64.tar.gz