Curated website design inspiration gallery, open zero-auth MCP server for AI agents, and shareable moodboard lists.
JavaScript ai-agentschatgptclaude-codecodexcurated-listcursordesign-gallerydesign-inspirationdesign-systemsdesign-tastefrontendmcpmcp-servermodel-context-protocolmoodboardopen-sourceui-designweb-design
/**
* Interactive in-chat MCP App for DesignTaste (designtaste.wtf).
*
* Implements MCP Apps (`io.modelcontextprotocol/ui`, 2026-01-26) plus ChatGPT
* `window.openai` fallbacks so Claude Desktop, Claude.ai, Claude Code Desktop,
* ChatGPT, Codex, and Cursor render a clean dark-studio website browser right
* inside the conversation.
*
* Security notes:
* - Single self-contained HTML document; no external scripts or fonts.
* - All untrusted catalog / saved-list text is inserted via `textContent`
* (never `innerHTML`).
* - External links strictly allow-list `https://` URLs.
* - Only images from `https://designtaste.wtf` are declared in `resourceDomains`.
*/
export const PANEL_MIME = "text/html;profile=mcp-app";
export const APP_PANEL = "ui://designtaste/app.html";
export const APP_RESOURCE_META = {
ui: {
prefersBorder: false,
domain: "designtaste.wtf",
csp: {
resourceDomains: ["https://designtaste.wtf"],
connectDomains: [],
frameDomains: [],
},
},
"openai/widgetPrefersBorder": false,
"openai/widgetDomain": "https://designtaste.wtf",
"openai/widgetCSP": {
resource_domains: ["https://designtaste.wtf"],
connect_domains: [],
},
"openai/widgetDescription":
"Interactive dark-studio website gallery for browsing designtaste.wtf, inspecting design notes, filtering by category or style tag, and assembling shareable moodboard lists.",
};
const MARK_SVG = `<svg width="24" height="24" viewBox="0 0 40 40" fill="none" aria-hidden="true"><rect width="40" height="40" rx="11" fill="url(#dt-g)" stroke="#ffffff" stroke-opacity="0.18" stroke-width="1.5"/><path d="M13 11.5h6.2c5.4 0 8.8 3.3 8.8 8.5s-3.4 8.5-8.8 8.5H13V11.5Zm4.2 3.5v10h1.9c3 0 4.6-1.8 4.6-5s-1.6-5-4.6-5h-1.9Z" fill="url(#dt-s)"/><circle cx="29.5" cy="11.5" r="2.6" fill="#ff4d6d"/><defs><linearGradient id="dt-g" x1="0" y1="0" x2="40" y2="40" gradientUnits="userSpaceOnUse"><stop stop-color="#1e1e24"/><stop offset="1" stop-color="#0b0b0d"/></linearGradient><linearGradient id="dt-s" x1="13" y1="11.5" x2="28" y2="28.5" gradientUnits="userSpaceOnUse"><stop stop-color="#ffffff"/><stop offset="1" stop-color="#a5b4fc"/></linearGradient></defs></svg>`;
const STYLE = `
:root {
color-scheme: dark;
--bg: #0b0b0d;
--surface: #121216;
--raised: #17171d;
--sunken: #0e0e11;
--text: #f4f4f6;
--muted: #a1a1ad;
--faint: #71717d;
--line: rgba(255, 255, 255, 0.09);
--line-strong: rgba(255, 255, 255, 0.18);
--rim: rgba(255, 255, 255, 0.07);
--iris: #a5b4fc;
--iris-soft: rgba(165, 180, 252, 0.14);
--heart: #ff4d6d;
--heart-soft: rgba(255, 77, 109, 0.16);
--font: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
--mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
--ease: cubic-bezier(0.22, 1, 0.36, 1);
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: transparent; color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
body { padding: 2px; }
h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { opacity: 0.48; cursor: default; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--iris); outline-offset: 2px; }
.app {
border-radius: 18px;
border: 1px solid var(--line);
background:
radial-gradient(ellipse 60% 45% at 25% 0%, rgba(165, 180, 252, 0.08), transparent 70%),
radial-gradient(ellipse 45% 40% at 85% 0%, rgba(255, 130, 155, 0.05), transparent 70%),
var(--bg);
overflow: hidden;
box-shadow: inset 0 1px 0 var(--rim);
transition: opacity 150ms var(--ease);
}
.app[aria-busy="true"] { opacity: 0.62; pointer-events: none; }
/* Header bar */
.bar {
display: flex;
align-items: center;
gap: 10px;
padding: 10px 14px;
background: rgba(18, 18, 22, 0.88);
border-bottom: 1px solid var(--line);
}
.brand {
display: inline-flex;
align-items: center;
gap: 8px;
font-size: 14px;
font-weight: 650;
letter-spacing: -0.025em;
color: var(--text);
padding: 3px 6px 3px 2px;
border-radius: 8px;
}
.brand:hover { background: rgba(255, 255, 255, 0.05); }
.brand-dot { font-weight: 450; color: var(--faint); }
.crumbs {
display: flex;
align-items: center;
gap: 6px;
min-width: 0;
font-size: 12.5px;
color: var(--muted);
overflow: hidden;
}
.crumbs .sep { color: var(--faint); }
.crumbs .here {
color: var(--text);
font-weight: 550;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.crumbs .crumb-btn {
color: var(--muted);
padding: 2px 6px;
border-radius: 6px;
}
.crumbs .crumb-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.grow { flex: 1; }
.bar-acts { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
/* Buttons */
.btn {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 6px;
height: 30px;
padding: 0 11px;
border-radius: 9px;
font-size: 12.5px;
font-weight: 550;
letter-spacing: -0.01em;
white-space: nowrap;
border: 1px solid var(--line);
background: linear-gradient(180deg, #1d1d24 0%, #141419 100%);
color: var(--text);
box-shadow: inset 0 1px 0 var(--rim);
transition: border-color 140ms var(--ease), background 140ms var(--ease), transform 120ms var(--ease);
}
.btn:hover:not(:disabled) { border-color: var(--line-strong); background: linear-gradient(180deg, #25252e 0%, #191920 100%); }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn-primary {
background: linear-gradient(180deg, #ffffff 0%, #e4e4ec 100%);
color: #0b0b0d;
border-color: rgba(255, 255, 255, 0.5);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
.btn-primary:hover:not(:disabled) { background: linear-gradient(180deg, #ffffff 0%, #f0f0f6 100%); border-color: #ffffff; }
.btn-iris {
background: var(--iris-soft);
color: #d4dcff;
border-color: rgba(165, 180, 252, 0.32);
}
.btn-iris:hover:not(:disabled) { background: rgba(165, 180, 252, 0.22); border-color: rgba(165, 180, 252, 0.5); }
.btn-heart.is-saved {
background: var(--heart-soft);
color: #ff99ab;
border-color: rgba(255, 77, 109, 0.38);
}
/* Controls strip */
.controls {
display: flex;
flex-direction: column;
gap: 10px;
padding: 12px 14px 10px;
border-bottom: 1px solid var(--line);
background: rgba(14, 14, 18, 0.55);
}
.controls-row {
display: flex;
align-items: center;
gap: 8px;
flex-wrap: wrap;
}
.search-form {
flex: 1;
min-width: 170px;
display: flex;
align-items: center;
gap: 7px;
height: 32px;
padding: 0 10px;
border-radius: 9px;
background: var(--sunken);
border: 1px solid var(--line);
}
.search-form:focus-within { border-color: rgba(165, 180, 252, 0.5); }
.search-form input {
width: 100%;
background: none;
border: 0;
outline: none;
font-size: 13px;
color: var(--text);
}
.search-form input::placeholder { color: var(--faint); }
.sort-select {
height: 32px;
padding: 0 10px;
border-radius: 9px;
background: var(--sunken);
border: 1px solid var(--line);
font-size: 12.5px;
color: var(--text);
}
.count-meta {
font-family: var(--mono);
font-size: 11.5px;
color: var(--faint);
white-space: nowrap;
}
.pills {
display: flex;
align-items: center;
gap: 5px;
overflow-x: auto;
scrollbar-width: none;
padding-bottom: 2px;
}
.pills::-webkit-scrollbar { display: none; }
.pill {
flex-shrink: 0;
height: 27px;
padding: 0 10px;
border-radius: 999px;
font-size: 12px;
font-weight: 500;
color: var(--muted);
border: 1px solid transparent;
background: rgba(255, 255, 255, 0.03);
transition: color 130ms var(--ease), background 130ms var(--ease), border-color 130ms var(--ease);
}
.pill:hover { color: var(--text); background: rgba(255, 255, 255, 0.08); }
.pill.is-active {
color: #0b0b0d;
background: #f4f4f6;
font-weight: 600;
}
.active-filter-row {
display: flex;
align-items: center;
gap: 8px;
flex-wrap: wrap;
font-size: 12px;
color: var(--muted);
}
.filter-chip {
display: inline-flex;
align-items: center;
gap: 6px;
padding: 2px 9px;
border-radius: 999px;
background: var(--iris-soft);
color: #d4dcff;
border: 1px solid rgba(165, 180, 252, 0.3);
font-size: 11.5px;
}
/* Gallery Grid */
.body { padding: 14px; }
.grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
gap: 14px;
}
.card {
display: flex;
flex-direction: column;
gap: 8px;
min-width: 0;
}
.thumb-wrap {
position: relative;
aspect-ratio: 16 / 10;
border-radius: 11px;
overflow: hidden;
background: var(--surface);
border: 1px solid var(--line);
transition: border-color 160ms var(--ease), transform 180ms var(--ease);
}
.thumb-wrap:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.thumb-btn {
display: block;
width: 100%;
height: 100%;
position: relative;
text-align: left;
}
.thumb-btn img {
display: block;
width: 100%;
height: 100%;
object-fit: cover;
object-position: top center;
background: var(--raised);
}
.thumb-fallback {
position: absolute;
inset: 0;
display: flex;
flex-direction: column;
justify-content: flex-end;
padding: 12px;
background: linear-gradient(145deg, #1a1a24 0%, #101015 100%);
}
.thumb-fallback strong { font-size: 14px; font-weight: 600; color: var(--text); }
.thumb-fallback span { font-size: 11.5px; color: var(--muted); font-family: var(--mono); }
.heart-btn {
position: absolute;
top: 8px;
right: 8px;
width: 28px;
height: 28px;
border-radius: 999px;
display: grid;
place-items: center;
background: rgba(11, 11, 13, 0.78);
border: 1px solid rgba(255, 255, 255, 0.18);
color: #f4f4f6;
transition: transform 140ms var(--ease), background 140ms var(--ease), border-color 140ms var(--ease);
}
.heart-btn:hover { transform: scale(1.07); background: rgba(11, 11, 13, 0.95); }
.heart-btn.is-saved {
background: var(--heart);
border-color: rgba(255, 255, 255, 0.35);
color: #ffffff;
}
.card-foot {
display: flex;
align-items: baseline;
justify-content: space-between;
gap: 8px;
padding: 0 2px;
}
.card-title-wrap { min-width: 0; display: flex; align-items: baseline; gap: 6px; }
.card-name {
font-size: 13px;
font-weight: 560;
color: var(--text);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
text-align: left;
}
.card-name:hover { color: var(--iris); }
.card-cat {
font-size: 11.5px;
color: var(--faint);
white-space: nowrap;
flex-shrink: 0;
}
.card-visit {
font-size: 11.5px;
color: var(--muted);
flex-shrink: 0;
padding: 1px 4px;
border-radius: 5px;
}
.card-visit:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }
/* Pagination */
.pager {
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
padding: 10px 14px;
border-top: 1px solid var(--line);
background: rgba(14, 14, 18, 0.55);
}
/* Sticky Moodboard Tray */
.tray {
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
flex-wrap: wrap;
padding: 10px 14px;
border-top: 1px solid rgba(165, 180, 252, 0.24);
background: linear-gradient(180deg, rgba(28, 30, 44, 0.92), rgba(18, 18, 25, 0.98));
}
.tray-left { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; flex: 1; }
.tray-label { font-size: 12px; font-weight: 600; color: #d4dcff; white-space: nowrap; }
.tray-chip {
display: inline-flex;
align-items: center;
gap: 4px;
padding: 2px 8px;
border-radius: 999px;
background: rgba(255, 255, 255, 0.08);
border: 1px solid var(--line);
font-size: 11.5px;
color: var(--text);
}
.tray-chip:hover { border-color: var(--heart); color: #ff99ab; }
.tray-acts { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.tray-msg { width: 100%; font-size: 12px; color: var(--muted); }
/* Site Detail View */
.detail-grid {
display: grid;
grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
gap: 16px;
align-items: start;
}
.detail-shot {
position: relative;
aspect-ratio: 16 / 10;
border-radius: 13px;
overflow: hidden;
border: 1px solid var(--line-strong);
background: var(--surface);
}
.detail-shot img { width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; }
.detail-info { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.detail-info h1 { font-size: 20px; font-weight: 650; letter-spacing: -0.03em; line-height: 1.15; }
.detail-host { font-family: var(--mono); font-size: 12px; color: var(--iris); }
.detail-desc { font-size: 13.5px; color: var(--muted); line-height: 1.55; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag-btn {
padding: 3px 9px;
border-radius: 999px;
font-size: 11.5px;
color: var(--muted);
background: var(--raised);
border: 1px solid var(--line);
}
.tag-btn:hover { color: var(--text); border-color: rgba(165, 180, 252, 0.45); background: var(--iris-soft); }
.detail-acts { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 2px; }
.subhead {
font-size: 12px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.06em;
color: var(--faint);
margin: 16px 0 10px;
}
/* Categories Explorer */
.cat-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
gap: 12px;
}
.cat-card {
display: flex;
flex-direction: column;
gap: 10px;
padding: 12px;
border-radius: 13px;
background: var(--surface);
border: 1px solid var(--line);
transition: border-color 140ms var(--ease);
}
.cat-card:hover { border-color: var(--line-strong); }
.cat-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cat-name { font-size: 14px; font-weight: 600; color: var(--text); text-align: left; }
.cat-name:hover { color: var(--iris); }
.cat-count { font-family: var(--mono); font-size: 11.5px; color: var(--faint); }
.cat-thumbs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.cat-thumb {
aspect-ratio: 16 / 10;
border-radius: 7px;
overflow: hidden;
background: var(--raised);
border: 1px solid var(--line);
}
.cat-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
/* Saved Moodboard Banner */
.list-head {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
flex-wrap: wrap;
padding: 12px 14px;
border-bottom: 1px solid var(--line);
background: rgba(18, 18, 25, 0.72);
}
.list-title-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.list-title-row h1 { font-size: 16px; font-weight: 650; letter-spacing: -0.02em; }
.id-badge {
font-family: var(--mono);
font-size: 11.5px;
padding: 2px 8px;
border-radius: 999px;
background: var(--iris-soft);
color: #d4dcff;
border: 1px solid rgba(165, 180, 252, 0.34);
}
.list-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.empty {
padding: 28px 14px;
text-align: center;
color: var(--muted);
display: flex;
flex-direction: column;
align-items: center;
gap: 10px;
}
@media (max-width: 560px) {
.detail-grid { grid-template-columns: 1fr; }
.grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}
`;
const SCRIPT = `
(function () {
var root = document.getElementById("root");
var pending = {}, nextId = 1, hostCaps = {}, currentData = null;
var moodboard = {}; // id -> { id, name }
function post(msg) { window.parent.postMessage(msg, "*"); }
function rpc(method, params) {
return new Promise(function (resolve, reject) {
var id = nextId++;
pending[id] = [resolve, reject];
post({ jsonrpc: "2.0", id: id, method: method, params: params || {} });
setTimeout(function () {
if (pending[id]) { delete pending[id]; reject(new Error("timeout")); }
}, 15000);
});
}
function notify(method, params) { post({ jsonrpc: "2.0", method: method, params: params || {} }); }
function el(tag, cls, text) {
var n = document.createElement(tag);
if (cls) n.className = cls;
if (text !== undefined && text !== null) n.textContent = String(text);
return n;
}
function safeHref(url) {
return typeof url === "string" && /^https:\\/\\//i.test(url) ? url : "";
}
function withRef(url) {
var href = safeHref(url);
if (!href) return "";
try {
var u = new URL(href);
if (u.hostname !== "designtaste.wtf" && !u.searchParams.has("ref")) {
u.searchParams.set("ref", "designtaste.wtf");
}
return u.toString();
} catch (_) {
return href;
}
}
function openExternal(url) {
var href = safeHref(url);
if (!href) return;
if (window.openai && typeof window.openai.openExternal === "function") {
try { window.openai.openExternal({ href: href }); return; } catch (_) {}
}
rpc("ui/open-link", { url: href }).catch(function () {
try { window.open(href, "_blank", "noopener"); } catch (_) {}
});
}
function sendMessage(text) {
if (window.openai && typeof window.openai.sendFollowUpMessage === "function") {
return Promise.resolve(window.openai.sendFollowUpMessage({ prompt: text }));
}
return rpc("ui/message", { role: "user", content: [{ type: "text", text: text }] }).then(function (r) {
if (r && r.isError) throw new Error("blocked");
return r;
}).catch(function () {
if (hostCaps.updateModelContext) {
return rpc("ui/update-model-context", { content: [{ type: "text", text: text }] });
}
throw new Error("unavailable");
});
}
function invokeTool(name, args) {
if (window.openai && typeof window.openai.callTool === "function") {
return Promise.resolve(window.openai.callTool(name, args || {})).then(function (r) {
var sc = (r && r.structuredContent) || (r && r.result && r.result.structuredContent) || r;
if (sc && sc.kind) return sc;
throw new Error("no view");
});
}
return rpc("tools/call", { name: name, arguments: args || {} }).then(function (r) {
if (!r || r.isError || !r.structuredContent) throw new Error("no view");
return r.structuredContent;
});
}
function go(tool, args, fallbackPrompt) {
var app = root.firstChild;
if (app) app.setAttribute("aria-busy", "true");
invokeTool(tool, args).then(render, function () {
if (app) app.removeAttribute("aria-busy");
if (fallbackPrompt) sendMessage(fallbackPrompt).catch(function () {});
});
}
function heartSvg(filled) {
var ns = "http://www.w3.org/2000/svg";
var svg = document.createElementNS(ns, "svg");
svg.setAttribute("width", "14");
svg.setAttribute("height", "14");
svg.setAttribute("viewBox", "0 0 24 24");
svg.setAttribute("fill", filled ? "currentColor" : "none");
svg.setAttribute("aria-hidden", "true");
var path = document.createElementNS(ns, "path");
path.setAttribute("d", "M12 20.25s-7.25-4.35-9.2-8.75C1.35 8.2 3.15 4.75 6.8 4.75c2.1 0 3.7 1.15 5.2 2.9 1.5-1.75 3.1-2.9 5.2-2.9 3.65 0 5.45 3.45 4 6.75-1.95 4.4-9.2 8.75-9.2 8.75Z");
path.setAttribute("stroke", "currentColor");
path.setAttribute("stroke-width", "1.9");
path.setAttribute("stroke-linejoin", "round");
svg.appendChild(path);
return svg;
}
function makeThumbImg(site, altText) {
var img = document.createElement("img");
var src = safeHref(site.thumbUrl || site.thumbnailUrl) || (site.id ? "https://designtaste.wtf/images/" + encodeURIComponent(site.id) + "-thumb.jpg" : "");
img.src = src;
img.alt = altText || (site.name + " website screenshot");
img.loading = "lazy";
img.decoding = "async";
img.onerror = function () {
var parent = img.parentNode;
if (!parent) return;
img.remove();
var fb = el("div", "thumb-fallback");
fb.appendChild(el("strong", "", site.name));
fb.appendChild(el("span", "", site.category || ""));
parent.appendChild(fb);
};
return img;
}
function toggleMoodboard(site) {
if (moodboard[site.id]) delete moodboard[site.id];
else moodboard[site.id] = { id: site.id, name: site.name };
if (currentData) render(currentData);
}
function moodboardItems() {
return Object.keys(moodboard).map(function (k) { return moodboard[k]; });
}
function buildShell(crumbs, externalUrl, extraButtons) {
var app = el("div", "app");
var bar = el("div", "bar");
var brand = el("button", "brand");
brand.type = "button";
brand.title = "Browse all curated websites";
var tpl = document.getElementById("dt-mark");
if (tpl && tpl.content && tpl.content.firstElementChild) {
brand.appendChild(tpl.content.firstElementChild.cloneNode(true));
}
var txt = el("span", "");
txt.appendChild(document.createTextNode("designtaste"));
txt.appendChild(el("span", "brand-dot", ".wtf"));
brand.appendChild(txt);
brand.onclick = function () { go("browse_gallery", { sort: "popular", limit: 12 }, "Open the DesignTaste gallery."); };
bar.appendChild(brand);
if (crumbs && crumbs.length) {
var c = el("div", "crumbs");
crumbs.forEach(function (item) {
c.appendChild(el("span", "sep", "/"));
if (item.onClick) {
var b = el("button", "crumb-btn", item.text);
b.type = "button";
b.onclick = item.onClick;
c.appendChild(b);
} else {
c.appendChild(el("span", "here", item.text));
}
});
bar.appendChild(c);
}
bar.appendChild(el("div", "grow"));
var acts = el("div", "bar-acts");
var catsBtn = el("button", "btn", "Categories");
catsBtn.type = "button";
catsBtn.onclick = function () { go("list_categories", {}, "List DesignTaste categories."); };
acts.appendChild(catsBtn);
var shuffleBtn = el("button", "btn", "Shuffle");
shuffleBtn.type = "button";
shuffleBtn.onclick = function () { go("discover_random", { count: 6 }, "Show me 6 random websites on DesignTaste."); };
acts.appendChild(shuffleBtn);
if (extraButtons) {
extraButtons.forEach(function (b) { acts.appendChild(b); });
}
if (externalUrl) {
var openBtn = el("button", "btn", "Open \\u2197");
openBtn.type = "button";
openBtn.onclick = function () { openExternal(externalUrl); };
acts.appendChild(openBtn);
}
bar.appendChild(acts);
app.appendChild(bar);
return app;
}
function buildSiteCard(site) {
var card = el("article", "card");
var wrap = el("div", "thumb-wrap");
var btn = el("button", "thumb-btn");
btn.type = "button";
btn.setAttribute("aria-label", "Inspect " + site.name);
btn.appendChild(makeThumbImg(site));
btn.onclick = function () { go("get_site", { id: site.id }, "Inspect " + site.name + " on DesignTaste."); };
wrap.appendChild(btn);
var saved = Boolean(moodboard[site.id]);
var h = el("button", "heart-btn" + (saved ? " is-saved" : ""));
h.type = "button";
h.title = saved ? "Remove from moodboard" : "Add to moodboard";
h.setAttribute("aria-pressed", saved ? "true" : "false");
h.setAttribute("aria-label", (saved ? "Remove " : "Save ") + site.name);
h.appendChild(heartSvg(saved));
h.onclick = function (e) { e.stopPropagation(); toggleMoodboard(site); };
wrap.appendChild(h);
card.appendChild(wrap);
var foot = el("div", "card-foot");
var left = el("div", "card-title-wrap");
var nameBtn = el("button", "card-name", site.name);
nameBtn.type = "button";
nameBtn.onclick = function () { go("get_site", { id: site.id }, "Inspect " + site.name + " on DesignTaste."); };
left.appendChild(nameBtn);
left.appendChild(el("span", "card-cat", site.category));
foot.appendChild(left);
if (safeHref(site.visitUrl || site.url)) {
var visit = el("button", "card-visit", "\\u2197");
visit.type = "button";
visit.title = "Visit " + site.name;
visit.setAttribute("aria-label", "Visit " + site.name);
visit.onclick = function () { openExternal(site.visitUrl || withRef(site.url)); };
foot.appendChild(visit);
}
card.appendChild(foot);
return card;
}
function buildTray(app) {
var items = moodboardItems();
if (!items.length) return;
var tray = el("div", "tray");
var left = el("div", "tray-left");
left.appendChild(el("span", "tray-label", items.length + " saved:"));
items.slice(0, 8).forEach(function (it) {
var chip = el("button", "tray-chip", it.name + " \\u00d7");
chip.type = "button";
chip.title = "Remove " + it.name;
chip.onclick = function () { toggleMoodboard(it); };
left.appendChild(chip);
});
if (items.length > 8) left.appendChild(el("span", "count-meta", "+" + (items.length - 8)));
tray.appendChild(left);
var acts = el("div", "tray-acts");
var msg = el("div", "tray-msg");
var shareBtn = el("button", "btn btn-iris", "Create share ID");
shareBtn.type = "button";
shareBtn.onclick = function () {
var ids = items.map(function (x) { return x.id; });
go(
"create_saved_list",
{ ids: ids, title: "Moodboard (" + items.length + " sites)" },
"Create a DesignTaste saved list with these site IDs: " + ids.join(", ")
);
};
acts.appendChild(shareBtn);
var useBtn = el("button", "btn btn-primary", "Use as direction");
useBtn.type = "button";
useBtn.onclick = function () {
var ids = items.map(function (x) { return x.id; });
var names = items.map(function (x) { return x.name; });
var prompt = "Use these DesignTaste references as visual direction (" + names.join(", ") + "; IDs: " + ids.join(", ") + "). Inspect them via DesignTaste MCP with include_image=true and synthesize an original layout, palette, and typography system.";
useBtn.disabled = true;
sendMessage(prompt).then(
function () { msg.textContent = "Sent to your agent."; },
function () { msg.textContent = prompt; useBtn.disabled = false; }
);
};
acts.appendChild(useBtn);
tray.appendChild(acts);
tray.appendChild(msg);
app.appendChild(tray);
}
function renderGallery(d) {
var crumbs = [];
if (d.title) crumbs.push({ text: d.title });
else if (d.category) crumbs.push({ text: d.category });
else if (d.tag) crumbs.push({ text: "#" + d.tag });
else if (d.query) crumbs.push({ text: "\\u201c" + d.query + "\\u201d" });
var app = buildShell(crumbs, "https://designtaste.wtf/");
// Controls
var controls = el("div", "controls");
var row = el("div", "controls-row");
var form = el("form", "search-form");
var input = document.createElement("input");
input.type = "search";
input.placeholder = "Search 274+ sites (e.g. dark, typography, motion)...";
input.value = d.query || "";
form.appendChild(input);
form.onsubmit = function (e) {
e.preventDefault();
var q = input.value.trim();
go(
"browse_gallery",
{ query: q || undefined, category: d.category || undefined, tag: d.tag || undefined, sort: d.sort || "popular", limit: d.limit || 12, offset: 0 },
q ? "Search DesignTaste for " + q : "Browse DesignTaste gallery."
);
};
row.appendChild(form);
var select = el("select", "sort-select");
select.setAttribute("aria-label", "Sort websites");
[["popular", "Popular"], ["curated", "Curated"], ["newest", "Newest"], ["az", "A\\u2013Z"]].forEach(function (pair) {
var opt = document.createElement("option");
opt.value = pair[0];
opt.textContent = pair[1];
if ((d.sort || "popular") === pair[0]) opt.selected = true;
select.appendChild(opt);
});
select.onchange = function () {
go(
"browse_gallery",
{ query: d.query || undefined, category: d.category || undefined, tag: d.tag || undefined, sort: select.value, limit: d.limit || 12, offset: 0 },
"Sort DesignTaste by " + select.value
);
};
row.appendChild(select);
row.appendChild(el("span", "count-meta", (d.totalMatches || 0) + " sites"));
controls.appendChild(row);
// Category pills
if (d.categories && d.categories.length) {
var pills = el("div", "pills");
var allBtn = el("button", "pill" + (!d.category ? " is-active" : ""), "All");
allBtn.type = "button";
allBtn.onclick = function () {
go("browse_gallery", { query: d.query || undefined, sort: d.sort || "popular", limit: d.limit || 12, offset: 0 }, "Show all categories on DesignTaste.");
};
pills.appendChild(allBtn);
d.categories.forEach(function (cat) {
var b = el("button", "pill" + (d.category === cat ? " is-active" : ""), cat);
b.type = "button";
b.onclick = function () {
go("browse_gallery", { category: cat, query: d.query || undefined, sort: d.sort || "popular", limit: d.limit || 12, offset: 0 }, "Browse " + cat + " websites on DesignTaste.");
};
pills.appendChild(b);
});
controls.appendChild(pills);
}
if (d.tag || d.subtitle) {
var frow = el("div", "active-filter-row");
if (d.subtitle) frow.appendChild(el("span", "", d.subtitle));
if (d.tag) {
var chip = el("button", "filter-chip", "Tag: " + d.tag + " \\u00d7");
chip.type = "button";
chip.onclick = function () {
go("browse_gallery", { category: d.category || undefined, query: d.query || undefined, sort: d.sort || "popular", limit: d.limit || 12, offset: 0 }, "Clear tag filter on DesignTaste.");
};
frow.appendChild(chip);
}
controls.appendChild(frow);
}
app.appendChild(controls);
// Grid
var body = el("div", "body");
if (!d.sites || !d.sites.length) {
var empty = el("div", "empty");
empty.appendChild(el("p", "", "No curated websites matched that filter."));
var reset = el("button", "btn", "Reset filters");
reset.type = "button";
reset.onclick = function () { go("browse_gallery", { sort: "popular", limit: 12 }, "Browse all DesignTaste websites."); };
empty.appendChild(reset);
body.appendChild(empty);
} else {
var grid = el("div", "grid");
d.sites.forEach(function (s) { grid.appendChild(buildSiteCard(s)); });
body.appendChild(grid);
}
app.appendChild(body);
// Pagination (when applicable)
var limit = d.limit || 12;
var offset = d.offset || 0;
var total = d.totalMatches || (d.sites ? d.sites.length : 0);
if (d.mode === "random") {
var rfoot = el("div", "pager");
rfoot.appendChild(el("span", "count-meta", "Random sparks from the curated catalog"));
var again = el("button", "btn btn-iris", "Shuffle again");
again.type = "button";
again.onclick = function () {
go("discover_random", { count: d.sites ? d.sites.length : 6, category: d.category || undefined, tag: d.tag || undefined }, "Shuffle DesignTaste again.");
};
rfoot.appendChild(again);
app.appendChild(rfoot);
} else if (total > limit) {
var pager = el("div", "pager");
var prev = el("button", "btn", "\\u2190 Prev");
prev.type = "button";
prev.disabled = offset <= 0;
prev.onclick = function () {
go("browse_gallery", { query: d.query || undefined, category: d.category || undefined, tag: d.tag || undefined, sort: d.sort || "popular", limit: limit, offset: Math.max(0, offset - limit) });
};
var pageNum = Math.floor(offset / limit) + 1;
var totalPages = Math.ceil(total / limit);
var next = el("button", "btn", "Next \\u2192");
next.type = "button";
next.disabled = offset + limit >= total;
next.onclick = function () {
go("browse_gallery", { query: d.query || undefined, category: d.category || undefined, tag: d.tag || undefined, sort: d.sort || "popular", limit: limit, offset: offset + limit });
};
pager.appendChild(prev);
pager.appendChild(el("span", "count-meta", "Page " + pageNum + " of " + totalPages));
pager.appendChild(next);
app.appendChild(pager);
}
buildTray(app);
return app;
}
function renderSite(d) {
var s = d.site;
var app = buildShell([
{ text: s.category, onClick: function () { go("browse_gallery", { category: s.category, limit: 12 }, "Browse " + s.category + " on DesignTaste."); } },
{ text: s.name }
], s.detailUrl || s.url);
var body = el("div", "body");
var grid = el("div", "detail-grid");
var shot = el("div", "detail-shot");
shot.appendChild(makeThumbImg(s, s.name + " website preview"));
grid.appendChild(shot);
var info = el("div", "detail-info");
info.appendChild(el("h1", "", s.name));
var host = "";
try { host = new URL(s.url).hostname.replace(/^www\\./, ""); } catch (_) {}
if (host) info.appendChild(el("div", "detail-host", host + " \\u00b7 " + s.category));
if (s.description) info.appendChild(el("p", "detail-desc", s.description));
if (s.observation && s.observation !== s.description) {
info.appendChild(el("p", "detail-desc", s.observation));
}
if (s.tags && s.tags.length) {
var tags = el("div", "tags");
s.tags.forEach(function (t) {
var b = el("button", "tag-btn", t);
b.type = "button";
b.onclick = function () { go("browse_gallery", { tag: t, limit: 12 }, "Search DesignTaste sites tagged " + t); };
tags.appendChild(b);
});
info.appendChild(tags);
}
var acts = el("div", "detail-acts");
if (safeHref(s.visitUrl || s.url)) {
var visit = el("button", "btn btn-primary", "Visit live site \\u2197");
visit.type = "button";
visit.onclick = function () { openExternal(s.visitUrl || withRef(s.url)); };
acts.appendChild(visit);
}
var isSaved = Boolean(moodboard[s.id]);
var save = el("button", "btn btn-heart" + (isSaved ? " is-saved" : ""), isSaved ? "\\u2665 Saved" : "\\u2661 Save to moodboard");
save.type = "button";
save.onclick = function () { toggleMoodboard(s); };
acts.appendChild(save);
var sim = el("button", "btn", "Find similar");
sim.type = "button";
sim.onclick = function () { go("find_similar_sites", { id: s.id, limit: 6 }, "Find DesignTaste websites similar to " + s.name + "."); };
acts.appendChild(sim);
var dirMsg = el("div", "tray-msg");
var dir = el("button", "btn btn-iris", "Use as direction");
dir.type = "button";
dir.onclick = function () {
var prompt = "Use " + s.name + " (DesignTaste ID: " + s.id + ") as visual direction. Call get_site with id=\\"" + s.id + "\\" and include_image=true, then adapt its pacing, hierarchy, and craft originally without copying its brand.";
dir.disabled = true;
sendMessage(prompt).then(
function () { dirMsg.textContent = "Sent to your agent."; },
function () { dirMsg.textContent = prompt; dir.disabled = false; }
);
};
acts.appendChild(dir);
info.appendChild(acts);
info.appendChild(dirMsg);
grid.appendChild(info);
body.appendChild(grid);
if (d.similar && d.similar.length) {
body.appendChild(el("div", "subhead", "Similar references"));
var sgrid = el("div", "grid");
d.similar.forEach(function (item) { sgrid.appendChild(buildSiteCard(item)); });
body.appendChild(sgrid);
}
app.appendChild(body);
buildTray(app);
return app;
}
function renderCategories(d) {
var app = buildShell([{ text: "Categories" }], "https://designtaste.wtf/");
var body = el("div", "body");
var grid = el("div", "cat-grid");
(d.categories || []).forEach(function (c) {
var card = el("div", "cat-card");
var head = el("div", "cat-head");
var name = el("button", "cat-name", c.category);
name.type = "button";
name.onclick = function () { go("browse_gallery", { category: c.category, limit: 12 }, "Browse " + c.category + " websites on DesignTaste."); };
head.appendChild(name);
head.appendChild(el("span", "cat-count", c.count + " sites"));
card.appendChild(head);
if (c.previews && c.previews.length) {
var thumbs = el("div", "cat-thumbs");
c.previews.slice(0, 2).forEach(function (p) {
var tb = el("button", "cat-thumb");
tb.type = "button";
tb.title = p.name;
tb.appendChild(makeThumbImg(p, p.name));
tb.onclick = function () { go("get_site", { id: p.id }, "Inspect " + p.name + " on DesignTaste."); };
thumbs.appendChild(tb);
});
card.appendChild(thumbs);
}
if (c.topTags && c.topTags.length) {
var tags = el("div", "tags");
c.topTags.slice(0, 5).forEach(function (t) {
var tb = el("button", "tag-btn", t);
tb.type = "button";
tb.onclick = function () { go("browse_gallery", { category: c.category, tag: t, limit: 12 }, "Browse " + c.category + " sites tagged " + t + " on DesignTaste."); };
tags.appendChild(tb);
});
card.appendChild(tags);
}
grid.appendChild(card);
});
body.appendChild(grid);
app.appendChild(body);
buildTray(app);
return app;
}
function renderList(d) {
var app = buildShell([{ text: d.title || "Saved Moodboard" }], d.url || "https://designtaste.wtf/");
var head = el("div", "list-head");
var left = el("div", "");
var trow = el("div", "list-title-row");
trow.appendChild(el("h1", "", d.title || "Saved Moodboard"));
if (d.id) trow.appendChild(el("span", "id-badge", d.id));
left.appendChild(trow);
left.appendChild(el("div", "list-sub", (d.sites ? d.sites.length : 0) + " curated references \\u00b7 shareable via designtaste.wtf/?list=" + (d.id || "")));
head.appendChild(left);
var acts = el("div", "bar-acts");
var msg = el("div", "tray-msg");
var apply = el("button", "btn btn-primary", "Apply as visual direction");
apply.type = "button";
apply.onclick = function () {
var prompt = "Use my DesignTaste saved list " + d.id + " via the DesignTaste MCP (get_saved_list with include_images=true) as visual direction for this project.";
apply.disabled = true;
sendMessage(prompt).then(
function () { msg.textContent = "Sent to your agent."; },
function () { msg.textContent = prompt; apply.disabled = false; }
);
};
acts.appendChild(apply);
head.appendChild(acts);
head.appendChild(msg);
app.appendChild(head);
var body = el("div", "body");
var grid = el("div", "grid");
(d.sites || []).forEach(function (s) { grid.appendChild(buildSiteCard(s)); });
body.appendChild(grid);
app.appendChild(body);
buildTray(app);
return app;
}
function render(data) {
if (!data || typeof data !== "object") return;
currentData = data;
root.textContent = "";
var node = null;
if (data.kind === "gallery") node = renderGallery(data);
else if (data.kind === "site") node = renderSite(data);
else if (data.kind === "categories") node = renderCategories(data);
else if (data.kind === "list") node = renderList(data);
if (node) root.appendChild(node);
}
// MCP Apps 2026-01-26 bridge
window.addEventListener("message", function (e) {
if (e.source !== window.parent) return;
var m = e.data;
if (!m || m.jsonrpc !== "2.0") return;
if (m.id !== undefined && (m.result !== undefined || m.error !== undefined)) {
var p = pending[m.id];
if (p) {
delete pending[m.id];
if (m.error) p[1](m.error);
else p[0](m.result);
}
return;
}
if (m.method === "ui/notifications/tool-result") {
render(m.params && m.params.structuredContent);
} else if (m.method === "ui/resource-teardown" && m.id !== undefined) {
post({ jsonrpc: "2.0", id: m.id, result: {} });
}
});
// ChatGPT window.openai fallback listener
if (window.openai && window.openai.toolOutput) {
render(window.openai.toolOutput);
}
window.addEventListener("openai:set_globals", function (e) {
var out = e && e.detail && e.detail.globals && e.detail.globals.toolOutput;
if (out) render(out);
});
// Handshake + auto-height reporting
rpc("ui/initialize", {
protocolVersion: "2026-01-26",
appInfo: { name: "designtaste", version: "1.1.0" },
appCapabilities: {},
})
.then(function (r) { hostCaps = (r && r.hostCapabilities) || {}; }, function () {})
.then(function () { notify("ui/notifications/initialized"); });
if (window.ResizeObserver) {
new ResizeObserver(function () {
var rect = document.documentElement.getBoundingClientRect();
notify("ui/notifications/size-changed", {
width: Math.ceil(rect.width),
height: Math.ceil(rect.height),
});
}).observe(document.documentElement);
}
})();
`;
export const APP_HTML = `<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>DesignTaste</title>
<style>${STYLE}</style>
</head>
<body>
<template id="dt-mark">${MARK_SVG}</template>
<div id="root"></div>
<script>${SCRIPT}</script>
</body>
</html>`;