mcp-artifact-integration
Fungsinya
Skill ini menjelaskan cara membuat artefak web yang memanggil Lightdash melalui MCP dan menampilkan hasil kueri. Skill ini untuk pengembang yang menginginkan halaman atau aplikasi khusus yang menampilkan data Lightdash langsung.
Kapan dipakai
- ✓Saat Anda ingin membuat halaman web yang menampilkan hasil kueri Lightdash.
- ✓Saat Anda perlu menangani status memuat, galat, dan kosong untuk kueri Lightdash dalam artefak.
- ✓Saat Anda ingin kembali ke data CSV dari kueri Lightdash.
Link skill
https://github.com/lightdash/lightdash/blob/main/packages/backend/src/ee/services/ai/skills/builtInSkills/mcp-artifact-integration/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
“Buat artefak HTML yang menampilkan hasil kueri metrik ini sebagai tabel, lengkap dengan status memuat dan galat.”
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Skill menjelaskan cara memulai kueri, menyimpan ID-nya, dan memeriksa hasilnya secara berkala. Skill juga menjelaskan cara membaca respons, termasuk konten terstruktur dan penanda galat, serta cara menampilkan setiap status dengan benar.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari 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
Pertanyaan umum
Apakah skill menambahkan endpoint baru?
Tidak. Skill menjelaskan kontrak data yang sudah ada dan tidak menambahkan endpoint maupun SDK.
Alat kueri mana yang harus saya gunakan?
Gunakan alat kueri metrik untuk pertanyaan yang bisa dijawab lapisan semantik, dan alat SQL untuk kueri baca-saja lainnya.
Apakah ini diperlukan untuk obrolan biasa?
Tidak. Deskripsinya menyatakan ini tidak diperlukan untuk obrolan biasa atau aplikasi grafik bawaan Lightdash.
Detail
Deskripsi asli dari pembuat
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
Popularitas
- Bintang GitHub
- 6.2k
- Peringkat
- #14398
- Lisensi
- —
- Diperbarui
- 2/11/2026
Komentar
- …
Skill lain dari repositori ini
breakup-pr
6.2kMembantu agent Anda memecah pull request besar menjadi irisan kecil yang bertumpuk, sehingga bisa ditinjau dan digabung satu per satu.
lightdash-agent-slack-messaging
6.2kMembantu agent Anda menulis laporan pemeliharaan dan aktivitas yang jelas dan ramah untuk admin Lightdash, hanya berdasarkan bukti yang dimilikinya.
developing-in-lightdash
6.2kMembantu agent Anda membaca, membuat, dan mengedit dasbor serta grafik Lightdash dalam bentuk JSON, termasuk pengaturan setiap jenis grafik.
filter-expressions
6.2kMembantu agent Anda menulis ekspresi filter yang benar untuk kueri metrik Lightdash, termasuk filter pada metrik kustom.
Skill serupa
angular-developer
280kMembantu agent Anda membuat kode Angular dan memberi saran struktur proyek. Berguna saat memulai proyek baru, membuat komponen, atau meningkatkan performa.
frontend-a11y
280kMembantu agent Anda membuat antarmuka web dapat diakses semua orang. Memastikan website dan aplikasi berfungsi baik dengan screen reader dan navigasi keyboard.
frontend-patterns
280kMembuat agent Anda menerapkan pola modern dalam frontend. Mengoptimalkan performa, mengelola state, dan mengikuti praktik terbaik React dan Next.js.