# How to expose an AI UI generator through MCP

A practical guide to exposing AI-generated UI through MCP with structured A2UI output, OpenAPI discovery, markdown docs, and reusable React export artifacts.

## Define the generated interface contract

Start with a constrained payload instead of raw HTML or raw JSX. Gravity AI UI uses a composed A2UI component tree so the server can validate nodes, props, data bindings, and surface updates before anything renders.

## Publish agent-readable discovery

Expose predictable docs for agents: an MCP server card, tools/list support, OpenAPI, llms.txt, markdown guides, and canonical public URLs. The goal is to let an assistant evaluate and call the generator without scraping the app.

## Return reusable UI artifacts

A useful MCP UI generator should return structured content, generated interface metadata, A2UI messages, and a React export. Gravity AI UI keeps those artifacts close to every generated surface.

## Keep public and private context separate

Public gallery pages can expose title, summary, thumbnail, canonical URL, React export, and retrieval context. Private prompt history should stay private unless the user explicitly publishes it.

## Agent resources

- Canonical page: https://gravity-ai.ydb-qdrant.tech/guides/mcp-ui-generator
- OpenAPI spec: https://gravity-ai.ydb-qdrant.tech/openapi.json
- MCP server: https://gravity-ai.ydb-qdrant.tech/mcp
- MCP docs: https://gravity-ai.ydb-qdrant.tech/mcp.md
- llms.txt: https://gravity-ai.ydb-qdrant.tech/llms.txt
- Best AI UI generator guide: https://gravity-ai.ydb-qdrant.tech/best-ai-ui-generator-for-agents