Ggui

The universal interface layer between AI agents and humans. Generate rich UIs on demand via MCP.

ggui-ai
by ggui-ai
Coding · Apache-2.0 · TypeScript · Updated: 6 months ago
16
stars
0
Forks
community
BBB
Safety
medium
BBB
Quality
agent-frameworkagent-uiagentsaigenerative-uillmmcpmodel-context-protocolreactsdktypescriptui-generation

🚧 Active development — v0.1.0-alpha shipping imminently. APIs are converging; pin exact versions and watch Releases for the first alpha tag.


Agents describe what they need in natural language; ggui generates ephemeral, interactive interfaces over MCP. No frontend code, no React templates, no custom components — agents talk, users see UI.

This repo is the open protocol + reference runtime. Self-host with ggui serve; pair against any MCP-aware agent runtime (Claude Desktop, Claude Code, Cursor, ChatGPT desktop, Goose, your own). Zero Guuey account required, zero managed infrastructure required, zero cloud dependency.

Quickstart

# Scaffold a minimal OSS server + agent entry
npm create ggui-server@latest my-app
cd my-app
npm install

# Boot the MCP server
npx ggui serve     # binds 127.0.0.1:6781 by default

ggui serve stands up @ggui-ai/mcp-server with the first-run bundle: MCP at /mcp, the same-origin session viewer at /s/<shortCode>, pairing endpoints, and a channel-3 WebSocket. Open http://127.0.0.1:6781/ to land on the operator console.

Point any MCP-compatible agent runtime at http://127.0.0.1:6781/mcp with Authorization: Bearer dev. The OSS Quickstart walks through the full self-hosted path including pairing.

Honest scope today

How it works

┌─────────┐     MCP Tools      ┌──────────┐     WebSocket     ┌──────────┐
│  Your   │ ────────────────→  │  ggui    │ ────────────────→ │  User's  │
│  Agent  │   ggui_push        │  server  │   real-time UI    │  browser │
│         │   ggui_update      │          │   updates         │          │
│         │ ←────────────────  │          │ ←──────────────── │          │
│         │   user events      │          │   clicks, forms   │          │
└─────────┘                    └──────────┘                   └──────────┘

Your agent uses MCP tools to push UIs and receive user events. The protocol is defined by @ggui-ai/protocol; the reference server lives in @ggui-ai/mcp-server; embedding primitives ship in @ggui-ai/react.

MCP tools (primary surface)

Tool Description
ggui_push Push a UI to the user (natural-language prompt + data)
ggui_update Update props on an existing UI (no regeneration, ~200ms)
ggui_handshake Initial session bootstrap

Plus a blueprint family (ggui_search_blueprints, ggui_render_blueprint, ggui_validate_blueprint, …) for catalogue lookups. Full reference: MCP Protocol Reference.

Zero agent code (MCP config only)

If your agent runtime supports MCP natively, skip the SDK entirely. Add ggui serve as an MCP server:

{
  "mcpServers": {
    "ggui": {
      "url": "http://127.0.0.1:6781/mcp",
      "headers": { "Authorization": "Bearer dev" }
    }
  }
}

The runtime's native tool-calling loop discovers ggui_push, ggui_update, and the blueprint catalogue tools directly. Working examples per framework: Claude, OpenAI, Gemini, generic MCP.

Embedding UIs

<McpAppIframe> is the canonical consumer primitive. It takes an MCP Apps resource and mounts the ggui session inside a same-origin iframe. The iframe owns the WebSocket lifecycle, renderer bundle, and stack rendering — host code does not touch StackItem / WebSocket / renderer internals.

import { McpAppIframe, type ProtocolError } from "@ggui-ai/react";
import { useEffect, useState } from "react";

function App({ sessionId }: { sessionId: string }) {
  const [resource, setResource] = useState<{ uri: string; mimeType: string; text: string } | null>(
    null
  );

  useEffect(() => {
    // Fetch the session-resource envelope from your MCP host —
    // OSS path: GET http://127.0.0.1:6781/s/<shortCode>/resource
    fetchSessionResource(sessionId).then((r) => setResource(r.contents[0]));
  }, [sessionId]);

  if (!resource) return <p>Loading…</p>;

  return <McpAppIframe resource={resource} onError={(err: ProtocolError) => console.error(err)} />;
}

Implementer references for the full protocol: Architecture overview, MCP Apps support, WebSocket protocol.

For non-React frameworks, embed the viewer directly:

<iframe src="http://127.0.0.1:6781/s/{shortCode}" width="100%" height="600"></iframe>

Packages

Consumer-facing surface — what you npm install:

Package Purpose npm
@ggui-ai/cli The ggui binary — ggui serve, ggui dev, ggui pair npm
@ggui-ai/mcp-server Reference OSS server (programmatic embedding) npm
@ggui-ai/server Agent server — receives events, dispatches MCP npm
@ggui-ai/react React embedding — <McpAppIframe> + shells npm
@ggui-ai/protocol Wire types (events, sessions, WebSocket, MCP envelopes) npm
create-ggui-server Scaffold — npm create ggui-server@latest npm

Plus 11 supporting packages (@ggui-ai/wire, @ggui-ai/shared, @ggui-ai/agent-runtime, @ggui-ai/dev-stack, @ggui-ai/console, @ggui-ai/design, @ggui-ai/preview-a2ui, @ggui-ai/mcp-server-core, @ggui-ai/mcp-server-handlers, @ggui-ai/project-config, @ggui-ai/ui-registry) — see each subdirectory for details.

Hosted providers

Self-hosting is the primary path. If you'd prefer managed infrastructure (no server to run, no LLM key to wire, hosted dashboards), Guuey is the first-party hosted provider built on this protocol. The OSS protocol is identical on both paths — you can move between self-hosted and hosted without rewriting anything against this SDK.

Contributing

See CONTRIBUTING.md. Issues + PRs welcome.

License

Apache 2.0 — see LICENSE.

🔓 Sign in to unlock more
Sign in with GitHub