OpenClaw Agent
read as.md Install the ggui skill from ClawHub and any OpenClaw agent can generate interactive UIs from a natural-language prompt — forms, dashboards, wizards, anything the model can describe.
1. Install the skill
Section titled “1. Install the skill”clawhub install gguiThis drops the ggui MCP tool catalogue and skill prompt into your agent’s context.
2. Pick an endpoint
Section titled “2. Pick an endpoint”OSS / self-hosted — no signup. Run ggui serve --dev-allow-all locally (defaults to http://127.0.0.1:6781/mcp; see the OSS Quick Start); any bearer — use Bearer dev — authenticates in this mode. Local development only; default ggui serve requires a paired bearer.
3. Configure MCP
Section titled “3. Configure MCP”The skill ships an mcporter.json that wires this up automatically. For manual setup:
OSS ggui serve
{ "mcpServers": { "ggui": { "type": "http", "url": "http://127.0.0.1:6781/mcp", "headers": { "Authorization": "Bearer dev" } } }}Hosted ggui (coming soon) — the cloud endpoint is per-app, no /mcp suffix:
{ "mcpServers": { "ggui": { "type": "http", "url": "https://mcp.ggui.ai/apps/<appId>", "headers": { "Authorization": "Bearer ${GGUI_API_KEY}" } } }}Tool catalogue
Section titled “Tool catalogue”The skill exposes the ggui MCP tools — the agent never picks a blueprint by hand, the server’s matcher does that under the hood during handshake.
Core render loop
| Tool | Purpose |
|---|---|
ggui_handshake | Negotiate the wire surface for the next UI (returns a handshakeId). |
ggui_render | Materialize the UI (mints sessionId; accept the suggestion or override). |
ggui_consume | Long-poll for user gestures (form submits, button clicks). |
ggui_update | Patch a delivered render’s props without re-rendering. |
ggui_emit | Push frames onto a declared streamSpec channel (optional). |
Inspection
| Tool | Purpose |
|---|---|
ggui_get_session | Inspect render state. |
ggui_list_sessions | Enumerate this conversation’s sessions for resume (keyed by host-session). |
ggui_list_gadgets | Enumerate renderer-side capabilities (map tiles, charts, editors). |
ggui_list_themes | List theme presets the agent may apply via ggui_render({themeId}). |
Blueprint registry (optional)
| Tool | Purpose |
|---|---|
ggui_list_featured_blueprints | Browse curated blueprints the provider has featured. |
ggui_search_blueprints | Search the blueprint registry by keyword / intent. |
ggui_render_blueprint | Render a manifest-declared blueprint directly by id. |
The canonical flow is handshake → render → consume. Ask your OpenClaw agent:
“Collect feedback about the user’s recent purchase. Ask for a star rating and free-form comments.”
The agent will:
ggui_handshake({ intent, blueprintDraft })— get ahandshakeId+ a routedsuggestion(origin: cache / agent / synth).ggui_render({ handshakeId, props })— accept the suggestion as-is (or passoverride: { contract }/{ variance }to re-aim). Returns{ sessionId, resourceUri }— the render is an MCP-Apps resource a host mounts, not a URL.ggui_consume({ sessionId, timeout: 20 })— long-poll until the user submits; events arrive keyed byintent(your actionSpec key).
Renders decay implicitly via TTL — there is no explicit close ceremony.
Multi-step wizard
Section titled “Multi-step wizard”“Walk the user through a 3-step onboarding: personal info, preferences, confirmation.”
Each step is its own fresh ggui_handshake + ggui_render pair (each minting a new sessionId). Carry earlier answers forward by passing them as props on the next step’s ggui_render (declare the matching propsSpec entries in that step’s blueprintDraft) so the next prompt can prefill. See the Multi-step wizard cookbook for back-navigation patterns.
Live patches without a re-render
Section titled “Live patches without a re-render”“While the form is open, refresh the available time-slot list every 10s.”
Loop ggui_update({ sessionId, kind: "merge", patch: { slots } }) to mutate props in place (RFC 7396 JSON Merge Patch — null deletes a key). Use { kind: "replace", props } for a full props swap. No new render, no flicker.
How it works
Section titled “How it works”OpenClaw Agent ggui server User browser | | | |-- ggui_handshake ------->| | | (matcher picks cached | | | blueprint OR fires | | | synth — invisible) | | |<-- { handshakeId, -------| | | suggestion } | | |-- ggui_render({ -------->| | | handshakeId, props }) | | |<-- { sessionId, ---------| | | resourceUri } | | | |-- mounts resource ---->| | |---- render UI -------->| |-- ggui_consume --------->| | | |<--- submit form -------| |<-- { events } -----------| | | (render decays via TTL) | |Blueprints are an internal cache: the matcher checks them on every handshake. A cache hit returns near-instantly; a miss generates fresh React (expect seconds to ~a minute depending on model). The agent doesn’t pick — it just describes intent.
Patterns
Section titled “Patterns”- Describe intent, not markup. “A 3-question NPS survey” beats “a form with a slider, a textarea, and a submit button.”
- Pass data as
props, declared in the contract. Lists of options, prefilled values, the current user — declare them inblueprintDraft’s propsSpec and pass the values aspropsonggui_render, not in the intent string. - Fresh render per step. Each new screen is a fresh
handshake → renderpair with its ownsessionId. Prior renders decay via TTL. - Drain
ggui_consumein a loop. Events are cleared after consumption. Match on each event’sintent(your actionSpec key, e.g.submit); react, then re-call. Exit whenstatus: "expired".
Troubleshooting
Section titled “Troubleshooting”| Symptom | Fix |
|---|---|
Unauthorized | Local: run ggui serve --dev-allow-all (or pair a bearer). Hosted (coming soon): set GGUI_API_KEY. |
Session not found | Session expired (TTL elapsed) — re-handshake to mint a fresh one. |
Handshake required | You called ggui_render without a handshakeId — handshake first. |
Empty consume | User hasn’t interacted yet. Keep polling (long-poll up to ~20s). |
| Generation failed | Simplify the prompt. (Hosted only, coming soon: check your account has credits.) |
Next steps
Section titled “Next steps”- MCP Protocol Reference — wire-level tool catalogue
- Claude Agent — same flow, Claude SDK in TypeScript
- Generic MCP / Raw HTTP — language-agnostic version
- Feedback Form cookbook — end-to-end recipe with code
- Glossary — gadget vs tool vs blueprint