Install & first action
-
Install the package that matches your runtime.
Terminal window pnpm add @tesseron/web zodTerminal window pnpm add @tesseron/react zodTerminal window pnpm add @tesseron/server zodTerminal window pnpm add @tesseron/core zodzodis used in the examples here; swap it for any Standard Schema-compatible validator - Valibot, ArkType, Effect Schema. -
Name your app.
app.idis what the agent's tool names get prefixed with. It must match/^[a-z][a-z0-9_]*$/.import { tesseron } from '@tesseron/web';tesseron.app({id: 'notes',name: 'My Notes App',description: 'Create and organise notes',}); -
Declare an action.
import { z } from 'zod';tesseron.action('createNote').describe('Create a new note').input(z.object({ title: z.string().min(1), body: z.string().default('') })).handler(({ title, body }) => {const note = { id: crypto.randomUUID(), title, body, createdAt: Date.now() };store.add(note);return note;}); -
Connect.
const welcome = await tesseron.connect();console.log('claim code:', welcome.claimCode);The MCP gateway prints the claim code to its stderr; you can also surface it in your UI.
-
Claim from the agent. In Claude Code: "Claim Tesseron session <code>." Once claimed,
notes__createNoteappears in the tool list.
Typical entry-point layouts
Section titled “Typical entry-point layouts”import { tesseron } from '@tesseron/web';import { z } from 'zod';
tesseron.app({ id: 'notes', name: 'Notes' });
tesseron.action('createNote') .input(z.object({ title: z.string(), body: z.string() })) .handler(({ title, body }) => notesStore.add({ title, body }));
export const connect = () => tesseron.connect();import { connect } from './tesseron';connect(); // fire and forget; retry in UI if you like.import { useTesseronAction, useTesseronConnection } from '@tesseron/react';import { z } from 'zod';
export function App() { const { claimCode, status } = useTesseronConnection();
useTesseronAction('createNote', { input: z.object({ title: z.string(), body: z.string() }), handler: ({ title, body }) => notesStore.add({ title, body }), });
return ( <div> {status === 'open' && claimCode && <ClaimCodeBanner code={claimCode} />} <Notes /> </div> );}import { tesseron } from '@tesseron/server';import { z } from 'zod';
tesseron.app({ id: 'notes_api', name: 'Notes API' });
tesseron.action('createNote') .input(z.object({ title: z.string(), body: z.string() })) .handler(async ({ title, body }) => db.notes.insert({ title, body }));
const welcome = await tesseron.connect();console.log('claim code:', welcome.claimCode);
process.on('SIGINT', async () => { await tesseron.disconnect(); process.exit(0);});Where to go next
Section titled “Where to go next”- The action builder in full - chaining, output validation, annotations, timeouts.
- Standard Schema validators - Zod vs Valibot vs ArkType, and JSON Schema interop.
- The context API - progress, sampling, elicitation, logging.
- Framework adapters: @tesseron/react.