본문으로 건너뛰기
Skillpedia
웹사이트 및 UI (프런트엔드)6.2k · #14398

mcp-artifact-integration

하는 일

이 스킬은 MCP를 통해 Lightdash를 호출하고 쿼리 결과를 보여 주는 웹 아티팩트를 만드는 방법을 설명합니다. 실시간 Lightdash 데이터를 보여 주는 사용자 정의 페이지나 앱을 만드는 개발자를 위한 스킬입니다.

사용하는 경우

  • ✓Lightdash 쿼리 결과를 보여 주는 웹 페이지를 만들고 싶을 때.
  • ✓아티팩트에서 Lightdash 쿼리의 로딩, 오류, 빈 상태를 처리해야 할 때.
  • ✓Lightdash 쿼리에서 CSV 데이터로 대체하고 싶을 때.

스킬 링크

https://github.com/lightdash/lightdash/blob/main/packages/backend/src/ee/services/ai/skills/builtInSkills/mcp-artifact-integration/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/lightdash/lightdash/blob/main/packages/backend/src/ee/services/ai/skills/builtInSkills/mcp-artifact-integration/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“이 Lightdash 지표 쿼리의 결과를 표로 보여 주는 HTML 아티팩트를 만들어 주세요. 로딩 상태와 오류 상태도 넣어 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

스킬은 쿼리를 시작하고, 쿼리 ID를 보관하며, 결과를 폴링하는 방법을 설명합니다. 구조화된 콘텐츠와 오류 플래그를 포함해 응답을 읽고, 각 상태를 올바르게 보여 주는 방법을 설명합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 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 inspect structuredContent.result.status: terminal query statuses can arrive without isError.
  • _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

  1. Start the query once with run_sql or run_metric_query.
  2. Check isError first. For structured results, branch on result.status.
  3. running: retain the returned queryUuid, show "Query still running…", wait nextPollAfterMs, then call get_query_result with 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.
  4. done: stop polling and render the data. An empty rows array is successful completion with zero rows, not a parsing failure.
  5. error, cancelled or expired: stop polling and display the returned error/status. These can be normal MCP results without isError: 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

자주 묻는 질문

새 엔드포인트를 추가하나요?

아니요, 스킬은 기존 데이터 계약을 설명하며 엔드포인트나 SDK를 추가하지 않습니다.

어떤 쿼리 도구를 써야 하나요?

시맨틱 레이어가 답할 수 있는 질문에는 지표 쿼리 도구를, 그 밖의 읽기 전용 쿼리에는 SQL 도구를 사용합니다.

일반 채팅에도 필요한가요?

아니요, 일반 채팅이나 Lightdash의 내장 차트 앱에는 필요하지 않다고 설명에 나와 있습니다.

상세 정보

작성자의 원본 설명

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

인기도

GitHub 스타
6.2k
순위
#14398
라이선스
—
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬