ConnectAgent
Connecting a coding agent to a project: one text to paste into the agent, the command for each agent, what gets configured, and then the approval: the agent shows a code, the same code appears here, and the person approves it. Nothing secret is ever pasted.
import { CodeBlock, Tabs, Health } from '@sypnia/ui/react'
On a desktop
Copy the text, switch agents, then press «The agent ran init» to see the request, and approve or deny it.
Connect your agent
Paste this into Claude Code, Cursor or any coding agent, in your app’s folder. It sets everything up and starts working on your project.
Connect this app to my Sypnia Data project «Northwind shop» (nw-shop-7k2).1. In the app’s folder run: npx @sypnia/data init --project nw-shop-7k2 If the app has a backend, add --server. It shows a code: give it to me and I approve it in the browser. Never ask me for keys or passwords.2. Use the MCP server https://mcp.data.sypnia.com (init added it to .mcp.json / .cursor/mcp.json).3. Read .claude/skills/sypnia-data/SKILL.md before touching the database.4. Before writing code, propose the app’s flows: who does what, which tables each one touches and how it can fail.Nothing secret is in the text: the agent signs in with a code you approve here.
npx @sypnia/data init --project nw-shop-7k2
# the MCP server is added to .mcp.json; or:
claude mcp add --transport http sypnia https://mcp.data.sypnia.comWhat gets configured
- Your project’s URL and publishable key in .env.local
- The MCP server, so the agent can read and change your tables (you approve it here)
- Skills that teach the agent how to work with Sypnia Data
- Typed tables generated from your schema
When it runs init, a request appears here.
Code
import { useEffect, useState, type ReactNode } from 'react';
import {
Alert, Button, CodeBlock, Columns, FeatureList, Health, LiveRegion, Notice, Panel, SkeletonOf, SkeletonWords, Stack, Status, Tabs, Text, useSypnia,
} from '@sypnia/ui/react';
// Connecting a coding agent to a project: one text to paste into the agent, the exact command for each agent, what
// gets configured, and then the approval: the agent shows a code, the same code appears here, and the person approves
// it. Nothing secret is ever pasted. It can be hidden, and a small button brings it back.
const MCP = 'https://mcp.data.sypnia.com';
const en = {
title: 'Connect your agent', lead: 'Paste this into Claude Code, Cursor or any coding agent, in your app’s folder. It sets everything up and starts working on your project.',
hide: 'Hide', show: 'Connect your agent', promptLabel: 'Paste this into your agent', nosecret: 'Nothing secret is in the text: the agent signs in with a code you approve here.',
tabs: 'Agent', claude: 'Claude Code', cursor: 'Cursor', other: 'Other agents', what: 'What gets configured',
whatItems: ['Your project’s URL and publishable key in .env.local', 'The MCP server, so the agent can read and change your tables (you approve it here)', 'Skills that teach the agent how to work with Sypnia Data', 'Typed tables generated from your schema'],
waiting: 'Waiting for your agent', waitingHint: 'When it runs init, a request appears here.', simulate: 'The agent ran init',
request: (a: string, h: string) => `${a} on ${h} asks to connect to northwind-shop`, requestBody: 'Approve it only if your agent shows this same code.', approve: 'Approve', deny: 'Deny',
connected: 'Connected', connectedDetail: (a: string) => `${a} · it can read and change the tables of northwind-shop`, disconnect: 'Disconnect',
denied: 'Request denied. Nothing was connected. Run init again to ask anew.',
prompt: (name: string, ref: string) => `Connect this app to my Sypnia Data project «${name}» (${ref}).\n1. In the app’s folder run: npx @sypnia/data init --project ${ref}\n If the app has a backend, add --server.\n It shows a code: give it to me and I approve it in the browser. Never ask me for keys or passwords.\n2. Use the MCP server ${MCP} (init added it to .mcp.json / .cursor/mcp.json).\n3. Read .claude/skills/sypnia-data/SKILL.md before touching the database.\n4. Before writing code, propose the app’s flows: who does what, which tables each one touches and how it can fail.`,
};
const es: typeof en = {
title: 'Conecta tu agente', lead: 'Pega esto en Claude Code, Cursor o cualquier agente de código, en la carpeta de tu app. Deja todo configurado y empieza a trabajar en tu proyecto.',
hide: 'Ocultar', show: 'Conecta tu agente', promptLabel: 'Pega esto a tu agente', nosecret: 'El texto no tiene nada secreto: el agente entra con un código que apruebas aquí.',
tabs: 'Agente', claude: 'Claude Code', cursor: 'Cursor', other: 'Otros agentes', what: 'Qué queda configurado',
whatItems: ['La dirección y la llave publicable del proyecto en .env.local', 'El servidor MCP, para que el agente lea y cambie tus tablas (lo apruebas aquí)', 'Skills que le enseñan al agente a trabajar con Sypnia Data', 'Tablas tipadas generadas desde tu esquema'],
waiting: 'Esperando a tu agente', waitingHint: 'Cuando corra init, aparece aquí una solicitud.', simulate: 'El agente corrió init',
request: (a: string, h: string) => `${a} en ${h} pide conectarse a northwind-shop`, requestBody: 'Apruébala solo si tu agente muestra este mismo código.', approve: 'Aprobar', deny: 'Rechazar',
connected: 'Conectado', connectedDetail: (a: string) => `${a} · puede leer y cambiar las tablas de northwind-shop`, disconnect: 'Desconectar',
denied: 'Solicitud rechazada. No se conectó nada. Corre init de nuevo para pedirlo otra vez.',
prompt: (name: string, ref: string) => `Conecta esta app a mi proyecto de Sypnia Data «${name}» (${ref}).\n1. En la carpeta de la app corre: npx @sypnia/data init --project ${ref}\n Si la app tiene backend, agrega --server.\n Te va a mostrar un código: pásamelo y yo lo apruebo en el navegador. Nunca me pidas llaves ni contraseñas.\n2. Usa el servidor MCP ${MCP} (init lo dejó en .mcp.json / .cursor/mcp.json).\n3. Lee .claude/skills/sypnia-data/SKILL.md antes de tocar la base de datos.\n4. Antes de escribir código, propón los flujos de la app: quién hace qué, qué tablas toca cada uno y cómo puede fallar.`,
};
const ref = 'nw-shop-7k2';
const commands = {
claude: `npx @sypnia/data init --project ${ref}\n# the MCP server is added to .mcp.json; or:\nclaude mcp add --transport http sypnia ${MCP}`,
cursor: `npx @sypnia/data init --project ${ref} --agent cursor\n# writes .cursor/mcp.json with the server ${MCP}`,
other: `npx @sypnia/data init --project ${ref} --agent other\n# MCP server: ${MCP}\n# instructions for the agent: AGENTS.md`,
};
export default function ConnectAgent({ state = 'ready' }: { state?: 'ready' | 'loading' | 'connected' | 'hidden' }) {
const { locale } = useSypnia();
const c = locale.startsWith('es') ? es : en;
const [hidden, setHidden] = useState(state === 'hidden');
const [step, setStep] = useState<'waiting' | 'request' | 'connected' | 'denied'>(state === 'connected' ? 'connected' : 'waiting');
// The approval code expires: the agent asks again after 10 minutes.
const [code] = useState('WDJB-MJHT');
useEffect(() => { if (step === 'denied') { const t = setTimeout(() => setStep('waiting'), 6000); return () => clearTimeout(t); } }, [step]);
// Loading: the real panel with its words; what comes from the project (the texts with its address, whether an
// agent is connected) waits in its own box.
const loading = state === 'loading';
const wait = (n: ReactNode) => (loading ? <SkeletonOf>{n}</SkeletonOf> : n);
if (hidden) return <div><Button variant="quiet" size="sm" icon="agent" onClick={() => setHidden(false)}>{c.show}</Button></div>;
const approval = step === 'connected'
? <Stack gap={3}><Health state="up" label={c.connected} detail={c.connectedDetail('Claude Code')} /><div><Button size="sm" variant="quiet" icon="unlink" onClick={() => setStep('waiting')}>{c.disconnect}</Button></div></Stack>
: step === 'request'
? (
<Alert tone="info" icon="agent" title={c.request('Claude Code', 'ana-macbook')}
actions={<><Button size="sm" variant="primary" icon="check" onClick={() => setStep('connected')}>{c.approve}</Button><Button size="sm" onClick={() => setStep('denied')}>{c.deny}</Button></>}>
<Stack gap={2}><span>{c.requestBody}</span><Text size="lg" strong numeric><code>{code}</code></Text></Stack>
</Alert>
)
: (
<Stack gap={3}>
{step === 'denied' && <Notice tone="warn">{c.denied}</Notice>}
{loading ? <Status><SkeletonWords>{c.waiting}</SkeletonWords></Status> : <Status tone="lit" live>{c.waiting}</Status>}
<Text size="sm" tone="muted">{loading ? <SkeletonWords>{c.waitingHint}</SkeletonWords> : c.waitingHint}</Text>
<div>{wait(<Button size="sm" icon="terminal" onClick={() => setStep('request')}>{c.simulate}</Button>)}</div>
</Stack>
);
return (
<Panel title={c.title} actions={<Button size="sm" variant="quiet" onClick={() => setHidden(true)}>{c.hide}</Button>}>
<Stack gap={5}>
<Text size="sm" tone="soft">{c.lead}</Text>
{wait(<CodeBlock code={c.prompt('Northwind shop', ref)} title={c.promptLabel} wrap />)}
<Notice tone="info" icon="lock">{c.nosecret}</Notice>
<Columns cols={2} stack>
<Tabs label={c.tabs} items={(['claude', 'cursor', 'other'] as const).map((k) => ({ id: k, label: c[k], content: wait(<CodeBlock code={commands[k]} lang="sh" />) }))} />
<Stack gap={3}><Text strong>{c.what}</Text><FeatureList items={c.whatItems} /></Stack>
</Columns>
{approval}
<LiveRegion visible={false}>{step === 'request' ? c.request('Claude Code', 'ana-macbook') : step === 'connected' ? c.connected : step === 'denied' ? c.denied : ''}</LiveRegion>
</Stack>
</Panel>
);
} On a phone
On a phone the command and the list stack, and the text wraps.
Connected
After the approval: which agent, and what it may do.
Connect your agent
Paste this into Claude Code, Cursor or any coding agent, in your app’s folder. It sets everything up and starts working on your project.
Connect this app to my Sypnia Data project «Northwind shop» (nw-shop-7k2).1. In the app’s folder run: npx @sypnia/data init --project nw-shop-7k2 If the app has a backend, add --server. It shows a code: give it to me and I approve it in the browser. Never ask me for keys or passwords.2. Use the MCP server https://mcp.data.sypnia.com (init added it to .mcp.json / .cursor/mcp.json).3. Read .claude/skills/sypnia-data/SKILL.md before touching the database.4. Before writing code, propose the app’s flows: who does what, which tables each one touches and how it can fail.Nothing secret is in the text: the agent signs in with a code you approve here.
npx @sypnia/data init --project nw-shop-7k2
# the MCP server is added to .mcp.json; or:
claude mcp add --transport http sypnia https://mcp.data.sypnia.comWhat gets configured
- Your project’s URL and publishable key in .env.local
- The MCP server, so the agent can read and change your tables (you approve it here)
- Skills that teach the agent how to work with Sypnia Data
- Typed tables generated from your schema
When to use it
Use it when
- The home of a new project, until the person hides it.
- Any product an agent can work in: data, files, deploys.
Do not use it when
- Putting a secret key in the text to paste: the agent signs in with a code the person approves.
- Approving without showing the code: the person must see that it matches.
For everyone
- The text to paste and every command have their own Copy button, named with what they copy.
- The request to connect and its result are announced politely.
- Approve and Deny are plain buttons; nothing happens on its own.
Props
| CodeBlock | Type | Default |
|---|---|---|
coderequired | string | |
langThe language, shown in the bar when there is no title: ts, sql, sh, json… | string | text |
lineNumbersNumbers at the start of every line. | boolean | |
markLines to light, counted from 1. | number[] | [] |
titleThe file it belongs in: «src/db.ts». | string | |
wrapLong lines wrap instead of scrolling inside the block. | boolean |
| Tabs | Type | Default |
|---|---|---|
itemsrequired | TabItem[] | |
labelrequired | string | |
onChange | ((id: string) => void) | |
selected | string |
| Health | Type | Default |
|---|---|---|
staterequired | "up" | "degraded" | "down" | "unknown" | |
detail | ReactNode | |
label | ReactNode |