Your own team of AI bots in one self-hosted binary: spaces, every account you have, handoffs, approvals and routines. Open-source, self-hosted alternative to Grok Bot, Claude Duet and OpenAI dots. Rust + React.
Rust ai-agentsai-assistantai-botautomationbotbots-teamchatbotclaude-duetgrokgrok-botgrok-bot-alternativeharnessllmmulti-agentopenai-dotsopenbotpersonal-agentrustself-hostedselfhosted-ai
MCP catalog: 15 verified well-known servers, searchable and grouped
Lin (kwant bot)186a2b5c3286
diff --git a/frontend/src/components/McpServersModal.tsx b/frontend/src/components/McpServersModal.tsxindex b6e36e6f..48f8104e 100644--- a/frontend/src/components/McpServersModal.tsx+++ b/frontend/src/components/McpServersModal.tsx@@ -15,7 +15,6 @@ import {EyeOff,ChevronLeft,Wrench,- Sparkles,CircleDashed,PauseCircle,Zap,@@ -23,6 +22,8 @@ import {ShieldCheck,LogOut,Users,+ Search,+ ExternalLink,} from 'lucide-react';import { playSfx } from '../audio/chiptune';import {@@ -33,7 +34,10 @@ import {McpTransport,SecretRow,StoredStatus,+ McpPreset,MCP_PRESETS,+ searchPresets,+ groupPresets,emptyMcpForm,formToPayload,serverToForm,@@ -136,7 +140,7 @@ const SecretRows: React.FC<{autoComplete="off"value={row.value}onChange={(e) => update(i, { value: e.target.value })}- placeholder={row.saved ? '•••••••• saved, leave blank to keep' : 'Secret value'}+ placeholder={row.saved ? '•••••••• saved, leave blank to keep' : row.hint || 'Secret value'}className={`${inputCls} pr-8 font-mono`}/><button@@ -191,6 +195,88 @@ const ToolChips: React.FC<{ tools: Array<{ name: string; description?: string }>);};+const PresetCatalog: React.FC<{+ query: string;+ onQuery: (q: string) => void;+ onPick: (preset: McpPreset) => void;+ onCustom: () => void;+ autoFocus?: boolean;+}> = ({ query, onQuery, onPick, onCustom, autoFocus }) => {+ const groups = groupPresets(searchPresets(query));+ return (+ <div className="space-y-4 text-left">+ <div className="relative">+ <Search size={14} className="absolute left-3 top-1/2 -translate-y-1/2 text-zinc-500 pointer-events-none" aria-hidden="true" />+ <input+ type="search"+ aria-label="Search servers"+ value={query}+ autoFocus={autoFocus}+ onChange={(e) => onQuery(e.target.value)}+ placeholder={`Search ${MCP_PRESETS.length} servers, like notion or database`}+ className={`${inputCls} pl-8`}+ />+ </div>+ {groups.length === 0 && (+ <p className="py-4 text-center text-xs text-zinc-500">+ Nothing matches “{query.trim()}”. You can still add it as a custom server.+ </p>+ )}+ {groups.map((g) => (+ <section key={g.id} aria-labelledby={`mcp-cat-${g.id}`}>+ <h4 id={`mcp-cat-${g.id}`} className="mb-1.5 text-[11px] font-medium uppercase tracking-wide text-zinc-500">+ {g.label}+ </h4>+ <ul className="grid grid-cols-1 sm:grid-cols-2 gap-2">+ {g.presets.map((p) => (+ <li key={p.id}>+ <button+ type="button"+ onClick={() => onPick(p)}+ className="group w-full h-full p-3 rounded-xl border border-zinc-800 bg-zinc-950/60 hover:border-sky-500/40 hover:bg-sky-500/5 focus-visible:border-sky-500/60 focus-visible:outline-none text-left transition-all"+ >+ <span className="flex items-center gap-1.5 text-xs font-medium text-zinc-200 group-hover:text-sky-200">+ <span className="text-sky-400" aria-hidden="true">+ {p.form.transport === 'stdio' ? <Terminal size={13} /> : <Globe size={13} />}+ </span>+ {p.label}+ </span>+ <span className="mt-1 block text-[11px] text-zinc-500 leading-snug">{p.blurb}</span>+ <span className="mt-2 flex flex-wrap gap-1">+ {(p.needs.length ? p.needs : ['Nothing to install']).map((n) => (+ <span+ key={n}+ className={`px-1.5 py-px rounded border text-[10px] ${+ n === 'Sign-in' || n === 'Token' || n === 'API key'+ ? 'border-amber-500/25 text-amber-300/90'+ : 'border-zinc-700/70 text-zinc-400'+ }`}+ >+ {n}+ </span>+ ))}+ </span>+ </button>+ </li>+ ))}+ </ul>+ </section>+ ))}+ <button+ type="button"+ onClick={onCustom}+ className="w-full flex items-center gap-2.5 p-3 rounded-xl border border-dashed border-zinc-700 hover:border-sky-500/40 hover:bg-sky-500/5 focus-visible:border-sky-500/60 focus-visible:outline-none text-left transition-all"+ >+ <Plus size={16} className="flex-shrink-0 text-sky-400" />+ <span>+ <span className="block text-xs font-medium text-zinc-200">Custom server</span>+ <span className="block text-[11px] text-zinc-500">Paste a command or URL from any server’s README.</span>+ </span>+ </button>+ </div>+ );+};+export const McpServersModal: React.FC<McpServersModalProps> = ({ isOpen, onClose, kwants = [] }) => {const [servers, setServers] = useState<McpServer[] | null>(null);const [loadError, setLoadError] = useState<string | null>(null);@@ -203,6 +289,10 @@ export const McpServersModal: React.FC<McpServersModalProps> = ({ isOpen, onClosconst [form, setForm] = useState<McpFormState>(emptyMcpForm());const [formError, setFormError] = useState<string | null>(null);const [saving, setSaving] = useState(false);+ // Catalog step before the form when adding, its search, and the preset the form came from.+ const [picking, setPicking] = useState(false);+ const [query, setQuery] = useState('');+ const [presetId, setPresetId] = useState<string | null>(null);// Sign-in: the server whose popup is open, sign-in errors per server, and a pending disconnect.const [connecting, setConnecting] = useState<string | null>(null);const [oauthErrors, setOauthErrors] = useState<Record<string, string>>({});@@ -267,6 +357,8 @@ export const McpServersModal: React.FC<McpServersModalProps> = ({ isOpen, onClosuseEffect(() => {if (!isOpen) return;setEditing(null);+ setPicking(false);+ setQuery('');setConfirmDelete(null);setConfirmDisconnect(null);setTestResults({});@@ -314,11 +406,12 @@ export const McpServersModal: React.FC<McpServersModalProps> = ({ isOpen, onClosconst onKey = (e: KeyboardEvent) => {if (e.key !== 'Escape') return;if (editing) setEditing(null);+ else if (picking) setPicking(false);else onClose();};window.addEventListener('keydown', onKey);return () => window.removeEventListener('keydown', onKey);- }, [isOpen, editing, onClose]);+ }, [isOpen, editing, picking, onClose]);if (!isOpen) return null;@@ -389,12 +482,22 @@ export const McpServersModal: React.FC<McpServersModalProps> = ({ isOpen, onClosif (server.enabled) runTest(server.id);};- const openForm = (target: 'new' | McpServer, preset?: McpFormState) => {+ const openCatalog = () => {+ playSfx('click');+ setEditing(null);+ setQuery('');+ setPicking(true);+ };++ const openForm = (target: 'new' | McpServer, preset?: McpPreset) => {playSfx('click');setFormError(null);+ setPicking(false);+ setPresetId(preset?.id ?? null);if (target === 'new') {setEditing('new');- setForm(preset ? { ...preset, env: preset.env.map((r) => ({ ...r })), headers: preset.headers.map((r) => ({ ...r })) } : emptyMcpForm());+ const f = preset?.form;+ setForm(f ? { ...f, env: f.env.map((r) => ({ ...r })), headers: f.headers.map((r) => ({ ...r })) } : emptyMcpForm());} else {setEditing(target.id);setForm(serverToForm(target));@@ -468,6 +571,11 @@ export const McpServersModal: React.FC<McpServersModalProps> = ({ isOpen, onClos};const parsed = splitCommandLine(form.commandLine);+ const preset = editing === 'new' && presetId ? MCP_PRESETS.find((p) => p.id === presetId) : undefined;++ const renderPicker = () => (+ <PresetCatalog query={query} onQuery={setQuery} onPick={(p) => openForm('new', p)} onCustom={() => openForm('new')} autoFocus />+ );const renderEmpty = () => (<div className="text-center py-6 px-2 space-y-5">@@ -479,32 +587,10 @@ export const McpServersModal: React.FC<McpServersModalProps> = ({ isOpen, onClos<p className="text-xs text-zinc-400 leading-relaxed">MCP servers are small add-ons that hand your kwants tools, like reading files, browsing the web or working with GitHub.Add one here and every kwant can use it; switch it off for a kwant in that kwant’s edit screen. They always ask you before using a tool.+ Pick a popular one below and just add your key or sign in.</p></div>- <div className="grid grid-cols-1 sm:grid-cols-3 gap-2 text-left">- {MCP_PRESETS.map((p) => (- <button- key={p.id}- type="button"- onClick={() => openForm('new', p.form)}- className="group p-3 rounded-xl border border-zinc-800 bg-zinc-950/60 hover:border-sky-500/40 hover:bg-sky-500/5 text-left transition-all"- >- <div className="flex items-center gap-1.5 text-xs font-medium text-zinc-200 group-hover:text-sky-200">- <Sparkles size={13} className="text-sky-400" />- {p.label}- </div>- <p className="mt-1 text-[11px] text-zinc-500 leading-snug">{p.blurb}</p>- </button>- ))}- </div>- <button- type="button"- onClick={() => openForm('new')}- className="inline-flex items-center gap-1.5 px-3.5 py-2 rounded-lg text-xs font-medium text-white bg-sky-600 hover:bg-sky-500 transition-colors shadow-sm"- >- <Plus size={14} />- Add your own server- </button>+ <PresetCatalog query={query} onQuery={setQuery} onPick={(p) => openForm('new', p)} onCustom={() => openForm('new')} /></div>);@@ -736,7 +822,7 @@ export const McpServersModal: React.FC<McpServersModalProps> = ({ isOpen, onClos</p><buttontype="button"- onClick={() => openForm('new')}+ onClick={openCatalog}className="flex-shrink-0 inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium text-white bg-sky-600 hover:bg-sky-500 transition-colors shadow-sm whitespace-nowrap"><Plus size={14} />@@ -777,19 +863,32 @@ export const McpServersModal: React.FC<McpServersModalProps> = ({ isOpen, onClos})}</div>{editing === 'new' && (- <div className="mt-2 flex flex-wrap items-center gap-1.5">- <span className="text-[11px] text-zinc-500">Or start from an example:</span>- {MCP_PRESETS.map((p) => (- <button- key={p.id}- type="button"- title={p.blurb}- onClick={() => openForm('new', p.form)}- className="px-2 py-0.5 rounded-full border border-zinc-800 text-[11px] text-zinc-400 hover:text-sky-200 hover:border-sky-500/40 transition-colors"- >- {p.label}- </button>- ))}+ <div className="mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px]">+ {preset ? (+ <span className="text-zinc-400">+ Filled in for <span className="text-zinc-200">{preset.label}</span>.{' '}+ {preset.needs.includes('Sign-in')+ ? 'Add it, then use Connect on its card to sign in.'+ : preset.form.env.length + preset.form.headers.length > 0+ ? 'Add your key below.'+ : preset.form.transport === 'stdio'+ ? 'Check the command, then add it.'+ : 'Just add it.'}{' '}+ <a+ href={preset.source}+ target="_blank"+ rel="noopener noreferrer"+ className="inline-flex items-center gap-0.5 text-sky-300 hover:text-sky-200 underline-offset-2 hover:underline"+ >+ Setup guide+ <ExternalLink size={10} aria-hidden="true" />+ <span className="sr-only">(opens in a new tab)</span>+ </a>+ </span>+ ) : null}+ <button type="button" onClick={openCatalog} className="text-sky-300 hover:text-sky-200 hover:underline underline-offset-2">+ {preset ? 'Pick a different one' : 'Or pick a popular server'}+ </button></div>)}</fieldset>@@ -949,10 +1048,13 @@ export const McpServersModal: React.FC<McpServersModalProps> = ({ isOpen, onClos><div className="flex items-center justify-between gap-3 border-b border-zinc-800 pb-4"><div className="flex items-center gap-2.5 min-w-0">- {editing ? (+ {editing || picking ? (<buttontype="button"- onClick={() => setEditing(null)}+ onClick={() => {+ setEditing(null);+ setPicking(false);+ }}aria-label="Back to servers"className="w-8 h-8 flex-shrink-0 rounded-lg bg-zinc-800/60 border border-zinc-700/60 flex items-center justify-center text-zinc-300 hover:text-zinc-100">@@ -965,10 +1067,12 @@ export const McpServersModal: React.FC<McpServersModalProps> = ({ isOpen, onClos)}<div className="min-w-0"><h2 id="mcp-title" className="text-sm font-semibold text-zinc-100 truncate">- {editing === 'new' ? 'Add a tool server' : editing ? `Edit ${form.name || 'server'}` : 'Tools for your kwants'}+ {editing === 'new' || picking ? 'Add a tool server' : editing ? `Edit ${form.name || 'server'}` : 'Tools for your kwants'}</h2><p className="text-xs text-zinc-400 truncate">- {editing === 'new'+ {picking+ ? 'Pick a popular server or add your own'+ : editing === 'new'? 'Pick how it connects, then fill in the details': editing? 'Saved secrets stay hidden and are kept unless you change them'@@ -986,14 +1090,14 @@ export const McpServersModal: React.FC<McpServersModalProps> = ({ isOpen, onClos</button></div>- {loadError && !editing && (+ {loadError && !editing && !picking && (<p role="alert" className="flex items-center gap-1.5 px-3 py-2 rounded-lg bg-rose-500/5 border border-rose-500/20 text-[11px] text-rose-300"><AlertCircle size={13} />{loadError}</p>)}- {editing ? renderForm() : renderList()}+ {editing ? renderForm() : picking ? renderPicker() : renderList()}</div></div>);diff --git a/frontend/src/mcp.ts b/frontend/src/mcp.tsindex 985c8445..fda61b36 100644--- a/frontend/src/mcp.ts+++ b/frontend/src/mcp.ts@@ -46,6 +46,8 @@ export interface SecretRow {value: string;/** Already stored on the server: a blank value keeps it. */saved: boolean;+ /** Placeholder for an empty value, like the format a preset expects. */+ hint?: string;}export interface McpFormState {@@ -71,44 +73,222 @@ export const emptyMcpForm = (transport: McpTransport = 'stdio'): McpFormState =>timeout_secs: 30,});+export type McpPresetCategory = 'files' | 'web' | 'data' | 'productivity' | 'devtools';++/** Catalog groups, in display order. */+export const MCP_PRESET_CATEGORIES: Array<{ id: McpPresetCategory; label: string }> = [+ { id: 'files', label: 'Files & code' },+ { id: 'web', label: 'Web' },+ { id: 'data', label: 'Data' },+ { id: 'productivity', label: 'Productivity' },+ { id: 'devtools', label: 'Dev tools' },+];++/** What a preset needs before it works, shown as small tags on its card. */+export type McpPresetNeed = 'Node.js' | 'uv' | 'API key' | 'Token' | 'Sign-in';+export interface McpPreset {id: string;label: string;blurb: string;+ category: McpPresetCategory;+ needs: McpPresetNeed[];+ /** Where the setup comes from: the vendor's docs or the package page. */+ source: string;form: McpFormState;}-/** Ready-made examples offered on the empty screen and in the form. */+const stdioPreset = (name: string, commandLine: string, env: Array<[string, string]> = []): McpFormState => ({+ ...emptyMcpForm('stdio'),+ name,+ commandLine,+ env: env.map(([key, hint]) => ({ key, value: '', saved: false, hint })),+});++const httpPreset = (name: string, url: string, headers: Array<[string, string]> = []): McpFormState => ({+ ...emptyMcpForm('http'),+ name,+ url,+ headers: headers.map(([key, hint]) => ({ key, value: '', saved: false, hint })),+});++/**+ * Well-known servers offered as one-click starting points. Built in rather than fetched from a+ * registry, so the list works offline and on a VPS. Each entry was checked against its package+ * or the vendor's docs on 2026-10-17; reference servers that were deprecated were swapped for+ * the vendor's own server. URL servers marked Sign-in support automatic client registration,+ * which kwnt's Connect flow needs.+ */export const MCP_PRESETS: McpPreset[] = [{+ // npm @modelcontextprotocol/server-filesystem 1.0.0id: 'files',label: 'Files in a folder',- blurb: 'Read and write files in one folder you choose. Needs Node.js.',- form: {- ...emptyMcpForm('stdio'),- name: 'files',- commandLine: 'npx -y @modelcontextprotocol/server-filesystem /home/me/projects',- },+ blurb: 'Read and write files in one folder you choose.',+ category: 'files',+ needs: ['Node.js'],+ source: 'https://github.com/modelcontextprotocol/servers/tree/main/src/filesystem',+ form: stdioPreset('files', 'npx -y @modelcontextprotocol/server-filesystem /home/me/projects'),},{- id: 'fetch',- label: 'Read web pages',- blurb: 'Fetch a URL and turn the page into readable text. Needs uv.',- form: { ...emptyMcpForm('stdio'), name: 'fetch', commandLine: 'uvx mcp-server-fetch' },+ // PyPI mcp-server-git 2026.10.10+ id: 'git',+ label: 'Git',+ blurb: 'Status, diffs, history and commits in one local repository.',+ category: 'files',+ needs: ['uv'],+ source: 'https://github.com/modelcontextprotocol/servers/tree/main/src/git',+ form: stdioPreset('git', 'uvx mcp-server-git --repository /home/me/projects/my-repo'),},{+ // GitHub's official remote server. Its sign-in has no automatic client registration, so it+ // takes a personal access token. Replaces the deprecated @modelcontextprotocol/server-github.id: 'github',label: 'GitHub',- blurb: 'Issues, pull requests and code search. Needs a GitHub token.',- form: {- ...emptyMcpForm('stdio'),- name: 'github',- commandLine: 'npx -y @modelcontextprotocol/server-github',- env: [{ key: 'GITHUB_PERSONAL_ACCESS_TOKEN', value: '', saved: false }],- },+ blurb: 'Issues, pull requests, code search and Actions. Paste “Bearer” and your token.',+ category: 'files',+ needs: ['Token'],+ source: 'https://github.com/github/github-mcp-server',+ form: httpPreset('github', 'https://api.githubcopilot.com/mcp/', [['Authorization', 'Bearer ghp_…']]),+ },+ {+ // PyPI mcp-server-fetch 2026.10.10+ id: 'fetch',+ label: 'Read web pages',+ blurb: 'Fetch a URL and turn the page into readable text.',+ category: 'web',+ needs: ['uv'],+ source: 'https://github.com/modelcontextprotocol/servers/tree/main/src/fetch',+ form: stdioPreset('fetch', 'uvx mcp-server-fetch'),+ },+ {+ // npm @playwright/mcp 0.0.83. Headless so it also runs on a server without a screen.+ id: 'playwright',+ label: 'Playwright browser',+ blurb: 'Drive a real browser: open pages, click, fill forms, take screenshots.',+ category: 'web',+ needs: ['Node.js'],+ source: 'https://github.com/microsoft/playwright-mcp',+ form: stdioPreset('playwright', 'npx -y @playwright/mcp@latest --headless'),+ },+ {+ // npm @brave/brave-search-mcp-server 2.1.4. Replaces the deprecated @modelcontextprotocol/server-brave-search.+ id: 'brave-search',+ label: 'Brave Search',+ blurb: 'Web, news and image search through the Brave Search API.',+ category: 'web',+ needs: ['Node.js', 'API key'],+ source: 'https://github.com/brave/brave-search-mcp-server',+ form: stdioPreset('brave-search', 'npx -y @brave/brave-search-mcp-server --transport stdio', [['BRAVE_API_KEY', 'From api-dashboard.search.brave.com']]),+ },+ {+ // Upstash's hosted server; works without a key, a key (Authorization: Bearer …) raises limits.+ id: 'context7',+ label: 'Context7 docs',+ blurb: 'Up-to-date docs and code examples for libraries and frameworks.',+ category: 'web',+ needs: [],+ source: 'https://github.com/upstash/context7',+ form: httpPreset('context7', 'https://mcp.context7.com/mcp'),+ },+ {+ // PyPI postgres-mcp 0.3.0 (Postgres MCP Pro). Replaces the deprecated @modelcontextprotocol/server-postgres.+ // Restricted mode keeps it read-only.+ id: 'postgres',+ label: 'PostgreSQL',+ blurb: 'Read-only queries, schema browsing and index advice for a Postgres database.',+ category: 'data',+ needs: ['uv'],+ source: 'https://github.com/crystaldba/postgres-mcp',+ form: stdioPreset('postgres', 'uvx postgres-mcp --access-mode=restricted', [['DATABASE_URI', 'postgresql://user:password@host:5432/db']]),+ },+ {+ // Supabase's hosted server with sign-in.+ id: 'supabase',+ label: 'Supabase',+ blurb: 'Projects, tables, SQL, logs and edge functions. Sign in after adding.',+ category: 'data',+ needs: ['Sign-in'],+ source: 'https://supabase.com/docs/guides/getting-started/mcp',+ form: httpPreset('supabase', 'https://mcp.supabase.com/mcp'),+ },+ {+ // npm @modelcontextprotocol/server-memory 1.0.0+ id: 'memory',+ label: 'Memory',+ blurb: 'A small knowledge graph kwants can save facts to and recall later.',+ category: 'data',+ needs: ['Node.js'],+ source: 'https://github.com/modelcontextprotocol/servers/tree/main/src/memory',+ form: stdioPreset('memory', 'npx -y @modelcontextprotocol/server-memory'),+ },+ {+ // Notion's hosted server with sign-in.+ id: 'notion',+ label: 'Notion',+ blurb: 'Search, read and edit pages and databases. Sign in after adding.',+ category: 'productivity',+ needs: ['Sign-in'],+ source: 'https://developers.notion.com/docs/mcp',+ form: httpPreset('notion', 'https://mcp.notion.com/mcp'),+ },+ {+ // Linear's hosted server with sign-in.+ id: 'linear',+ label: 'Linear',+ blurb: 'Find, create and update issues, projects and comments. Sign in after adding.',+ category: 'productivity',+ needs: ['Sign-in'],+ source: 'https://linear.app/docs/mcp',+ form: httpPreset('linear', 'https://mcp.linear.app/mcp'),+ },+ {+ // Atlassian's hosted Rovo MCP server with sign-in.+ id: 'atlassian',+ label: 'Jira & Confluence',+ blurb: 'Search and update Jira issues and Confluence pages. Sign in after adding.',+ category: 'productivity',+ needs: ['Sign-in'],+ source: 'https://github.com/atlassian/atlassian-mcp-server',+ form: httpPreset('atlassian', 'https://mcp.atlassian.com/v1/mcp'),+ },+ {+ // Sentry's hosted server with sign-in.+ id: 'sentry',+ label: 'Sentry',+ blurb: 'Look into errors, issues and releases. Sign in after adding.',+ category: 'devtools',+ needs: ['Sign-in'],+ source: 'https://github.com/getsentry/sentry-mcp',+ form: httpPreset('sentry', 'https://mcp.sentry.dev/mcp'),+ },+ {+ // npm @modelcontextprotocol/server-sequential-thinking 1.0.0+ id: 'sequential-thinking',+ label: 'Sequential thinking',+ blurb: 'Helps a kwant plan step by step and revise its plan on hard problems.',+ category: 'devtools',+ needs: ['Node.js'],+ source: 'https://github.com/modelcontextprotocol/servers/tree/main/src/sequentialthinking',+ form: stdioPreset('sequential-thinking', 'npx -y @modelcontextprotocol/server-sequential-thinking'),},];+/** Presets matching a search, by name, blurb, group or what they need. A blank query keeps all. */+export const searchPresets = (query: string, presets: McpPreset[] = MCP_PRESETS): McpPreset[] => {+ const words = query.toLowerCase().split(/\s+/).filter(Boolean);+ if (words.length === 0) return presets;+ const label = (c: McpPresetCategory) => MCP_PRESET_CATEGORIES.find((x) => x.id === c)?.label ?? c;+ return presets.filter((p) => {+ const text = [p.id, p.label, p.blurb, label(p.category), ...p.needs].join(' ').toLowerCase();+ return words.every((w) => text.includes(w));+ });+};++/** Presets grouped for display, in category order, leaving out empty groups. */+export const groupPresets = (presets: McpPreset[]) =>+ MCP_PRESET_CATEGORIES.map((c) => ({ ...c, presets: presets.filter((p) => p.category === c.id) })).filter((g) => g.presets.length > 0);+/** Splits a command line into words, honouring '…' and "…" quotes and backslash escapes. */export const splitCommandLine = (line: string): string[] => {const words: string[] = [];diff --git a/frontend/tests/mcp.test.mjs b/frontend/tests/mcp.test.mjsindex fc09238d..0fae3819 100644--- a/frontend/tests/mcp.test.mjs+++ b/frontend/tests/mcp.test.mjs@@ -10,6 +10,9 @@ const { outputText } = ts.transpileModule(source, {const mcp = await import(`data:text/javascript;base64,${Buffer.from(outputText).toString('base64')}`);const {MCP_PRESETS,+ MCP_PRESET_CATEGORIES,+ searchPresets,+ groupPresets,SECRET_MASK,emptyMcpForm,formToPayload,@@ -112,10 +115,65 @@ test('editing a server never puts the mask in an input, and saving unchanged keeassert.deepEqual([payload.command, ...payload.args], ['npx', '-y', 'a b']);});-test('presets are valid forms with distinct ids', () => {- assert.ok(MCP_PRESETS.length >= 2);+test('presets are valid forms with distinct ids and names', () => {+ assert.ok(MCP_PRESETS.length >= 12);assert.equal(new Set(MCP_PRESETS.map((p) => p.id)).size, MCP_PRESETS.length);- for (const p of MCP_PRESETS) assert.equal(validateMcpForm(p.form), null, p.id);+ assert.equal(new Set(MCP_PRESETS.map((p) => p.form.name)).size, MCP_PRESETS.length);+ assert.equal(new Set(MCP_PRESETS.map((p) => p.label)).size, MCP_PRESETS.length);+ const categories = new Set(MCP_PRESET_CATEGORIES.map((c) => c.id));+ for (const p of MCP_PRESETS) {+ assert.equal(validateMcpForm(p.form), null, p.id);+ assert.ok(categories.has(p.category), `${p.id} category`);+ assert.match(p.source, /^https:\/\//, `${p.id} source`);+ assert.ok(p.blurb.length > 0 && p.blurb.length <= 100, `${p.id} blurb`);+ // Secrets start blank: the user brings their own.+ for (const row of [...p.form.env, ...p.form.headers]) {+ assert.equal(row.value, '', `${p.id} ${row.key}`);+ assert.equal(row.saved, false, `${p.id} ${row.key}`);+ }+ // URL servers are https and keep their keys in headers, never in the address.+ if (p.form.transport === 'http') assert.match(p.form.url, /^https:\/\/[^?#]+$/, p.id);+ // What a preset needs matches how it runs.+ const cmd = splitCommandLine(p.form.commandLine)[0];+ if (cmd === 'npx') assert.ok(p.needs.includes('Node.js'), p.id);+ if (cmd === 'uvx') assert.ok(p.needs.includes('uv'), p.id);+ if (p.needs.includes('Sign-in')) assert.equal(p.form.transport, 'http', p.id);+ }+});++test('presets avoid deprecated reference servers', () => {+ const deprecated = ['server-github', 'server-brave-search', 'server-postgres', 'server-slack', 'mcp-server-sqlite'];+ for (const p of MCP_PRESETS) {+ for (const d of deprecated) assert.ok(!p.form.commandLine.includes(d), `${p.id} uses ${d}`);+ }+});++test('a preset form copies into the payload kwnt expects', () => {+ const github = MCP_PRESETS.find((p) => p.id === 'github');+ const payload = formToPayload({ ...github.form, headers: [{ ...github.form.headers[0], value: 'Bearer t' }] });+ assert.deepEqual(payload.headers, { Authorization: 'Bearer t' });+ assert.equal(payload.url, 'https://api.githubcopilot.com/mcp/');+ const pg = formToPayload(MCP_PRESETS.find((p) => p.id === 'postgres').form);+ assert.deepEqual([pg.command, ...pg.args], ['uvx', 'postgres-mcp', '--access-mode=restricted']);+ assert.deepEqual(Object.keys(pg.env), ['DATABASE_URI']);+});++test('searches presets by name, blurb, group and needs', () => {+ assert.equal(searchPresets('').length, MCP_PRESETS.length);+ assert.equal(searchPresets(' ').length, MCP_PRESETS.length);+ assert.deepEqual(searchPresets('NOTION').map((p) => p.id), ['notion']);+ assert.ok(searchPresets('database').some((p) => p.id === 'postgres'));+ assert.ok(searchPresets('sign-in').every((p) => p.needs.includes('Sign-in')));+ assert.ok(searchPresets('dev tools').some((p) => p.id === 'sentry'));+ assert.deepEqual(searchPresets('zzz-nothing'), []);+});++test('groups presets in category order and drops empty groups', () => {+ const groups = groupPresets(MCP_PRESETS);+ assert.deepEqual(groups.map((g) => g.id), MCP_PRESET_CATEGORIES.map((c) => c.id));+ assert.equal(groups.reduce((n, g) => n + g.presets.length, 0), MCP_PRESETS.length);+ assert.deepEqual(groupPresets(searchPresets('notion')).map((g) => g.id), ['productivity']);+ assert.deepEqual(groupPresets([]), []);});test('reads MCP tool names and recorded tool calls', () => {