feat(mcp): auto-generate interactive widget from JSON data (#2076)

* feat(mcp): auto-visualize JSON data via widget agent

When McpDataPanel receives JSON results and widget key is configured,
automatically pipe the data through the widget agent to generate an
interactive HTML visualization instead of showing raw JSON.

- Uses pro tier (Chart.js iframe) if wm-pro-key is set, basic (SVG/CSS)
  otherwise
- Caches generated HTML by content hash to avoid regenerating on refresh
  cycles when data hasn't changed
- Falls back to raw JSON display on error or if widget not configured
- Shows radar loading animation during generation

* fix(mcp): always use pro tier for auto-visualization

MCP panel is a PRO-only feature, so auto-visualization always uses
pro tier (Chart.js iframe, full interactivity) with X-Pro-Key header.
Removes basic tier fallback path that was incorrect.
This commit is contained in:
Elie Habib
2026-03-23 00:46:45 +04:00
committed by GitHub
parent 658495cfb6
commit a09d6da758
3 changed files with 156 additions and 2 deletions

View File

@@ -20372,6 +20372,50 @@ body.has-breaking-alert .panels-grid {
margin: 0;
}
.mcp-panel-visualizing {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 10px;
min-height: 120px;
opacity: 0.7;
}
.mcp-vis-label {
font-size: 12px;
color: var(--text-muted);
}
.mcp-panel-widget {
padding: 0 !important;
overflow: hidden;
display: flex;
flex-direction: column;
}
.mcp-panel-widget .wm-widget-shell {
flex: 1;
display: flex;
flex-direction: column;
min-height: 240px;
}
.mcp-panel-widget .wm-widget-body,
.mcp-panel-widget .wm-widget-generated {
flex: 1;
overflow-y: auto;
padding: 8px 10px;
}
.mcp-panel-widget iframe {
width: 100%;
min-height: 260px;
border: none;
display: block;
flex: 1;
}
/* ── MCP Presets ───────────────────────────────────── */
.mcp-presets-section {
display: flex;