"use client"; import { useActionState } from "react"; import { Button } from "@/app/_components/ui/button"; import { Input, Label } from "@/app/_components/ui/input"; interface State { token: string | null; error: string | null; } interface Props { action: (prev: State, formData: FormData) => Promise; ttlDays: number; } const initial: State = { token: null, error: null }; export default function TokensManager({ action, ttlDays }: Props) { const [state, formAction, pending] = useActionState(action, initial); if (state.token) { return (
Token generated — copy now, you won't see it again
          {state.token}
        
claude mcp add command
{`claude mcp add --transport http --scope user \\
  --header "Authorization: Bearer ${state.token}" \\
  shared-memory https://memory.dnspegasus.net/api/mcp`}

Valid for {ttlDays} days. Revoke individually below if it leaks.

); } return (
{state.error ? (

error: {state.error}

) : null}
); }