# MUP — Model UI Protocol [![GitHub Stars](https://img.shields.io/github/stars/Ricky610329/mup?style=social)](https://github.com/Ricky610329/mup/stargazers) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE) [繁體中文](README.zh-TW.md) > Bring interactive UI into LLM chat — so anyone can experience agentic AI, not just developers. Current version: 0.2.11 | Protocol: `mup/2026-03-17` ## Demos The recordings below were made with the [standalone agent](#standalone-agent) and a real model; the interface is in Traditional Chinese. Each starts from one typed message. Where "the person" clicks or taps, the clicks are sent by the recording script (`scripts/agent-tasks.mjs`) as real mouse events, shown with a drawn pointer. ### Chess — you move, the AI answers by itself ![Chess: the person plays e4 by clicking the board, the AI answers e5 on its own, then Nf3 and Nc6](docs/images/chess-exchange.gif) The person plays e4 and then Nf3 by clicking the board; each move is reported to the AI at once, and it answers e5 and Nc6 without another message being typed. Real time, Claude Haiku 5.5. ### The AI makes a new MUP, then uses it ![The AI writes a prize-wheel MUP, fills in four options and spins it](docs/images/wheel-built-and-spun.gif) Asked for a small prize wheel, the AI reads the authoring guide, writes the MUP, has it validated and loaded, fills in four lunch options and spins it (Claude Sonnet 5.5 at medium effort, `npm run agent:builder`). In this recording the MUP was loaded and checked 34.9 s after the message was sent and usable with the four options at 36.3 s. The writing step (about 30 s) is shown 8× faster in the GIF; everything else is real time. ### More, from the same recordings | | | |---|---| | ![Star map: Orion marked over Tainan at 21:00, Alnilam selected](docs/images/star-map.jpg)
**星圖 (star map)** — the AI sets a place and time and marks Orion; the person taps a star and the AI names it. | ![Slides: a six-slide deck on the pomodoro method, a table slide in the editor](docs/images/slides.jpg)
**簡報 (slides)** — the AI builds a six-slide deck with a chart and a table; the highlighter yellow marks what it just changed. | | ![PDF reader: the grading table of a sample syllabus with one row framed](docs/images/pdf-reader.jpg)
**PDF 閱讀器 (PDF reader)** — the AI reads a made-up syllabus, answers from it and frames the row. | ![Markdown notes: a reading-group note with a comparison table, a to-do list and a margin note](docs/images/markdown-notes.jpg)
**筆記 (notes)** — the AI writes a note with a table and a to-do list, then adds a margin note. | | ![Diagram: five-node shopping-system architecture](docs/images/diagram.jpg)
**流程圖 (diagram)** — five nodes and four arrows, laid out by the MUP. | ![Sticky notes: nine ideas sorted into three named groups](docs/images/sticky-notes.jpg)
**便利貼 (sticky notes)** — nine ideas sorted into three named, coloured groups. | | ![Pixel board: a red heart on a light-blue 16 by 16 canvas](docs/images/pixel-art.jpg)
**像素畫板 (pixel board)** — a 16×16 heart, checked in the preview before the AI answers. | ![Timer: a six-second countdown that has reached zero](docs/images/timer.jpg)
**計時器 (timer)** — when the countdown ends the AI speaks first, without being asked. | --- ## What is MUP? A **MUP** is an interactive UI component that lives inside an LLM chat interface. (Earlier documents and some code names call it a "panel".) It bundles a visual interface with callable functions. The user operates it by clicking buttons; the LLM operates it through function calls. Both sides see each other's actions: what the user does in a MUP is reported back to the LLM. The simplest MUP is a single `.html` file — no build step, no framework, no SDK. ## Why? Agentic AI is powerful, but today it's trapped behind text commands and developer tools. Most people never get to experience it. MUP changes this. It puts clickable, visual UI right inside the chat — so anyone can use agentic capabilities without writing a single prompt. | | Traditional Chat | With MUP | |---|---|---| | **User interaction** | Type text commands | Click buttons, drag sliders, see live visuals | | **Tool results** | Hidden from user, only the LLM sees them | Visible and interactive for both sides | | **Who can use it** | Power users who know the right prompts | Anyone | ## Key Ideas - **Shared functions.** A function can be called by the LLM (as a tool) or triggered by the user (via UI). Both sides operate on the same state through the same code. - **LLM as orchestrator.** MUPs don't talk to each other. The LLM reads outputs and decides what to do next. - **Just HTML.** Write a manifest, register your functions, done. Ship a single file. - **Real-time actions.** What the user does is queued for the LLM by default. A MUP can list the few actions that need an answer now (a chess move, a finished timer, a selection) in `notifications.immediate`; the [standalone agent](#standalone-agent) hands those to the model at once. The MCP server does not apply that field yet. See the [spec](spec/MUP-Spec.md). - **Layout hints.** A manifest may give `grid.maxWidth`, `grid.maxHeight` and `grid.aspectRatio`, so the dashboard can tile MUPs to fill the screen without stretching a timer or squashing a chessboard. ## Available MUPs Thirteen MUPs in [`mups/`](mups/), plus the built-in Chat. The names are what the dashboard shows (Traditional Chinese). | MUP | ID | What it does | |---|---|---| | **簡報** (slides) | `mup-slides` | Slide-deck editor: six themes, four aspect ratios, bar/line/pie charts, tables, speaker notes, a presentation mode inside the MUP, HTML export | | **PDF 閱讀器** (PDF reader) | `mup-pdf-reader` | Scrolling PDF viewer: page text, search, region selection and capture as an image | | **筆記** (notes) | `mup-markdown` | Markdown notes with a file list, editor, preview and annotations (highlight, note, to-do, question, important) | | **便利貼** (sticky notes) | `mup-notes` | Sticky-note board with colours, named groups and export | | **進度追蹤** (progress) | `mup-progress` | Step tracker: waiting, running, completed or failed, with progress and an overall bar | | **計時器** (timer) | `mup-timer` | Styleable countdown timer; the end is reported to the AI at once | | **流程圖** (diagram) | `mup-diagram` | Auto-laid-out node-and-edge diagrams (flowcharts, mind maps, architectures) with tree, horizontal, swimlane and force layouts | | **語音對話** (voice) | `mup-voice` | Talk and listen: OpenAI speech through the standalone agent, the browser's own speech elsewhere | | **鼓機** (drum machine) | `mup-sound-pad` | 16-pad drum machine and step sequencer with named sections, synthesised in the browser | | **和弦鍵盤** (chord keyboard) | `mup-chord-pad` | Chord and melody instrument: three-octave keyboard, five voices, a timeline of chords and melody | | **西洋棋** (chess) | `mup-chess` | Chess with the full rules (legal moves, check, checkmate, stalemate, castling, en passant, promotion, draws); SAN, FEN and PGN; the person's move is reported at once | | **像素畫板** (pixel board) | `mup-pixel-art` | Pixel canvas from 4 to 64 pixels per side, 16-colour palette, shapes, patterns, PNG export | | **星圖** (star map) | `mup-star-map` | Planetarium for a place and time: 325 named stars, 39 constellations, 17 deep-sky objects, ecliptic and Milky Way (no Moon or planets) | More examples, from earlier versions, are in [`archive/examples/`](archive/examples/) (games, productivity, etc.). ## Focused Development For iteratively building a single MUP with Claude (edit `.html` → Chrome hot reloads → user interacts → channel pushes back to Claude → repeat), see [`mup-mini-mcp-server`](mup-mini-mcp-server/) — a scaffolding-style sibling that loads exactly one MUP and provides only the plumbing: hot reload, WebSocket bridge, and channel push. No catalog, no grid, no extras. ## Docs - **[Spec](spec/MUP-Spec.md)** — Protocol definition: manifest, functions, lifecycle, error handling - **[Design Philosophy](spec/MUP-Philosophy.md)** — Why MUP is designed this way, and what we intentionally left out - **[Examples](spec/MUP-Examples.md)** — Example MUPs with walkthroughs - **[Interface design standard](docs/DESIGN.md)** — Version 3: a quiet, near-monochrome interface in which highlighter yellow marks only what the AI did; the standard every MUP in `mups/` follows - **[Review report](docs/REVIEW.md)** — Fixes and validation scope (in Traditional Chinese) ## Install ### npm (recommended) ```bash npm install -g mup-mcp-server ``` Or run directly: ```bash npx mup-mcp-server --mups-dir ./my-mups ``` Also available on the [MCP Server Registry](https://registry.modelcontextprotocol.io/). The npm package does not include the MUPs in `mups/` or the dev tools. For those, and for `npm run agent`, work from a clone of this repository. ### From source ```bash git clone https://github.com/Ricky610329/mup.git cd mup npm run setup # install and build both servers ``` ## Standalone agent `mup-agent` is a host that needs no MCP client: it talks to the Anthropic or OpenAI API directly, and you chat with it in the dashboard's chat column. It opens MUPs on request and works them with function calls. ```bash cp .env.example .env # then fill in the key (and model) for the provider you use npm run setup # once npm run agent # builds and starts it with ./mups; the dashboard opens in your browser npm run agent:builder # the same, and the agent can also make new MUPs on request (Claude Sonnet 5.5) ``` - **Providers.** Pick one with `MUP_AGENT_PROVIDER=anthropic|openai|fake` in `.env` or `npm run agent -- --provider fake` (the command line wins). `fake` is a scripted offline provider that needs no key. The default Anthropic model is Claude Haiku 5.5 at high effort; `--model` and `--effort` override it for one run. Replies are streamed as they are written with the Anthropic provider; the OpenAI provider returns each reply whole. - **Keys.** `ANTHROPIC_API_KEY` is required for `anthropic` (`ANTHROPIC_MODEL` and `ANTHROPIC_EFFORT` are optional). `OPENAI_API_KEY` and `OPENAI_MODEL` are both required for `openai`. - **`.env`** is read from the current directory, then the repository root; real environment variables are never overridden. `.env` is git-ignored. - **Other options:** `--port `, `--no-open`, `--mups-dir ` (repeatable), `--generated-dir `, `--no-env-file`. ### How a run works - **The agent decides when it is done.** A task can take many steps. The agent keeps calling functions, says a sentence or two between steps, and stops when the task is complete or it needs an answer from you. It has a `wait` tool (1 to 60 seconds) for letting you look at what is on screen, for example between the stops of a tour of the night sky in the star map. A request with one or two actions ends after those. - **You can interrupt.** While the agent works, the send button becomes a stop control. Sending a new message also ends the run, and the message is what it does next. If you act on a MUP that asks for an immediate response, or open or close MUPs by hand, the agent is told at its next step. - **Limits per run.** These only stop a run that goes on too long; set them in `.env` (see [`.env.example`](.env.example)). | Variable | Default | Limit | |---|---|---| | `MUP_AGENT_MAX_STEPS` | 100 | model calls in one run | | `MUP_AGENT_MAX_RUN_SECONDS` | 1200 (20 minutes) | wall-clock time, pauses included | | `MUP_AGENT_MAX_RUN_TOKENS` | 5000000 | tokens read and written, when the provider reports usage | - **Conversations.** A new conversation is a clean start for the agent as well; opening an earlier one from the history restores what the agent knew in it. - **Which MUPs are open.** The agent is told which MUPs are open and which are closed on every step, including changes you made by hand, and only calls the functions of open ones. - **Activity.** While it works, the chat shows one line (what the agent is doing now) that opens into a log of its steps. - **Real-time actions.** A MUP's `notifications.immediate` actions (a chess move, a finished timer, a selection) reach the agent at once and it answers in the MUP. - **Voice.** With `OPENAI_API_KEY` set, speech recognition (`gpt-transcribe`) and speech synthesis (`gpt-4o-mini-tts`) go through the OpenAI API from the host process, so the key never reaches the browser. Without it the 語音對話 MUP uses the browser's built-in speech. Models, voice and language can be changed in `.env`. - **Making a MUP.** With `npm run agent:builder` the agent can write a new MUP on request (`create_panel`): the host validates it, loads it and reports specific errors back to the model until it works. Each MUP is saved as one `.html` file in `mups-generated/` (git-ignored) and is loaded again on the next start. ### A measurement On the final version (2026-11-27), 14 tasks × 3 runs with Claude Haiku 5.5 (opening a MUP, building a deck, a chess exchange, a timer that ends, and so on) finished like this, with per-task correctness checks that read the MUP's state and were fixed before the run: 41 of 42 runs correct and 41 clean (the turn ended without an error or the step limit and no function call failed), 170 function calls with 1 rejected call that the model then corrected, median run time 8.7 s. The one incorrect run wrote a slide's steps as headings, which the fixed check does not count. This is a single reported run, not something the repository's tests reproduce, and the task list and its checks are not kept in the repository. To measure your own, write a task file in the format described at the top of [`scripts/agent-tasks.mjs`](scripts/agent-tasks.mjs) (a task can end with an `eval` step that reads a MUP's state, so you can check the result and not only that nothing failed) and run (it calls the model, so it costs money): ```bash npm run build node scripts/agent-tasks.mjs --tasks my-tasks.json --out ../mup-task-runs --runs 3 # add --record --quality high for 4K recordings (needs ffmpeg) ``` ## Development Requires Node.js 22.13 or newer. From the repository root: ```bash npm run setup # install and build both servers from their lockfiles npm test # build, test both servers, and check MUP manifests/scripts npm run check # only the manifest and script check ``` `npm test` runs 589 tests in `mup-mcp-server`, 32 tests in `mup-mini-mcp-server`, and the project check (`scripts/check-project.mjs`: every manifest validates, no duplicate MUP IDs, every script parses, the helpers shared by both servers have not drifted apart). | Path | Purpose | |---|---| | `mup-mcp-server/` | Dashboard host (MCP server), the standalone agent (`src/agent/`), workspace, pipelines, scheduler | | `mup-mini-mcp-server/` | Single-MUP host, hot reload, channel events | | `mups/` | The 13 maintained MUPs | | `mups-generated/` | MUPs the agent made (created on first use, git-ignored) | | `spec/` | Protocol documents, schema, examples | | `docs/` | Interface design standard, review report, icons (Lucide, ISC licence) | | `scripts/` | Project check and dev tools (below) | | `archive/` | Historical implementations and examples | Dev tools in `scripts/` (they need a built `mup-mcp-server` and Chrome): - `panel-shot.mjs` loads MUPs through the real host in headless Chrome, runs a list of calls, screenshots the result and reports page errors. `scripts/panel-calls/.json` is the acceptance script for each MUP: `node scripts/panel-shot.mjs --panel mup-timer --calls scripts/panel-calls/mup-timer.json --grid 3x3 --out timer.png` - `agent-tasks.mjs` runs natural-language tasks through the real agent with a real model and measures them (see above). - `check-project.mjs` is the manifest and script check that `npm run check` runs. Both packages remain independently installable. `npm test` inside either package rebuilds it first. CI tests both packages on Node.js 22. See [the review report](docs/REVIEW.md) for the fixes and validation scope. Both hosts bind to `127.0.0.1` and accept the local UI's origin. Run trusted MUPs: the same-origin iframe setup supports browser storage and media APIs, and is not an isolation boundary for untrusted HTML. The dashboard's workspace registration grants access to the working directory. ## Getting Started ### With Claude Code (recommended) ```bash claude mcp add --transport stdio --scope user mup -- npx mup-mcp-server ``` Restart Claude Code. A browser window opens at `http://localhost:3200`. Open the 「MUP 庫」 drawer in the header to set the source folder to a folder of MUP `.html` files (or start the server with `--mups-dir `), or start with the built-in Chat. #### Real-time channel mode MUPs can push interactions directly into Claude's conversation via channel notifications. To enable: ```bash claude --dangerously-load-development-channels server:mup ``` This lets MUPs deliver user actions to Claude in real time. Without this flag, all MUP features still work — interactions are just delivered via polling instead of push. ### With Claude Desktop Add to your `claude_desktop_config.json`: ```json { "mcpServers": { "mup": { "command": "npx", "args": ["mup-mcp-server"] } } } ``` ### Without an MCP client Use the [standalone agent](#standalone-agent): `npm run setup`, fill in `.env`, `npm run agent`. ## Quick Example ```html ``` Drop this into a MUP-compatible host, and it works. ## Architecture ``` ┌──────────────────────────────────────────┐ │ MUP (.html file) │ │ manifest + UI + functions │ └──────────────────┬───────────────────────┘ │ loaded by a host ┌────────────┼─────────────────┐ ▼ ▼ ▼ ┌───────────┐ ┌───────────┐ ┌─────────────────┐ │ MCP server│ │ mini │ │ agent host │ │ (Claude │ │ server │ │ (Anthropic / │ │ Code / │ │ (one MUP, │ │ OpenAI API, no │ │ Desktop) │ │ hot reload│ │ MCP client) │ └─────┬─────┘ └─────┬─────┘ └────────┬────────┘ └─────────────┼────────────────┘ │ WebSocket ▼ ┌─────────────────────────────┐ │ Browser (127.0.0.1) │ │ dashboard: chat + MUPs + │ │ workspace (mini: one MUP) │ └─────────────────────────────┘ ``` A host loads the MUPs and shows them over a WebSocket in the browser's dashboard (chat, MUPs, workspace); the mini server shows a single MUP full screen. ## Star History [![Star History Chart](https://api.star-history.com/image?repos=Ricky610329/mup&type=date&legend=top-left)](https://www.star-history.com/?repos=Ricky610329%2Fmup&type=date&legend=top-left) ## License [MIT](LICENSE)