Saltar al contenido
Skillpedia
Sitios e interfaces (frontend)6,2 mil · #14398

mcp-artifact-integration

Qué hace

Esta skill explica cómo crear un artefacto web que llame a Lightdash a través de MCP y muestre los resultados de la consulta. Está pensada para desarrolladores que quieren una página o una aplicación a medida que muestre datos de Lightdash en directo.

Cuándo usarla

  • ✓Cuando quieres crear una página web que muestre los resultados de una consulta de Lightdash.
  • ✓Cuando necesitas gestionar los estados de carga, error y vacío de una consulta de Lightdash en un artefacto.
  • ✓Cuando quieres usar datos CSV de una consulta de Lightdash como alternativa.

Link de la skill

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

Cópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.

Cómo usar

La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.

Mensaje listo para pegar

Usa esta skill para ayudarme: https://github.com/lightdash/lightdash/blob/main/packages/backend/src/ee/services/ai/skills/builtInSkills/mcp-artifact-integration/SKILL.md Lee el archivo SKILL.md de ese link y sigue sus instrucciones en mi tarea.
¿Quieres que tu IA encuentre skills como esta por sí sola?Instala el MCP gratis de Skillpedia: una línea, y busca entre 15.000+ skills antes de cada tarea.Instalar en 1 minuto →

Ejemplo de qué pedirle a la IA

“Crea un artefacto HTML que muestre los resultados de esta consulta de métricas de Lightdash en una tabla, con estados de carga y de error.”

5 skills nuevas por semana. 1 minuto de lectura.

Cómo funciona

La skill explica cómo iniciar una consulta, guardar su ID y consultar el resultado repetidamente hasta obtenerlo. Describe cómo leer la respuesta, incluidos el contenido estructurado y los indicadores de error, y cómo mostrar correctamente cada estado.

Contenido técnico (SKILL.md original)

Texto original del autor, en inglés, directo de 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

Preguntas frecuentes

¿Añade un nuevo endpoint?

No. La skill describe el contrato de datos existente y no añade ningún endpoint ni SDK.

¿Qué herramienta de consulta debo usar?

Usa la herramienta de consulta de métricas para preguntas que la capa semántica puede responder, y la herramienta SQL para otras consultas de solo lectura.

¿Hace falta para un chat normal?

No. La descripción indica que no hace falta para un chat normal ni para la aplicación de gráficos integrada de Lightdash.

Detalles

Descripción original del autor

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

Popularidad

Estrellas en GitHub
6,2 mil
Posición en el ranking
#14398
Licencia
—
Actualizada
2/11/2026

¿Te sirve esta skill?

0

Entra para votar.

Comentarios

  • …

Más skills de este repositorio

Skills parecidas