~ knotless Search/
↑↓ move↵ open⇧↵ all results

chadtmiller.com/hud

A remote MCP server that shows atproto records as interactive UI inside MCP Apps hosts

0
0
173 lines · 3.8 KB Raw History
<!doctype html>
<html lang="en">
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1" />
		<title>HUD dev host</title>
		<style>
			:root {
				color-scheme: light;
				font-family: system-ui, sans-serif;
				font-size: 14px;
			}

			:root[data-theme='dark'] {
				color-scheme: dark;
			}

			body {
				margin: 0;
				padding: 16px;
				background: light-dark(#ececea, #111110);
				color: light-dark(#1b1b1a, #f2f2ef);
			}

			form,
			.toggles {
				display: flex;
				flex-wrap: wrap;
				align-items: end;
				gap: 12px;
				margin-bottom: 12px;
			}

			label {
				display: flex;
				flex-direction: column;
				gap: 4px;
			}

			textarea {
				width: min(36rem, 90vw);
				font-family: ui-monospace, monospace;
			}

			fieldset {
				display: flex;
				gap: 8px;
				border: 1px solid light-dark(#cfcfca, #4a4a45);
				border-radius: 6px;
			}

			fieldset label {
				flex-direction: row;
			}

			#account {
				display: flex;
				flex-wrap: wrap;
				align-items: center;
				gap: 8px;
				margin-bottom: 12px;
			}

			#auth-prompt {
				margin: 0 0 12px;
				padding: 8px 12px;
				border: 1px solid light-dark(#e6cf9d, #6a5426);
				border-radius: 6px;
				background: light-dark(#fdf3e1, #392e18);
			}

			#status {
				min-height: 1.5em;
				margin: 0 0 12px;
				color: light-dark(#4e4e49, #c2c2bc);
				white-space: pre-wrap;
			}

			#frame-box {
				margin-bottom: 16px;
			}

			#frame-box.narrow {
				width: 360px;
			}

			#frame-box.pip {
				position: fixed;
				right: 16px;
				bottom: 16px;
				z-index: 1;
				width: 360px;
				max-height: 60vh;
				overflow: auto;
				border-radius: 12px;
				box-shadow: 0 8px 32px rgb(0 0 0 / 0.35);
			}

			iframe {
				display: block;
				width: 100%;
				height: 200px;
				border: 1px solid light-dark(#cfcfca, #4a4a45);
				border-radius: 12px;
				background: light-dark(#ffffff, #1b1b1a);
			}

			h2 {
				margin: 16px 0 4px;
				font-size: 13px;
			}

			pre,
			#log {
				margin: 0;
				font-family: ui-monospace, monospace;
				font-size: 12px;
				white-space: pre-wrap;
				overflow-wrap: anywhere;
			}
		</style>
	</head>
	<body>
		<div id="account">
			<span id="who"></span>
			<button type="button" id="sign-in">Sign in</button>
			<button type="button" id="sign-out" hidden>Sign out</button>
		</div>
		<p id="auth-prompt" role="alert" hidden>
			That call needs you signed in to HUD.
			<button type="button" id="prompt-sign-in">Sign in</button>
		</p>
		<form id="call">
			<label>
				Tool
				<select id="tool"></select>
			</label>
			<label>
				Arguments (JSON)
				<textarea id="args" rows="3" spellcheck="false"></textarea>
			</label>
			<label>
				View (JSON, optional: goes in as the <code>view</code> argument)
				<textarea id="view" rows="3" spellcheck="false" placeholder='{"collection": "…", "list": {"layout": {"component": "List", …}}}'></textarea>
			</label>
			<button type="submit">Call</button>
		</form>
		<div class="toggles">
			<fieldset>
				<legend>Theme</legend>
				<label><input type="radio" name="theme" value="light" checked /> light</label>
				<label><input type="radio" name="theme" value="dark" /> dark</label>
			</fieldset>
			<fieldset>
				<legend>Width</legend>
				<label><input type="radio" name="width" value="narrow" checked /> 360 px</label>
				<label><input type="radio" name="width" value="wide" /> wide</label>
			</fieldset>
			<fieldset>
				<legend>Display</legend>
				<label><input type="radio" name="display" value="inline" checked /> inline</label>
				<label><input type="radio" name="display" value="pip" /> pip</label>
			</fieldset>
		</div>
		<p id="status"></p>
		<div id="frame-box" class="narrow"></div>
		<h2>Text content (what a host without MCP Apps shows)</h2>
		<pre id="text"></pre>
		<h2>Calls the view made</h2>
		<ol id="log"></ol>
		<script type="module" src="./host.ts"></script>
	</body>
</html>