mcp-artifact-integration
Was er macht
Dieser Skill erklärt, wie du eine Webseite baust, die über MCP mit Lightdash spricht und die Abfrageergebnisse anzeigt. Er ist für Entwickler gedacht, die eine eigene Seite oder App mit Live-Daten aus Lightdash wollen.
Wann du ihn nutzt
- ✓Wenn du eine Webseite bauen willst, die Lightdash-Abfrageergebnisse zeigt.
- ✓Wenn du Lade-, Fehler- und Leerzustände einer Lightdash-Abfrage in einem Artefakt behandeln musst.
- ✓Wenn du auf CSV-Daten aus einer Lightdash-Abfrage zurückfallen willst.
Link zum Skill
https://github.com/lightdash/lightdash/blob/main/packages/backend/src/ee/services/ai/skills/builtInSkills/mcp-artifact-integration/SKILL.mdKopiere ihn und füge ihn in deine KI ein (Claude, ChatGPT oder Cursor) mit der Bitte, den Anweisungen zu folgen.
So nutzt du ihn
Am einfachsten: Kopiere die Nachricht und füge sie in deine KI ein. Sie liest den Skill und folgt den Anweisungen.
Fertige Nachricht zum Einfügen
Für Claude Code, Codex oder Cursor: Führe den Befehl in deinem Projektordner aus, dann wird der Skill installiert.
Lade die SKILL.md herunter und lege sie in den Skills-Ordner deines Agenten.
Beispielanfrage an deine KI
“Baue ein HTML-Artefakt, das die Ergebnisse dieser Lightdash-Metrikabfrage als Tabelle zeigt, mit Lade- und Fehlerzuständen.”
5 neue Skills pro Woche. 1 Minute Lesezeit.
So funktioniert es
Der Skill erklärt, wie man eine Abfrage startet, ihre ID behält und das Ergebnis abfragt. Er beschreibt, wie die Antwort zu lesen ist, einschließlich strukturierter Inhalte und Fehlermarkierungen, und wie jeder Zustand richtig angezeigt wird.
Technischer Inhalt (originale SKILL.md)
Originaltext des Autors, auf Englisch, direkt von GitHub.
Lightdash query results in HTML/React artifacts
Use this skill when creating an HTML/React artifact or app that calls Lightdash through Model Context Protocol (MCP). It describes the existing data contract; it does not add a new endpoint, SDK or browser bridge.
Choose and start the query
Choose run_metric_query for questions expressible in the semantic layer. Discover field IDs with grep_fields / get_metadata, and supply required parameters explicitly: omitted parameters may silently use defaults. Use run_sql for other read-only SELECT queries in the warehouse's dialect. Read each tool's schema for its effective row limit; deployment configuration can change the maximum.
Call the query-start tool once. Keep its query UUID and original project/agent scope for subsequent polling. The artifact should track its own loading, success, empty and error states; a pending query is not an empty dataset.
Read the result envelope
A full MCP CallToolResult can contain:
content: an array of typed content blocks. Query tools put CSV or status/error text in the first text block. Additional blocks can contain an applied-parameters note,queryUuid: <id>,[Scope: ...]or a compatibility warning.structuredContent.result: the typed result, when exposed by the host. Prefer this over parsing CSV.isError: a tool failure flag. Check it, but also inspectstructuredContent.result.status: terminal query statuses can arrive withoutisError._meta: host/app metadata. Do not assume your artifact bridge exposes it.
Do not concatenate every content block into CSV. Do not parse an entire CallToolResult as row data. When the host exposes text only, follow the status text and parse only the data block with a real CSV parser (quoted delimiters, quotes and line breaks are legal). If the bridge discards necessary status or UUID information, show an integration error rather than guessing.
The companion result contracts gives the exact completed/running/terminal shapes and link semantics. Native MCP clients can read the resource; fallback clients can call read_skill_resource with name: "mcp-artifact-integration" and path: "resources/result-contracts.md".
Poll without re-executing
- Start the query once with
run_sqlorrun_metric_query. - Check
isErrorfirst. For structured results, branch onresult.status. running: retain the returnedqueryUuid, show "Query still running…", waitnextPollAfterMs, then callget_query_resultwith that same UUID and scope. Text-only clients use the UUID and wait instructions in the returned text. Never invent an ID or restart the original query to check progress.done: stop polling and render the data. An emptyrowsarray is successful completion with zero rows, not a parsing failure.error,cancelledorexpired: stop polling and display the returned error/status. These can be normal MCP results withoutisError: true.
Both the initial query-start call and each polling call can wait up to approximately 50 seconds server-side. Allow for that in the host bridge's timeout. This is not the warehouse execution timeout; warehouse timeouts come from the Lightdash connection. heartbeatAt records the latest Lightdash check that confirmed the query was still running, not a warehouse progress percentage.
If a polling call loses its connection or times out, retry only get_query_result with the same UUID, using bounded retries/backoff. Avoid overlapping polls; stop on terminal state, artifact teardown or user cancellation. Stopping local polling does not cancel warehouse execution. Ignore stale responses if the user starts a different query while an earlier call is in flight.
If the initial query-start call loses its response before you receive a UUID, do not automatically resubmit: the warehouse may already be executing it. Report that the outcome is unknown; a retry can duplicate execution.
Validation failures should be corrected before another query is started. Application/warehouse errors are terminal until corrected; do not put them into the transient polling retry loop.
Build your artifact's own visualization
Use completed query rows as data for your HTML table or React chart library. For metric results, rows use stable field IDs and fields provides metadata; CSV headers instead use display labels. Keep stable IDs for data access, use labels for presentation, and do not treat labels as un
Häufige Fragen
Fügt er einen neuen Endpunkt hinzu?
Nein, der Skill beschreibt den vorhandenen Datenvertrag und ergänzt keinen Endpunkt oder SDK.
Welches Abfragewerkzeug soll ich nutzen?
Nutze das Metrikabfrage-Werkzeug für Fragen, die die semantische Schicht beantworten kann, und das SQL-Werkzeug für andere reine Lesezugriffe.
Brauche ich das für den normalen Chat?
Nein, laut Beschreibung ist es nicht für den normalen Chat oder die eingebaute Diagramm-App von Lightdash nötig.
Details
Originalbeschreibung des Autors
Integrate Lightdash MCP query results into Claude-created HTML or React artifacts. Covers host bridges, response envelopes, polling, errors, CSV fallback and chart data. Not needed for ordinary chat or Lightdash's built-in chart app.
repo: lightdash/lightdash
Beliebtheit
- GitHub-Sterne
- 6.2k
- Platz im Ranking
- #14398
- Lizenz
- —
- Aktualisiert
- 2.11.2026
Kommentare
- …
Weitere Skills aus diesem Repository
breakup-pr
6.2kHilft deinem Agenten, einen großen Pull Request in kleinere, gestapelte Teile zu zerlegen, die einzeln geprüft und zusammengeführt werden können.
lightdash-agent-slack-messaging
6.2kHilft deinem Agenten, klare und freundliche Wartungs- und Aktivitätsberichte für Lightdash-Administratoren zu schreiben, nur auf Basis der vorhandenen Belege.
developing-in-lightdash
6.2kHilft deinem Agenten, Lightdash-Dashboards und -Diagramme als JSON zu lesen, zu erstellen und zu bearbeiten, einschließlich der Einstellungen jedes Diagrammtyps.
filter-expressions
6.2kHilft deinem Agenten, korrekte Filterausdrücke für Lightdash-Metrikabfragen zu schreiben, auch für Filter auf eigene Kennzahlen.
Ähnliche Skills
angular-developer
280kHilft deinem Agenten bei Angular-Code und gibt Tipps zur Projektstruktur. Nützlich für neue Projekte, einzelne Code-Teile sowie Performance und Barrierefreiheit.
frontend-a11y
280kHilft deinem Agenten, Weboberflächen für alle zugänglich zu machen. Sorgt dafür, dass Websites und Apps gut mit Screenreadern und Tastaturnavigation funktionieren.
frontend-patterns
280kLässt deinen Agenten moderne Muster in der Frontend-Entwicklung anwenden. Optimiert Performance, verwaltet State und folgt Best Practices für React und Next.js.