Skip to content

Install & first action

  1. Install the package that matches your runtime.

    Terminal window
    pnpm add @tesseron/web zod

    zod is used in the examples here; swap it for any Standard Schema-compatible validator - Valibot, ArkType, Effect Schema.

  2. Name your app. app.id is 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',
    });
  3. 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;
    });
  4. 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.

  5. Claim from the agent. In Claude Code: "Claim Tesseron session <code>." Once claimed, notes__createNote appears in the tool list.

src/tesseron.ts
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();
src/main.ts
import { connect } from './tesseron';
connect(); // fire and forget; retry in UI if you like.