MCP Endpoint & Token Card
Developer-grade MCP setup card: one-click copy server URL, a hidden API token with show and copy, ready-to-paste setup for Claude Code, Antigravity, Cursor, and Codex, plus Rotate and Revoke actions that confirm first and show what changed.
Install UI SDK & packages
npm install @ui-sdk/react @ui-sdk/core lucide-react
Give your agent the UI SDK skill
npx skills add vercel-labs/ui --skill ui-sdk
"use client"; import * as React from "react"; import { Ban, Check, CircleCheck, Copy, Eye, EyeOff, Plug, Plus, RefreshCw, type LucideIcon } from "lucide-react"; import { AlertDialog, AlertDialogBackdrop, AlertDialogClose, AlertDialogContent, AlertDialogDescription, AlertDialogTitle, AlertDialogTrigger, } from "@ui-sdk/react/alert-dialog"; import { Button } from "@ui-sdk/react/button"; import { Field, FieldDescription, FieldLabel } from "@ui-sdk/react/field"; import { Input } from "@ui-sdk/react/input"; import { PasswordInput, PasswordInputControl, PasswordInputToggle } from "@ui-sdk/react/password-input"; import { Tabs, TabsList, TabsPanel, TabsTab } from "@ui-sdk/react/tabs"; const card = "rounded-2xl border border-[#d8e0ea] bg-white shadow-[0_18px_44px_rgba(15,23,42,0.12)] dark:border-slate-400/20 dark:bg-[#111827] dark:shadow-[0_24px_60px_rgba(0,0,0,0.5)]"; const labelCls = "block text-[13px] font-semibold leading-snug text-slate-800 dark:text-slate-200"; const hintCls = "text-xs leading-relaxed text-slate-600 dark:text-slate-400"; const fieldBase = "w-full min-w-0 rounded-[10px] border-[1.5px] border-slate-300 bg-white text-sm font-medium text-slate-900 shadow-[0_1px_2px_rgba(15,23,42,0.06)] outline-none transition-[border-color,box-shadow] hover:border-slate-400 focus:border-sky-600 focus:ring-[3px] focus:ring-sky-600/25 dark:border-slate-400/35 dark:bg-[#182234] dark:text-slate-50 dark:shadow-[inset_0_1px_2px_rgba(0,0,0,0.35)] dark:hover:border-slate-400/55 dark:focus:border-sky-400 dark:focus:ring-sky-400/30"; const inputCls = `${fieldBase} h-11 px-3.5`; const btnBase = "inline-flex cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-[10px] font-bold transition hover:-translate-y-px active:translate-y-px disabled:pointer-events-none disabled:opacity-50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-sky-500"; const btnMd = "h-11 px-4 text-sm"; const btnSm = "h-9 px-3 text-[13px]"; const btnPrimary = `${btnBase} border border-sky-300/60 bg-linear-to-b from-sky-300 via-sky-400 to-sky-600 text-[#031521] shadow-[inset_0_1px_0_rgba(255,255,255,0.55),inset_0_-2px_0_rgba(3,55,86,0.35),0_8px_20px_rgba(2,132,199,0.25)] hover:brightness-105`; const btnGhost = `${btnBase} border border-slate-300 bg-linear-to-b from-white to-slate-100 text-slate-900 shadow-[inset_0_1px_0_rgba(255,255,255,0.95),inset_0_-1.5px_0_rgba(15,23,42,0.08),0_1px_2px_rgba(15,23,42,0.06)] hover:border-slate-400 dark:border-slate-400/35 dark:from-[#243047] dark:to-[#182234] dark:text-slate-50 dark:shadow-[inset_0_1px_0_rgba(255,255,255,0.09),inset_0_-1.5px_0_rgba(0,0,0,0.35)] dark:hover:border-slate-400/55`; const btnDanger = `${btnBase} border border-red-200/45 bg-linear-to-b from-red-500 via-red-600 to-red-700 text-white shadow-[inset_0_1px_0_rgba(255,255,255,0.3),inset_0_-2px_0_rgba(127,29,29,0.55),0_8px_20px_rgba(220,38,38,0.32)] hover:brightness-110 focus-visible:outline-red-400`; const btnDangerSoft = `${btnBase} border-[1.5px] border-red-300 bg-red-50 text-red-800 hover:border-red-700 hover:bg-red-600 hover:text-white dark:border-red-400/65 dark:bg-linear-to-b dark:from-red-600/30 dark:to-red-800/40 dark:text-rose-50 dark:hover:border-red-400 dark:hover:from-red-600 dark:hover:to-red-600 dark:hover:text-white focus-visible:outline-red-400`; const hairline = "border-[#d8e0ea] dark:border-slate-400/20"; const tabCls = "inline-flex h-9 cursor-pointer items-center justify-center whitespace-nowrap rounded-lg px-3 text-[13px] font-semibold text-slate-600 transition hover:bg-slate-900/5 hover:text-slate-900 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-sky-500 data-selected:bg-sky-700 data-selected:font-bold data-selected:text-white max-sm:h-10 dark:text-slate-400 dark:hover:bg-slate-400/15 dark:hover:text-slate-50 dark:data-selected:bg-sky-400 dark:data-selected:text-[#031521]"; type ClientId = "claude" | "antigravity" | "cursor" | "codex"; type CopyTarget = "url" | "token" | "snippet"; const CLIENTS: { id: ClientId; label: string; hint: string }[] = [ { id: "claude", label: "Claude Code", hint: "Run this in your terminal" }, { id: "antigravity", label: "Antigravity", hint: "Add to ~/.gemini/antigravity/mcp_config.json" }, { id: "cursor", label: "Cursor", hint: "Add to .cursor/mcp.json" }, { id: "codex", label: "Codex", hint: "Set the token, then add this to ~/.codex/config.toml" }, ]; function maskToken(token: string) { return `${token.slice(0, 10)}${"•".repeat(12)}${token.slice(-4)}`; } function buildSnippet(client: ClientId, serverName: string, endpoint: string, token: string) { const auth = `Bearer ${token}`; const envName = `${serverName.toUpperCase().replace(/[^A-Z0-9]+/g, "_")}_MCP_TOKEN`; switch (client) { case "claude": return `claude mcp add --transport http ${serverName} ${endpoint} \\\n --header "Authorization: ${auth}"`; case "antigravity": return JSON.stringify({ mcpServers: { [serverName]: { serverUrl: endpoint, headers: { Authorization: auth } } } }, null, 2); case "cursor": return JSON.stringify({ mcpServers: { [serverName]: { url: endpoint, headers: { Authorization: auth } } } }, null, 2); case "codex": return `export ${envName}="${token}"\n\n[mcp_servers.${serverName}]\nurl = "${endpoint}"\nbearer_token_env_var = "${envName}"`; } } function CopyButton({ label, copied, size = btnMd, onCopy, disabled, }: { label: string; copied: boolean; size?: string; onCopy: () => void; disabled?: boolean; }) { return ( <Button aria-label={label} onClick={onCopy} disabled={disabled} className={`${btnGhost} ${size} shrink-0`}> {copied ? <Check className="size-4" aria-hidden="true" /> : <Copy className="size-4" aria-hidden="true" />} <span className="max-sm:hidden">{copied ? "Copied" : "Copy"}</span> </Button> ); } function ConfirmAction({ triggerLabel, triggerClass, icon: Icon, tone, title, body, confirmLabel, agentConfirm, onConfirm, }: { triggerLabel: string; triggerClass: string; icon: LucideIcon; tone: "info" | "danger"; title: string; body: string; confirmLabel: string; agentConfirm: string; onConfirm: () => unknown; }) { return ( <AlertDialog> <AlertDialogTrigger className={`${triggerClass} ${btnMd} max-sm:flex-1`}> <Icon className="size-4" aria-hidden="true" /> <span>{triggerLabel}</span> </AlertDialogTrigger> <AlertDialogBackdrop className="fixed inset-0 z-50 bg-slate-900/45 backdrop-blur-[3px] dark:bg-[#04070d]/70" /> <AlertDialogContent className={`${card} fixed inset-0 z-50 m-auto h-fit w-[min(28rem,calc(100vw-1.75rem))] overflow-hidden p-0`}> <div className="p-5 sm:p-6"> <span className={ tone === "danger" ? "grid size-11 place-items-center rounded-xl bg-red-50 text-red-700 dark:bg-red-400/15 dark:text-red-300" : "grid size-11 place-items-center rounded-xl bg-sky-600/10 text-sky-700 dark:bg-sky-400/15 dark:text-sky-300" } > <Icon className="size-[22px]" aria-hidden="true" /> </span> <AlertDialogTitle className="mt-3.5 text-lg font-bold tracking-tight text-slate-900 dark:text-slate-50">{title}</AlertDialogTitle> <AlertDialogDescription className="mt-1.5 text-sm leading-relaxed text-slate-600 dark:text-slate-400">{body}</AlertDialogDescription> </div> <div className={`flex flex-col-reverse gap-2.5 border-t bg-slate-50 px-5 py-3.5 sm:flex-row sm:justify-end sm:px-6 dark:bg-[#162033] ${hairline}`}> <AlertDialogClose className={`${btnGhost} ${btnMd}`}>Cancel</AlertDialogClose> <AlertDialogClose value="confirm" action={onConfirm} data-agent-confirm={agentConfirm} className={`${tone === "danger" ? btnDanger : btnPrimary} ${btnMd}`} > <Icon className="size-4" aria-hidden="true" /> <span>{confirmLabel}</span> </AlertDialogClose> </div> </AlertDialogContent> </AlertDialog> ); } export function McpConnectionCard({ title = "Connect Snow to your AI tools", description = "One link gives Claude Code, Antigravity, Cursor, and Codex your whole component library.", serverName = "snow", endpoint = "https://snow.wynter.ai/mcp", token, tokenNote, defaultClient = "claude", onRotateToken, onRevokeToken, onCreateToken, }: { title?: string; description?: string; serverName?: string; endpoint?: string; /** The current API token. Pass null (or nothing) once it has been revoked. */ token?: string | null; tokenNote?: string; defaultClient?: ClientId; onRotateToken?: () => Promise<void> | void; onRevokeToken?: () => Promise<void> | void; onCreateToken?: () => Promise<void> | void; }) { const [client, setClient] = React.useState<ClientId>(defaultClient); const [visible, setVisible] = React.useState(false); const [copied, setCopied] = React.useState<CopyTarget | null>(null); const copy = (target: CopyTarget, text: string) => { void navigator.clipboard?.writeText(text); setCopied(target); window.setTimeout(() => setCopied((current) => (current === target ? null : current)), 1600); }; const shownToken = token ? (visible ? token : maskToken(token)) : "<your-token>"; return ( <section className={`${card} mx-auto grid w-full max-w-[720px] gap-[18px] p-4 text-slate-900 sm:p-[22px] dark:text-slate-50`}> <header className="flex flex-wrap items-center gap-3"> <span className="grid size-10 shrink-0 place-items-center rounded-[11px] bg-sky-600/10 text-sky-700 dark:bg-sky-400/15 dark:text-sky-300"> <Plug className="size-5" aria-hidden="true" /> </span> <div className="min-w-0 flex-1 basis-60"> <h2 className="text-[19px] font-bold tracking-tight">{title}</h2> <p className="text-[13px] text-slate-600 dark:text-slate-400">{description}</p> </div> {token ? ( <span className="inline-flex h-[22px] items-center gap-1 rounded-full border border-emerald-600/40 bg-emerald-50 px-2 text-[11.5px] font-bold whitespace-nowrap text-emerald-700 dark:border-emerald-400/40 dark:bg-emerald-400/15 dark:text-emerald-300"> <CircleCheck className="size-3" aria-hidden="true" /> Token active </span> ) : ( <span className="inline-flex h-[22px] items-center gap-1 rounded-full border border-red-600/45 bg-red-50 px-2 text-[11.5px] font-bold whitespace-nowrap text-red-800 dark:border-red-400/45 dark:bg-red-400/15 dark:text-red-300"> <Ban className="size-3" aria-hidden="true" /> No active token </span> )} </header> <Field name="mcp_url" className="flex min-w-0 flex-col gap-1.5"> <FieldLabel className={labelCls}>Server URL</FieldLabel> <div className="grid grid-cols-[minmax(0,1fr)_auto] gap-2"> <Input readOnly value={endpoint} onFocus={(event) => event.currentTarget.select()} className={`${inputCls} font-mono`} /> <CopyButton label="Copy server URL" copied={copied === "url"} onCopy={() => copy("url", endpoint)} /> </div> </Field> <Field name="mcp_token" className="flex min-w-0 flex-col gap-1.5"> <FieldLabel className={labelCls}>API token</FieldLabel> {tokenNote && <FieldDescription className={hintCls}>{tokenNote}</FieldDescription>} <div className="grid grid-cols-[minmax(0,1fr)_auto] gap-2"> {token ? ( <PasswordInput value={token} readOnly autoComplete="off" visible={visible} onVisibleChange={setVisible} className="relative flex min-w-0 items-center" > <PasswordInputControl className={`${fieldBase} h-11 pr-11 pl-3.5 font-mono`} /> <PasswordInputToggle aria-label={visible ? "Hide token" : "Show token"} className="absolute right-1.5 grid size-8 cursor-pointer place-items-center rounded-lg text-slate-600 hover:bg-slate-900/5 hover:text-slate-900 focus-visible:outline-2 focus-visible:outline-sky-500 dark:text-slate-300 dark:hover:bg-slate-400/15 dark:hover:text-slate-50" > {visible ? <EyeOff className="size-4" aria-hidden="true" /> : <Eye className="size-4" aria-hidden="true" />} </PasswordInputToggle> </PasswordInput> ) : ( <Input readOnly value="No active token" className={`${inputCls} font-mono`} /> )} <CopyButton label="Copy API token" copied={copied === "token"} disabled={!token} onCopy={() => token && copy("token", token)} /> </div> </Field> <Tabs value={client} onValueChange={(next) => { if (next) setClient(next); }} className={`grid min-w-0 gap-2.5 border-t pt-[18px] ${hairline}`} > <div className="flex flex-wrap items-center justify-between gap-2.5"> <h3 className="text-[15px] font-bold tracking-tight">Add it to your tool</h3> <TabsList aria-label="MCP client" className={`grid grid-cols-2 gap-0.5 rounded-[11px] border bg-slate-50 p-[3px] max-sm:w-full sm:flex dark:bg-[#162033] ${hairline}`} > {CLIENTS.map((item) => ( <TabsTab key={item.id} value={item.id} className={tabCls}> {item.label} </TabsTab> ))} </TabsList> </div> {CLIENTS.map((item) => ( <TabsPanel key={item.id} value={item.id} className={`min-w-0 overflow-hidden rounded-xl border bg-slate-50 dark:bg-[#162033] ${hairline}`} > <div className={`flex items-center justify-between gap-2.5 border-b py-2 pr-2 pl-3.5 ${hairline}`}> <span className="min-w-0 text-[12.5px] font-semibold text-slate-600 dark:text-slate-400">{item.hint}</span> <CopyButton label="Copy setup" size={btnSm} copied={copied === "snippet"} onCopy={() => copy("snippet", buildSnippet(item.id, serverName, endpoint, token ?? "<your-token>"))} /> </div> <pre className="overflow-x-auto p-3.5 font-mono text-[12.5px] leading-relaxed text-slate-800 dark:text-slate-200"> <code>{buildSnippet(item.id, serverName, endpoint, shownToken)}</code> </pre> </TabsPanel> ))} </Tabs> <footer className={`flex flex-wrap items-center justify-between gap-3 border-t pt-[18px] ${hairline}`}> <p className="max-w-[44ch] text-[13px] text-slate-600 dark:text-slate-400"> {token ? "Rotating gives you a fresh token and switches the old one off." : "Your tools can't connect until you create a new token."} </p> <div className="flex flex-wrap gap-2.5 max-sm:w-full"> {token ? ( <> <ConfirmAction triggerLabel="Rotate token" triggerClass={btnGhost} icon={RefreshCw} tone="info" title="Rotate this token?" body="You'll get a fresh token right away. Any tool still using the old one stops connecting until you paste in the new one." confirmLabel="Rotate token" agentConfirm="Replaces the current API token with a new one" onConfirm={async () => { await onRotateToken?.(); setVisible(true); }} /> <ConfirmAction triggerLabel="Revoke" triggerClass={btnDangerSoft} icon={Ban} tone="danger" title="Revoke this token?" body="Claude Code, Antigravity, Cursor, and Codex lose access straight away. You can create a new token whenever you're ready." confirmLabel="Revoke token" agentConfirm="Switches off the current API token for every connected tool" onConfirm={async () => { await onRevokeToken?.(); setVisible(false); }} /> </> ) : ( <Button onClick={() => onCreateToken?.()} className={`${btnPrimary} ${btnMd} max-sm:flex-1`}> <Plus className="size-4" aria-hidden="true" /> <span>Create new token</span> </Button> )} </div> </footer> </section> ); } export default McpConnectionCard;
More in Forms & Settings
AI Prompt Composer & Grouped Model Selector
MSAI chat composer with auto-growing textarea (Enter to send, Shift+Enter newline), file attachment chips, connected integration pills, and a grouped Model Selector featuring an Auto default plus provider groups with pricing and capability tags.
Inline Builder Context & Picker Strip
MSAI full-width builder context strip where picking happens inline via anchored dropdowns instead of modal detours. Icon-led cells omit noisy uppercase eyebrow text on the bar and keep explanations in accessible tooltips.
Settings Sub-Tabs with Guide Rail
Template Factory-style settings screen: solid-fill sub-tabs, readable raised inputs, selects and switches, a Save bar that tracks unsaved changes, a Danger Zone with confirmation dialogs, and a plain-English guide rail that follows the tab and stacks below on tablet and mobile.