'use client'; import { useEffect, useRef, useState, type KeyboardEvent, type ReactNode } from 'react'; import Link from 'next/link'; import { Eye, PencilLine, type LucideIcon } from 'lucide-react'; type AccessId = 'read-only' | 'read-write'; type ClientId = 'claude-code' | 'codex'; interface AccessMode { id: AccessId; name: string; works: string; can: string; note: string; prompt: string; icon: LucideIcon; } const ACCESS_MODES: AccessMode[] = [ { id: 'read-only', name: 'Read only', works: 'Search and read your notes', can: 'Your agent can list, search and read your notes, including titles, dates, tags, transcripts and summaries.', note: 'Nothing in your library changes. Agents work with the library open in Jotley, including notes synced from your iPhone or iPad.', prompt: 'Search my Jotley notes for release planning and tell me who owns each action.', icon: Eye, }, { id: 'read-write', name: 'Read & write', works: 'Create, edit and organize notes', can: 'Everything in Read only, plus creating, editing, copying and deleting notes and managing tags, folders and summary templates.', note: 'Review your agent’s approvals before it makes changes. Deletion is permanent, so try it on a test note first.', prompt: 'Rename that note Launch checklist and rewrite its summary as action items. Keep the transcript unchanged.', icon: PencilLine, }, ]; const CLIENTS: { id: ClientId; name: string }[] = [ { id: 'claude-code', name: 'Claude Code' }, { id: 'codex', name: 'Codex' }, ]; const ACCESS_IDS = ACCESS_MODES.map((mode) => mode.id); const CLIENT_IDS = CLIENTS.map((client) => client.id); function CopyButton({ text, label }: { text: string; label: string }) { const [copied, setCopied] = useState(false); const copy = async () => { try { await navigator.clipboard.writeText(text); setCopied(true); setTimeout(() => setCopied(false), 1800); } catch { setCopied(false); } }; return ( ); } function CopyValue({ value, label }: { value: string; label: string }) { return ( {value} ); } // Arrow keys move between tabs, as in the WAI-ARIA tabs pattern. function onTabKeyDown(event: KeyboardEvent, ids: T[], current: T, select: (id: T) => void) { const moves: Record = { ArrowRight: 1, ArrowDown: 1, ArrowLeft: -1, ArrowUp: -1 }; let next: T | null = null; if (event.key in moves) next = ids[(ids.indexOf(current) + moves[event.key] + ids.length) % ids.length]; if (event.key === 'Home') next = ids[0]; if (event.key === 'End') next = ids[ids.length - 1]; if (!next) return; event.preventDefault(); select(next); const tabs = event.currentTarget.parentElement?.querySelectorAll('[role="tab"]'); tabs?.[ids.indexOf(next)]?.focus(); } function JotleySteps({ access }: { access: AccessMode }) { return ( <>
  • Open Jotley’s Settings gear, then choose Integrations → MCP.
  • Turn on Enable MCP access. Wait for Server ready and keep Jotley open.
  • Choose {access.name}, then click Test connection to check Jotley’s server.
  • ); } function ClaudeSteps({ access }: { access: AccessMode }) { return ( <>
    1. Still in Jotley’s MCP settings, choose Claude Code app → Save project connection… and select your project folder.
    2. Open the Claude Mac app’s Code tab. Start a local session on This computer using that same folder.
    3. Review Claude’s project trust prompt and approve Jotley. Open the session’s Connectors panel and check Jotley. Start a new session if the project was already open.
    Using regular Claude chat instead?

    Use the Code tab for this connection. Regular Claude chat uses the separate extension available under Jotley’s advanced setup options.

    ); } function CodexSteps({ access }: { access: AccessMode }) { return ( <>
    1. Still in Jotley’s MCP settings, choose Codex app.
    2. In Codex, open Settings → MCP servers → Add server. Name it and choose STDIO.
    3. Copy Command from Jotley into Codex’s Command field without extra quotes.
    4. Add one argument: . Leave environment variables empty.
    5. Save, restart the server, then start a local chat. Type to check Jotley.
    Moved Jotley to another folder?

    Moving the app changes its launch path. Update the Command path in Codex with the current value from Jotley.

    ); } function Info({ id, title, children }: { id: string; title: string; children: ReactNode }) { return (
    {title}
    {children}
    ); } export default function MCPBoard() { const [accessId, setAccessId] = useState('read-only'); const [client, setClient] = useState('claude-code'); const boardRef = useRef(null); const access = ACCESS_MODES.find((mode) => mode.id === accessId) ?? ACCESS_MODES[0]; // Deep links: #claude-code and #codex open that agent's steps. useEffect(() => { const applyHash = () => { const id = window.location.hash.replace(/^#/, '') as ClientId; if (!CLIENT_IDS.includes(id)) return; setClient(id); requestAnimationFrame(() => boardRef.current?.scrollIntoView({ block: 'start' })); }; applyHash(); window.addEventListener('hashchange', applyHash); return () => window.removeEventListener('hashchange', applyHash); }, []); const selectClient = (next: ClientId) => { setClient(next); window.history.replaceState(null, '', `#${next}`); }; return ( <>
    {ACCESS_MODES.map((mode) => ( ))}

    Jotley

    Mac only Off by default Free

    {ACCESS_MODES.map((mode) => ( ))}
    • Download Jotley for Mac
    • Read the MCP privacy details

    Connect Jotley with

    {CLIENTS.map((item) => ( ))}

    Before you connect

    MCP is the connection between Jotley and your agent. It runs on your Mac while Jotley is open, and setup happens in the apps. No separate runtime or copied token is needed.

    MCP is unavailable on iPhone or iPad, and cloud sessions cannot reach this local connection.

    Access is off by default, and you can turn it off in Jotley at any time. The connection itself stays on your Mac, but connected agents may send retrieved notes to their AI provider or retain copies.

    Read the MCP privacy details

    Read only lets your agent search and read. Read & write also lets it create, edit, copy and delete notes and manage tags, folders and templates. Deletion is permanent.

    You can switch between them in Jotley’s MCP settings whenever you like.

    After a change, open the note in Jotley to see what was saved. Last agent seen and Last successful request in Jotley’s MCP settings show actual connection activity.

    If you move Jotley, update the Command path in Codex or save the Claude Code project connection again.

    ); }