MDMA: Markdown that mountsreal applications.
MDMA extends Markdown with interactive components defined in fenced ```mdma blocks. Give an LLM the spec and it returns structured, validated, renderable UI (forms, tables, approval gates) instead of a wall of text.
Parse → validate → run → render
Four small packages take a markdown file the whole way to a live, stateful interface. Use the ones you need.
Remark plugin: Markdown → MDMA AST.
Static analysis, lint rules, auto-fix.
State, bindings, audit log, policies.
React components for every block type.
Nine component types
MDMA defines nine interactive component types: form, button, tasklist, table, callout, approval-gate, webhook, chart, and thinking. Each is a schema in the spec. Write its short YAML in an ```mdma block and the renderer turns it into a live, stateful element in React.
Typed fields, validation, sensitive flags.
Actions with optional confirm dialogs.
Checklists with required items + onComplete.
Sortable columns over structured rows.
Info / warning / error notices.
Role-based sign-off before proceeding.
Fire an outbound call on an event.
Line / bar visualisations from inline data.
Render the model's reasoning trace.
Edit the markdown. Watch it render.
This is the real @mobile-reality/mdma-renderer-react running in your browser. Change the source on the left.
Talk to the MDMA Agent
Describe a component for your own use case: a contact form, a sortable table, an onboarding checklist, an approval gate. The agent renders it live in the panel on the right. Verify your email to start.
Same prompt. Different contract.
Ask an LLM to collect contact details. Without a spec you get prose you have to parse by hand. With MDMA you get a block you can render and validate.
Sure! To contact us, please provide the following information: 1. Your full name 2. Your email address 3. A message (at least a few sentences) Once you've gathered those, you can send them over and someone from the team will reply. Let me know if you'd like me to format this as a list or a table instead!
# Contact us
Fill in the form below and we'll get back to you.
```mdma
id: contact-form
type: form
fields:
- name: full_name
type: text
label: Full Name
required: true
- name: email
type: email
label: Email Address
required: true
- name: message
type: textarea
label: Message
required: true
validation:
min: 10
message: Please enter at least 10 characters.
onSubmit: submit-contact
```
```mdma
id: send-btn
type: button
text: Send Message
variant: primary
onAction: submit-contact
```Built for the token bill
MDMA cuts token cost because it runs on small, cheap models. Strict JSON breaks on those models (one bad quote and the whole payload is unusable), so teams reach for the largest tier. MDMA uses forgiving Markdown that small models like Gemini Flash and Claude Haiku emit reliably, backed by a deterministic validator and an LLM fixer. See it live in the MDMA Agent demo.
Runs on small, cheap models
Markdown is forgiving where strict JSON is brittle. A small model that mangles a JSON quote sends the whole payload to the bin; the same model emits valid MDMA. That means fast, low-cost models like Gemini Flash and Claude Haiku, instead of always reaching for the largest tier.
Deterministic validator, free
MDMA ships a static validator (17 lint rules) that runs without an LLM. Catching structural problems costs nothing per call, so you don't burn tokens re-asking the model to fix its own output.
LLM fixer for the rest
What the validator can't auto-fix goes to a fixer that repairs broken documents, and it works on the same small models, keeping the whole loop cheap.
What we eval
133 test cases · 9 suites · 12 models from Flash & Haiku to Opus
| Suite | Tests | What it asserts |
|---|---|---|
| Author | 28 | Correct component, exact field count, PII flags |
| Conversation | 30 | No regeneration on follow-up turns |
| Conversation flow | 6 | LLM-judged conversation quality |
| Custom prompt | 13 | Author + custom system prompt layering |
| Flows | 15 | Example flow custom prompts |
| Guidance | 15 | Calls the generate_mdma tool correctly |
| Fixer | 15 | Repairs broken MDMA to valid output |
| Prompt builder | 10 | CLI prompt builder output |
| Isolated | 1 | Single failure-case iteration |
- OpenAI GPT-5.x / 4.1 (incl. mini, nano)
- Claude Opus / Sonnet / Haiku
- Gemini 3.1 / 2.5 (incl. Flash, Flash-Lite)
- xAI Grok 4.x
The eval suites run across all of these models; the same suites pass on the small, cheap tiers, not only the large ones. Run them yourself with the PromptFoo configs in mdma/evals.
Real use cases, shipped in the repo
Every example below is a working MDMA document in the open-source project, from a one-field form to a dual-approval compliance flow, built from the nine component types.
Examples
common use casesContact form
Collect a name, email and message, then submit. The simplest MDMA document.
Budget approval
Submit a budget request, complete prerequisites, and gate it behind manager sign-off.
Employee onboarding
Welcome a new hire through personal info, equipment selection and a manager checklist.
Bug report
Capture reproduction steps and severity, with a triage checklist before submission.
Customer survey
Structured post-support feedback with ratings, checkboxes and optional follow-up.
Order tracking
Order status, shipment details and delivery milestones at a glance.
Sprint retrospective
Team metrics, feedback and action items captured from the sprint retro.
Sales dashboard
Quarterly revenue trends, team breakdown and a sortable deals table.
Feature request
A product request with business justification and a product-manager review gate.
Job application
Apply with a resume and optional portfolio. Shows the file-upload field.
Browse and run every example in the repo.
Blueprints
industry-specific workflowsIncident triage
Critical OpsAssess severity, notify stakeholders, track resolution and gate closure behind sign-off.
Change management
Engineering / ComplianceSOX/ISO release approval: risk assessment, dual approval and a pre-deploy checklist.
Customer escalation
Customer OpsSLA-aware escalation with sentiment tracking and a dynamic escalation-history table.
Clinical procedure approval
HealthcareClinical + QA review and safety verification before a procedure is published.
KYC case review
Finance / ComplianceIdentity verification for KYC/AML: PII handling, document table and compliance approval.
Open the blueprints folder to inspect or fork them.
Where MDMA fits
Between raw markdown and a hand-built JSON UI contract.
| Raw MD | Custom JSON | MDMA | |
|---|---|---|---|
| Renders as interactive UI | |||
| Readable as plain text | |||
| Schema-validated | partial | ||
| LLM emits it reliably | partial | ||
| Stateful (bindings, audit) | |||
| No front-end build needed |
Two ways in
Developers
Parse and run MDMA documents, then render them in React.
AI authoring
Give an LLM the prompt pack, or build prompts with the CLI.
Frequently asked questions
- What is MDMA?
- MDMA (Markdown Document with Mounted Applications) extends Markdown with interactive components defined in fenced mdma code blocks. A regular Markdown file becomes an interactive application with forms, tables, charts, approval gates and more.
- How is MDMA different from raw markdown or a JSON UI contract?
- Raw Markdown renders as text and a custom JSON UI contract is brittle on smaller models. MDMA is forgiving Markdown that small, cheap models emit reliably, and it is schema-validated so the output is renderable and safe.
- Why does MDMA save on tokens?
- Because MDMA works on small, cheap models such as Gemini Flash and Claude Haiku where strict JSON often breaks. A deterministic validator and an LLM fixer keep the loop cheap, so you don't burn tokens re-asking a large model to repair its own output.
- Which packages does MDMA ship?
- The core packages are @mobile-reality/mdma-parser, @mobile-reality/mdma-validator, @mobile-reality/mdma-runtime and @mobile-reality/mdma-renderer-react, plus a prompt-pack, CLI and MCP server.
- Is MDMA open source?
- Yes. MDMA is MIT-licensed and maintained by Mobile Reality. The source is on GitHub at github.com/MobileReality/mdma.
- Does MDMA work with Claude, GPT and Gemini?
- Yes. MDMA is model-agnostic: any LLM that can write Markdown can emit MDMA. Because the format is forgiving, it works on small, cheap models such as Gemini Flash and Claude Haiku, not only the largest tiers. A prompt-pack and MCP server help LLMs produce valid MDMA.
- How do I render MDMA in React?
- Install @mobile-reality/mdma-renderer-react along with the parser and runtime, parse the markdown to an AST, create a document store, and pass them to the MdmaDocument component. It renders every component type as a live, stateful element.