{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "agent-ops-05",
  "title": "MCP install",
  "description": "Pick an editor and its exact config crossfades in, Remote or Local and the project switch light the lines they change, and after Copy the edge of the card takes the colour of that editor and waits for its first connection.",
  "dependencies": [
    "motion"
  ],
  "registryDependencies": [
    "https://ui.ndekocode.dev/r/agent-run.json",
    "https://ui.ndekocode.dev/r/animated-size.json",
    "https://ui.ndekocode.dev/r/brand-logos.json",
    "https://ui.ndekocode.dev/r/brand-tile.json",
    "https://ui.ndekocode.dev/r/button.json",
    "https://ui.ndekocode.dev/r/chat-motion.json",
    "https://ui.ndekocode.dev/r/demonstration.json",
    "https://ui.ndekocode.dev/r/icons.json",
    "https://ui.ndekocode.dev/r/json-view.json",
    "https://ui.ndekocode.dev/r/letter-tile.json",
    "https://ui.ndekocode.dev/r/live-duration.json",
    "https://ui.ndekocode.dev/r/live-region.json",
    "https://ui.ndekocode.dev/r/motion-presets.json",
    "https://ui.ndekocode.dev/r/replay-button.json",
    "https://ui.ndekocode.dev/r/spinner.json",
    "https://ui.ndekocode.dev/r/theme.json",
    "https://ui.ndekocode.dev/r/toggle-group.json",
    "https://ui.ndekocode.dev/r/use-session.json",
    "https://ui.ndekocode.dev/r/use-timeouts.json",
    "https://ui.ndekocode.dev/r/utils.json"
  ],
  "files": [
    {
      "path": "registry/ndeko/blocks/agent-ops/agent-ops-05/index.tsx",
      "content": "'use client';\n\nimport { useSession } from '@/registry/ndeko/hooks/use-session';\nimport { useTimeouts } from '@/registry/ndeko/hooks/use-timeouts';\nimport { seriesColorOf } from '@/registry/ndeko/lib/agent-run';\nimport { spokenUnless } from '@/registry/ndeko/lib/demonstration';\nimport { CheckIcon } from '@/registry/ndeko/lib/icons';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { BrandTile } from '@/registry/ndeko/ui/brand-tile';\nimport { Fold, Swap } from '@/registry/ndeko/ui/chat-motion';\nimport { ClockGate } from '@/registry/ndeko/ui/live-duration';\nimport { LiveRegion } from '@/registry/ndeko/ui/live-region';\nimport { ReplayButton } from '@/registry/ndeko/ui/replay-button';\nimport { Spinner } from '@/registry/ndeko/ui/spinner';\n\nimport { EditorTiles, OptionSwitch, type Option } from './choices';\nimport { ConfigBlock } from './config-block';\nimport {\n  editorOf,\n  SERVER,\n  snippetOf,\n  type Editor,\n  type Scope,\n  type Snippet,\n  type Transport,\n} from './data';\nimport {\n  CONNECT_MS,\n  INITIAL,\n  LOOP_AFTER_MS,\n  reducer,\n  RESTING,\n  SCRIPT,\n  type Connection,\n} from './session';\n\nconst SESSION = {\n  reducer,\n  initial: INITIAL,\n  resting: RESTING,\n  script: SCRIPT,\n  loopAfter: LOOP_AFTER_MS,\n};\n\nconst TRANSPORTS: Option<Transport>[] = [\n  { value: 'remote', label: 'Remote' },\n  { value: 'local', label: 'Local' },\n];\n\nconst SCOPES: Option<Scope>[] = [\n  { value: 'project', label: 'This project' },\n  { value: 'everywhere', label: 'Everywhere' },\n];\n\ntype EdgeStyle = React.CSSProperties & { '--edge': string };\n\n/** The edge takes the colour of the editor the card waits for, and keeps it once connected. */\nfunction edgeOf(isLit: boolean) {\n  if (isLit) {\n    return 'ring-2 ring-(--edge)';\n  }\n  return 'hairline-ring ring-border';\n}\n\n/** An editor with one list of servers has no project choice to offer. */\nfunction shownScopeOf(editor: Editor, scope: Scope): Scope {\n  if (editor.scopeNote) {\n    return 'everywhere';\n  }\n  return scope;\n}\n\nfunction idleLineOf(snippet: Snippet, editor: Editor) {\n  if (snippet.language === 'bash') {\n    return 'Copy the command and run it in a terminal';\n  }\n  if (snippet.language === 'fields') {\n    return `Copy the values into the MCP settings of ${editor.name}`;\n  }\n  return `Copy the config into ${snippet.label}`;\n}\n\nfunction toolsWordOf(count: number) {\n  if (count === 1) {\n    return '1 tool';\n  }\n  return `${count} tools`;\n}\n\nfunction statusLineOf(\n  connection: Connection,\n  snippet: Snippet,\n  editor: Editor\n) {\n  if (connection === 'waiting') {\n    return `Waiting for the first connection from ${editor.name}`;\n  }\n  if (connection === 'connected') {\n    return `Connected, ${toolsWordOf(SERVER.toolCount)}`;\n  }\n  return idleLineOf(snippet, editor);\n}\n\nfunction statusToneOf(connection: Connection) {\n  if (connection === 'idle') {\n    return 'text-muted-foreground';\n  }\n  return 'text-foreground';\n}\n\nexport default function AgentOps05() {\n  const {\n    ref,\n    isInView,\n    isAutoplaying,\n    state,\n    act,\n    pressed,\n    isFinished,\n    restart,\n  } = useSession(SESSION);\n  const { schedule } = useTimeouts();\n  const editor = editorOf(state.editorId);\n  const scope = shownScopeOf(editor, state.scope);\n  const snippet = snippetOf(editor.id, state.transport, scope);\n  const configKey = `${editor.id}:${state.transport}:${scope}`;\n  const isCopied = state.connection !== 'idle';\n  const isWaiting = state.connection === 'waiting';\n  const isConnected = state.connection === 'connected';\n  const hasScopeNote = editor.scopeNote !== undefined;\n  const statusLine = statusLineOf(state.connection, snippet, editor);\n  const edgeStyle: EdgeStyle = { '--edge': seriesColorOf(editor.series) };\n  const message = spokenUnless(isAutoplaying, statusLine);\n  const canReplay = isFinished && !isAutoplaying;\n\n  async function copy() {\n    try {\n      await navigator.clipboard.writeText(snippet.copyText);\n    } catch {\n      return;\n    }\n    act({ type: 'copied' });\n    schedule(() => act({ type: 'connected' }), CONNECT_MS);\n  }\n\n  return (\n    <ClockGate isActive={isInView}>\n      <div\n        ref={ref}\n        className='bg-background text-foreground @container min-h-dvh w-full'\n      >\n        <div className='mx-auto flex max-w-2xl flex-col gap-5 p-4 @3xl:p-8'>\n          <header className='flex flex-wrap items-center gap-x-3 gap-y-2'>\n            <BrandTile brand='mcp' size='lg' />\n            <div className='flex min-w-40 flex-1 flex-col gap-0.5 leading-tight'>\n              <h1 className='text-lg font-semibold text-balance'>\n                Add {SERVER.title} to your editor\n              </h1>\n              <code className='text-muted-foreground truncate font-mono text-xs'>\n                {SERVER.url}\n              </code>\n            </div>\n            <ReplayButton\n              isShown={canReplay}\n              onReplay={restart}\n              label='Replay the install'\n            />\n          </header>\n\n          <section\n            aria-label='Install'\n            style={edgeStyle}\n            className={cn(\n              'bg-card dark:bg-foreground/[0.03] flex flex-col gap-4 rounded-xl p-4 shadow-[0_1px_2px_rgb(0_0_0/0.04)] transition-shadow duration-300 ease-(--ease-out-strong)',\n              edgeOf(isCopied)\n            )}\n          >\n            <EditorTiles\n              value={editor.id}\n              onValueChange={(id) => act({ type: 'editor', id })}\n            />\n\n            <div className='flex flex-col gap-2'>\n              <div className='flex flex-wrap items-center gap-2'>\n                <OptionSwitch\n                  label='Where the server runs'\n                  value={state.transport}\n                  options={TRANSPORTS}\n                  onValueChange={(transport) =>\n                    act({ type: 'transport', transport })\n                  }\n                  className='w-40'\n                />\n                <OptionSwitch\n                  label='Where the editor uses it'\n                  value={scope}\n                  options={SCOPES}\n                  isDisabled={hasScopeNote}\n                  onValueChange={(next) => act({ type: 'scope', scope: next })}\n                  className='w-52'\n                />\n              </div>\n              <Fold open={hasScopeNote}>\n                <p className='text-muted-foreground text-xs'>\n                  {editor.scopeNote}\n                </p>\n              </Fold>\n            </div>\n\n            <ConfigBlock\n              editorId={editor.id}\n              configKey={configKey}\n              snippet={snippet}\n              isCopied={isCopied}\n              isCopyPressed={pressed === 'copy'}\n              onCopy={copy}\n            />\n\n            <p\n              className={cn(\n                'flex min-h-6 items-center gap-2 text-[13px] transition-colors duration-200',\n                statusToneOf(state.connection)\n              )}\n            >\n              <Swap swapKey={state.connection} className='size-4 shrink-0'>\n                {isWaiting && <Spinner label='Waiting' />}\n                {isConnected && (\n                  <CheckIcon className='text-success-foreground size-4' />\n                )}\n                {!isCopied && (\n                  <span\n                    aria-hidden='true'\n                    className='bg-muted-foreground/40 m-auto size-1.5 rounded-full'\n                  />\n                )}\n              </Swap>\n              <Swap swapKey={statusLine}>{statusLine}</Swap>\n            </p>\n          </section>\n        </div>\n        <LiveRegion message={message} />\n      </div>\n    </ClockGate>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/agent-ops-05/index.tsx"
    },
    {
      "path": "registry/ndeko/blocks/agent-ops/agent-ops-05/choices.tsx",
      "content": "'use client';\n\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { BrandTile } from '@/registry/ndeko/ui/brand-tile';\nimport { LetterTile } from '@/registry/ndeko/ui/letter-tile';\nimport { ToggleGroup, ToggleGroupItem } from '@/registry/ndeko/ui/toggle-group';\n\nimport { EDITORS, type Editor, type EditorId } from './data';\n\nconst THUMB =\n  'bg-card shadow-[0_1px_2px_rgb(0_0_0/0.08)] hairline-ring ring-foreground/10 dark:bg-foreground/[0.09] dark:ring-foreground/15';\n\nfunction EditorMark({ editor }: { editor: Editor }) {\n  if (editor.brand) {\n    return <BrandTile brand={editor.brand} size='lg' />;\n  }\n  return <LetterTile initial={editor.initial} size='lg' />;\n}\n\ntype EditorTilesProps = {\n  value: EditorId;\n  onValueChange: (id: EditorId) => void;\n};\n\nexport function EditorTiles({ value, onValueChange }: EditorTilesProps) {\n  function change(values: unknown[]) {\n    const [next] = values;\n    const editor = EDITORS.find((candidate) => candidate.id === next);\n    if (editor) {\n      onValueChange(editor.id);\n    }\n  }\n\n  return (\n    <ToggleGroup\n      aria-label='Editor'\n      value={[value]}\n      onValueChange={change}\n      travel\n      indicatorClassName={THUMB}\n      className='bg-foreground/[0.04] grid w-full grid-cols-3 gap-1 rounded-xl p-1 @xl:grid-cols-6'\n    >\n      {EDITORS.map((editor) => (\n        <ToggleGroupItem\n          key={editor.id}\n          value={editor.id}\n          className='h-auto min-w-0 flex-col gap-1.5 rounded-lg px-1 py-2.5 text-xs'\n        >\n          <EditorMark editor={editor} />\n          <span className='max-w-full truncate'>{editor.name}</span>\n        </ToggleGroupItem>\n      ))}\n    </ToggleGroup>\n  );\n}\n\nexport type Option<Value extends string> = {\n  value: Value;\n  label: string;\n};\n\ntype OptionSwitchProps<Value extends string> = {\n  label: string;\n  value: Value;\n  options: readonly Option<Value>[];\n  isDisabled?: boolean;\n  onValueChange: (value: Value) => void;\n  className?: string;\n};\n\n/** A segmented switch that can be locked when the editor leaves no choice. */\nexport function OptionSwitch<Value extends string>({\n  label,\n  value,\n  options,\n  isDisabled = false,\n  onValueChange,\n  className,\n}: OptionSwitchProps<Value>) {\n  function change(values: unknown[]) {\n    const [next] = values;\n    const option = options.find((candidate) => candidate.value === next);\n    if (option) {\n      onValueChange(option.value);\n    }\n  }\n\n  return (\n    <ToggleGroup\n      aria-label={label}\n      value={[value]}\n      onValueChange={change}\n      disabled={isDisabled}\n      travel\n      size='sm'\n      indicatorClassName={THUMB}\n      className={cn('bg-foreground/[0.05] rounded-lg p-0.5', className)}\n    >\n      {options.map((option) => (\n        <ToggleGroupItem\n          key={option.value}\n          value={option.value}\n          className='h-6 flex-1 rounded-md px-2.5 text-xs'\n        >\n          {option.label}\n        </ToggleGroupItem>\n      ))}\n    </ToggleGroup>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/agent-ops-05/choices.tsx"
    },
    {
      "path": "registry/ndeko/blocks/agent-ops/agent-ops-05/config-block.tsx",
      "content": "'use client';\n\nimport { AnimatePresence, motion } from 'motion/react';\nimport { useState } from 'react';\n\nimport {\n  CheckIcon,\n  CopyIcon,\n  FileTextIcon,\n  SlidersIcon,\n  TerminalIcon,\n} from '@/registry/ndeko/lib/icons';\nimport { FADE } from '@/registry/ndeko/lib/motion-presets';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { AnimatedSize } from '@/registry/ndeko/ui/animated-size';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport { Swap } from '@/registry/ndeko/ui/chat-motion';\nimport { jsonTokensOf } from '@/registry/ndeko/ui/json-view';\n\nimport type { EditorId, Snippet, SnippetLanguage } from './data';\n\nconst NO_LINES: string[] = [];\n\nconst FADE_IN = { opacity: 1 };\n\nconst FADE_OUT = { opacity: 0 };\n\nconst TOKEN_CLASS: Record<string, string> = {\n  key: 'text-foreground',\n  string: 'text-primary-ink',\n  number: 'text-muted-foreground',\n  literal: 'text-muted-foreground',\n  mark: 'text-muted-foreground/60',\n  space: '',\n};\n\ntype Shown = {\n  key: string;\n  editorId: EditorId;\n  lines: string[];\n  /** The lines the last change of an option brought in. */\n  fresh: string[];\n};\n\n/** A line is fresh when an option changed it; a new editor brings a whole new config and none is. */\nfunction freshLinesOf(\n  isSameEditor: boolean,\n  before: string[],\n  after: string[]\n) {\n  if (!isSameEditor) {\n    return NO_LINES;\n  }\n  return after.filter((line) => !before.includes(line));\n}\n\n/** A changed line lights once, then settles back into the block. */\nfunction freshClassOf(isFresh: boolean) {\n  if (isFresh) {\n    return 'transition-colors duration-1000 ease-out starting:bg-primary/25';\n  }\n  return undefined;\n}\n\nfunction pressedQuietOf(isPressed: boolean) {\n  if (isPressed) {\n    return 'scale-[0.94] bg-foreground/[0.07] text-foreground';\n  }\n  return undefined;\n}\n\nfunction copyWordOf(isCopied: boolean, copyLabel: string) {\n  if (isCopied) {\n    return 'Copied';\n  }\n  return copyLabel;\n}\n\nfunction LabelGlyph({ language }: { language: SnippetLanguage }) {\n  if (language === 'bash') {\n    return <TerminalIcon className='size-3.5 shrink-0' />;\n  }\n  if (language === 'fields') {\n    return <SlidersIcon className='size-3.5 shrink-0' />;\n  }\n  return <FileTextIcon className='size-3.5 shrink-0' />;\n}\n\ntype CodeLineProps = {\n  line: string;\n  language: SnippetLanguage;\n};\n\nfunction CodeLine({ line, language }: CodeLineProps) {\n  if (language !== 'json') {\n    return <>{line}</>;\n  }\n  const tokens = jsonTokensOf(line);\n\n  return (\n    <>\n      {tokens.map((token, index) => (\n        <span key={index} className={TOKEN_CLASS[token.kind]}>\n          {token.text}\n        </span>\n      ))}\n    </>\n  );\n}\n\nexport type ConfigBlockProps = {\n  editorId: EditorId;\n  /** Changes with the editor and with each option, so the block knows a new config arrived. */\n  configKey: string;\n  snippet: Snippet;\n  isCopied: boolean;\n  isCopyPressed: boolean;\n  onCopy: () => void;\n};\n\nexport function ConfigBlock({\n  editorId,\n  configKey,\n  snippet,\n  isCopied,\n  isCopyPressed,\n  onCopy,\n}: ConfigBlockProps) {\n  const [shown, setShown] = useState<Shown>(() => ({\n    key: configKey,\n    editorId,\n    lines: snippet.lines,\n    fresh: NO_LINES,\n  }));\n  if (shown.key !== configKey) {\n    const isSameEditor = shown.editorId === editorId;\n    const fresh = freshLinesOf(isSameEditor, shown.lines, snippet.lines);\n    setShown({ key: configKey, editorId, lines: snippet.lines, fresh });\n  }\n  const copyWord = copyWordOf(isCopied, snippet.copyLabel);\n\n  return (\n    <div className='bg-foreground/[0.03] dark:bg-foreground/[0.05] flex flex-col rounded-lg'>\n      <div className='flex h-10 items-center gap-2 ps-3 pe-1.5'>\n        <span className='text-muted-foreground flex min-w-0 flex-1 items-center gap-2 text-xs'>\n          <Swap swapKey={snippet.language}>\n            <LabelGlyph language={snippet.language} />\n          </Swap>\n          <span className='min-w-0 truncate font-mono'>\n            <Swap swapKey={snippet.label}>{snippet.label}</Swap>\n          </span>\n        </span>\n        <Button\n          type='button'\n          variant='ghost'\n          size='sm'\n          onClick={onCopy}\n          className={cn('text-muted-foreground', pressedQuietOf(isCopyPressed))}\n        >\n          <Swap swapKey={String(isCopied)}>\n            {isCopied && <CheckIcon className='text-success-foreground' />}\n            {!isCopied && <CopyIcon />}\n          </Swap>\n          <Swap swapKey={copyWord}>{copyWord}</Swap>\n        </Button>\n      </div>\n      <AnimatedSize className='m-0' contentClassName='relative p-0'>\n        <AnimatePresence mode='popLayout' initial={false}>\n          <motion.pre\n            key={editorId}\n            initial={FADE_OUT}\n            animate={FADE_IN}\n            exit={FADE_OUT}\n            transition={FADE}\n            className='overflow-x-auto px-3 pb-3 font-mono text-xs leading-6'\n          >\n            <code className='flex min-w-max flex-col'>\n              {snippet.lines.map((line, index) => (\n                <span\n                  key={`${index}:${line}`}\n                  className={cn(\n                    '-mx-1.5 rounded-sm px-1.5 whitespace-pre',\n                    freshClassOf(shown.fresh.includes(line))\n                  )}\n                >\n                  <CodeLine line={line} language={snippet.language} />\n                </span>\n              ))}\n            </code>\n          </motion.pre>\n        </AnimatePresence>\n      </AnimatedSize>\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/agent-ops-05/config-block.tsx"
    },
    {
      "path": "registry/ndeko/blocks/agent-ops/agent-ops-05/session.ts",
      "content": "import type { SessionStep } from '@/registry/ndeko/hooks/use-session';\n\nimport type { EditorId, Scope, Transport } from './data';\n\nexport type Connection = 'idle' | 'waiting' | 'connected';\n\nexport type InstallState = {\n  editorId: EditorId;\n  transport: Transport;\n  scope: Scope;\n  connection: Connection;\n};\n\nexport type InstallAction =\n  | { type: 'editor'; id: EditorId }\n  | { type: 'transport'; transport: Transport }\n  | { type: 'scope'; scope: Scope }\n  | { type: 'copied' }\n  | { type: 'connected' };\n\ntype Step = SessionStep<InstallState, InstallAction>;\n\nexport const INITIAL: InstallState = {\n  editorId: 'claude-code',\n  transport: 'remote',\n  scope: 'project',\n  connection: 'idle',\n};\n\n/** A new config has not been copied yet, so the card stops waiting for the old one. */\nfunction changed(\n  state: InstallState,\n  patch: Partial<InstallState>\n): InstallState {\n  return { ...state, ...patch, connection: 'idle' };\n}\n\nfunction connected(state: InstallState): InstallState {\n  if (state.connection !== 'waiting') {\n    return state;\n  }\n  return { ...state, connection: 'connected' };\n}\n\nexport function reducer(\n  state: InstallState,\n  action: InstallAction\n): InstallState {\n  switch (action.type) {\n    case 'editor':\n      return changed(state, { editorId: action.id });\n    case 'transport':\n      return changed(state, { transport: action.transport });\n    case 'scope':\n      return changed(state, { scope: action.scope });\n    case 'copied':\n      return { ...state, connection: 'waiting' };\n    case 'connected':\n      return connected(state);\n  }\n}\n\nfunction hasCopied(state: InstallState) {\n  return state.connection !== 'idle';\n}\n\n/** How long the editor takes to start the server and list its tools. */\nexport const CONNECT_MS = 3200;\n\nexport const SCRIPT: Step[] = [\n  {\n    after: 1400,\n    by: 'demo',\n    action: { type: 'editor', id: 'cursor' },\n  },\n  {\n    after: 1700,\n    by: 'demo',\n    action: { type: 'transport', transport: 'local' },\n  },\n  {\n    after: 1700,\n    by: 'demo',\n    action: { type: 'scope', scope: 'everywhere' },\n  },\n  {\n    after: 2200,\n    by: 'person',\n    press: 'copy',\n    action: { type: 'copied' },\n    isAnswered: hasCopied,\n  },\n  { after: CONNECT_MS, action: { type: 'connected' } },\n];\n\n/** Under reduced motion the card rests connected, on the config the demonstration ends with. */\nexport const RESTING: InstallState = {\n  editorId: 'cursor',\n  transport: 'local',\n  scope: 'everywhere',\n  connection: 'connected',\n};\n\nexport const LOOP_AFTER_MS = 3800;\n",
      "type": "registry:component",
      "target": "components/blocks/agent-ops-05/session.ts"
    },
    {
      "path": "registry/ndeko/blocks/agent-ops/agent-ops-05/data.ts",
      "content": "import type { SeriesSlot } from '@/registry/ndeko/lib/agent-run';\nimport type { BrandSlug } from '@/registry/ndeko/lib/brand-logos';\n\n/** A fictional server: the address answers nothing. */\nexport const SERVER = {\n  title: 'Harbor docs',\n  name: 'harbor',\n  url: 'https://mcp.example.dev/mcp',\n  localCommand: 'npx',\n  localArgs: ['-y', '@harbor-example/mcp'],\n  toolCount: 7,\n};\n\nexport type Transport = 'remote' | 'local';\n\nexport type Scope = 'project' | 'everywhere';\n\nexport type EditorId =\n  'claude-code' | 'cursor' | 'vs-code' | 'windsurf' | 'zed' | 'codex';\n\nexport type Editor = {\n  id: EditorId;\n  name: string;\n  /** The mark of the editor when the mark set holds it; its initial on a tile otherwise. */\n  brand?: BrandSlug;\n  initial: string;\n  /** The colour the card takes while it waits for this editor. */\n  series: SeriesSlot;\n  /** Said under the switches when the editor keeps one list of servers for every project. */\n  scopeNote?: string;\n};\n\nexport const EDITORS: Editor[] = [\n  {\n    id: 'claude-code',\n    name: 'Claude Code',\n    brand: 'claudecode',\n    initial: 'C',\n    series: 1,\n  },\n  { id: 'cursor', name: 'Cursor', brand: 'cursor', initial: 'C', series: 2 },\n  { id: 'vs-code', name: 'VS Code', initial: 'V', series: 3 },\n  {\n    id: 'windsurf',\n    name: 'Windsurf',\n    brand: 'windsurf',\n    initial: 'W',\n    series: 4,\n    scopeNote: 'Windsurf keeps one list of servers for every project',\n  },\n  { id: 'zed', name: 'Zed', brand: 'zed', initial: 'Z', series: 5 },\n  {\n    id: 'codex',\n    name: 'Codex',\n    brand: 'codex',\n    initial: 'C',\n    series: 1,\n    scopeNote: 'Codex keeps its servers in one file for every project',\n  },\n];\n\nexport function editorOf(id: EditorId) {\n  const editor = EDITORS.find((candidate) => candidate.id === id);\n  return editor ?? EDITORS[0];\n}\n\nexport type SnippetLanguage = 'bash' | 'json' | 'toml' | 'fields';\n\nexport type Snippet = {\n  /** A terminal, the path of a file, or the settings screen the values go in. */\n  label: string;\n  language: SnippetLanguage;\n  lines: string[];\n  /** What Copy puts on the clipboard. */\n  copyText: string;\n  copyLabel: string;\n};\n\nconst JSON_INDENT = 2;\n\nfunction linesOfJson(value: unknown) {\n  const text = JSON.stringify(value, null, JSON_INDENT);\n  return text.split('\\n');\n}\n\nfunction snippetOfLines(\n  label: string,\n  language: SnippetLanguage,\n  lines: string[]\n): Snippet {\n  return {\n    label,\n    language,\n    lines,\n    copyText: lines.join('\\n'),\n    copyLabel: 'Copy',\n  };\n}\n\nfunction localCommandLine() {\n  const args = SERVER.localArgs.join(' ');\n  return `${SERVER.localCommand} ${args}`;\n}\n\nfunction scopeFlagOf(scope: Scope) {\n  if (scope === 'everywhere') {\n    return ' --scope user';\n  }\n  return '';\n}\n\nfunction claudeCodeSnippet(transport: Transport, scope: Scope) {\n  const scopeFlag = scopeFlagOf(scope);\n  if (transport === 'local') {\n    const command = localCommandLine();\n    const line = `claude mcp add${scopeFlag} ${SERVER.name} -- ${command}`;\n    return snippetOfLines('Terminal', 'bash', [line]);\n  }\n  const line = `claude mcp add --transport http${scopeFlag} ${SERVER.name} ${SERVER.url}`;\n  return snippetOfLines('Terminal', 'bash', [line]);\n}\n\nfunction mcpServersEntryOf(transport: Transport) {\n  if (transport === 'local') {\n    return { command: SERVER.localCommand, args: SERVER.localArgs };\n  }\n  return { url: SERVER.url };\n}\n\nfunction cursorPathOf(scope: Scope) {\n  if (scope === 'everywhere') {\n    return '~/.cursor/mcp.json';\n  }\n  return '.cursor/mcp.json';\n}\n\nfunction cursorSnippet(transport: Transport, scope: Scope) {\n  const entry = mcpServersEntryOf(transport);\n  const lines = linesOfJson({ mcpServers: { [SERVER.name]: entry } });\n  return snippetOfLines(cursorPathOf(scope), 'json', lines);\n}\n\nfunction vsCodeEntryOf(transport: Transport) {\n  if (transport === 'local') {\n    return {\n      type: 'stdio',\n      command: SERVER.localCommand,\n      args: SERVER.localArgs,\n    };\n  }\n  return { type: 'http', url: SERVER.url };\n}\n\n/** In a workspace VS Code reads a file; for every workspace its command line adds the server to the user profile. */\nfunction vsCodeSnippet(transport: Transport, scope: Scope) {\n  const entry = vsCodeEntryOf(transport);\n  if (scope === 'everywhere') {\n    const config = JSON.stringify({ name: SERVER.name, ...entry });\n    const line = `code --add-mcp '${config}'`;\n    return snippetOfLines('Terminal', 'bash', [line]);\n  }\n  const lines = linesOfJson({ servers: { [SERVER.name]: entry } });\n  return snippetOfLines('.vscode/mcp.json', 'json', lines);\n}\n\nfunction windsurfSnippet(transport: Transport): Snippet {\n  if (transport === 'local') {\n    const command = localCommandLine();\n    return {\n      label: 'Windsurf, MCP settings',\n      language: 'fields',\n      lines: [`Name     ${SERVER.name}`, `Command  ${command}`],\n      copyText: command,\n      copyLabel: 'Copy the command',\n    };\n  }\n  return {\n    label: 'Windsurf, MCP settings',\n    language: 'fields',\n    lines: [\n      `Name       ${SERVER.name}`,\n      'Transport  Streamable HTTP',\n      `Address    ${SERVER.url}`,\n    ],\n    copyText: SERVER.url,\n    copyLabel: 'Copy the address',\n  };\n}\n\nfunction zedPathOf(scope: Scope) {\n  if (scope === 'everywhere') {\n    return '~/.config/zed/settings.json';\n  }\n  return '.zed/settings.json';\n}\n\nfunction zedSnippet(transport: Transport, scope: Scope) {\n  const entry = mcpServersEntryOf(transport);\n  const lines = linesOfJson({ context_servers: { [SERVER.name]: entry } });\n  return snippetOfLines(zedPathOf(scope), 'json', lines);\n}\n\nfunction codexSnippet(transport: Transport) {\n  const header = `[mcp_servers.${SERVER.name}]`;\n  if (transport === 'local') {\n    const args = JSON.stringify(SERVER.localArgs).replaceAll(',', ', ');\n    const lines = [\n      header,\n      `command = \"${SERVER.localCommand}\"`,\n      `args = ${args}`,\n    ];\n    return snippetOfLines('~/.codex/config.toml', 'toml', lines);\n  }\n  const lines = [header, `url = \"${SERVER.url}\"`];\n  return snippetOfLines('~/.codex/config.toml', 'toml', lines);\n}\n\n/** The config each editor reads, in the form its own documentation gives. */\nexport function snippetOf(\n  editorId: EditorId,\n  transport: Transport,\n  scope: Scope\n): Snippet {\n  switch (editorId) {\n    case 'claude-code':\n      return claudeCodeSnippet(transport, scope);\n    case 'cursor':\n      return cursorSnippet(transport, scope);\n    case 'vs-code':\n      return vsCodeSnippet(transport, scope);\n    case 'windsurf':\n      return windsurfSnippet(transport);\n    case 'zed':\n      return zedSnippet(transport, scope);\n    case 'codex':\n      return codexSnippet(transport);\n  }\n}\n",
      "type": "registry:component",
      "target": "components/blocks/agent-ops-05/data.ts"
    }
  ],
  "categories": [
    "blocks",
    "agent-ops"
  ],
  "type": "registry:block"
}