Contribute

Development

Automata is a pnpm workspace with a Nuxt web app, a Telegram bridge, and a cloud service used only by the hosted offering. This page orients you before changing the source.

Repository layout

apps/
  web/              Nuxt app: management UI and MCP endpoint
  telegram-bridge/  Personal-account Telegram bridge
  cloud/            Hosted offering only: plans, Stripe, account events
docker/aio/         All-in-one image: Dockerfile and s6 service tree
docs/               Source documentation
docker-compose.dev.yml   Supporting services for local development
docker-compose.yml       Full self-host stack from published images

Start the supporting services from the local deployment guide, then run pnpm dev on the host so hot module replacement works.

The package manager is pnpm, pinned to pnpm@11.22.0 through packageManager. Don't use npm or yarn.

Scripts

CommandPurpose
pnpm devRun the Nuxt app on the host
pnpm build, pnpm previewBuild the web app for production, then serve that build
pnpm services:up, :whatsapp, :telegramStart service profiles
pnpm services:down, services:logs, services:psStop, tail, and inspect services, across every profile
pnpm bridge:devRun the Telegram bridge on the host instead of in Compose
pnpm cloud:devRun the hosted-only cloud service on the host
pnpm typecheckType-check the web app
pnpm bridge:typecheckType-check the Telegram bridge, which pnpm typecheck does not cover
pnpm cloud:typecheckType-check the cloud service, which pnpm typecheck does not cover either
pnpm test:emailsCheck the account-email templates against their snapshots
pnpm release:version X.Y.ZWrite the release version into package.json and every directory listing
pnpm listings:checkRefuse listings whose version or tool names disagree with the code
pnpm listings:tools <url>Regenerate the tool list in lhm.plugin.json from a running server's card

The four type-check and snapshot scripts are the only local checks; there is no test framework. The only CI is the release check on pull requests into prod, which validates the version and listings and builds the three images without pushing them. See Releases.

There is no predev hook, so start the services your connector needs before pnpm dev.

Authentication paths

The two surfaces never share credentials:

  • Management routes require the HTTP-only session cookie, stored as a SHA-256 hash in the app schema. A row in app.sessions always means fully signed in: a sign-in still owed a second factor lives in app.mfa_challenges until it is answered.
  • The MCP endpoint accepts only a connector token, from Authorization: Bearer or the /mcp/<token> path, and never falls back to a session.

Invalid tokens receive 401 with WWW-Authenticate. A database outage returns 503, so a transient failure is never mistaken for a revoked token. See How Automata works.

Request bodies are capped before they are buffered (server/utils/body-limit.ts): 64 KiB for /api, 1 MiB for token creation and scope edits, 256 KiB for webhooks, and 2 MiB for /mcp after the token authenticates. A new route that needs a larger body needs its own entry there, or it answers 413.

Add an MCP tool

Tools live under apps/web/server/mcp/tools, grouped by connection kind.

  1. Define the tool in the folder for its kind, with a read, write, or destructive annotation. Don't declare a reason argument: every tool gets an optional one for telemetry, removed before your handler runs, and a tool that declares its own fails at load.
  2. Register it for that kind only. Other kinds must never see it.
  3. Resolve the connection from the token, never from a tool argument.
  4. Enforce action scope and any chat or table allowlist on the server, before touching upstream data.
  5. List it in lhm.plugin.json, or the release check refuses the release: regenerate the list with pnpm listings:tools <url>/.well-known/mcp/server-card.json against a running server.
  6. Document it in the MCP tools reference.
View source