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 imagesStart 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
| Command | Purpose |
|---|---|
pnpm dev | Run the Nuxt app on the host |
pnpm build, pnpm preview | Build the web app for production, then serve that build |
pnpm services:up, :whatsapp, :telegram | Start service profiles |
pnpm services:down, services:logs, services:ps | Stop, tail, and inspect services, across every profile |
pnpm bridge:dev | Run the Telegram bridge on the host instead of in Compose |
pnpm cloud:dev | Run the hosted-only cloud service on the host |
pnpm typecheck | Type-check the web app |
pnpm bridge:typecheck | Type-check the Telegram bridge, which pnpm typecheck does not cover |
pnpm cloud:typecheck | Type-check the cloud service, which pnpm typecheck does not cover either |
pnpm test:emails | Check the account-email templates against their snapshots |
pnpm release:version X.Y.Z | Write the release version into package.json and every directory listing |
pnpm listings:check | Refuse 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
appschema. A row inapp.sessionsalways means fully signed in: a sign-in still owed a second factor lives inapp.mfa_challengesuntil it is answered. - The MCP endpoint accepts only a connector token, from
Authorization: Beareror 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.
- Define the tool in the folder for its kind, with a read, write, or destructive annotation. Don't declare a
reasonargument: every tool gets an optional one for telemetry, removed before your handler runs, and a tool that declares its own fails at load. - Register it for that kind only. Other kinds must never see it.
- Resolve the connection from the token, never from a tool argument.
- Enforce action scope and any chat or table allowlist on the server, before touching upstream data.
- List it in
lhm.plugin.json, or the release check refuses the release: regenerate the list withpnpm listings:tools <url>/.well-known/mcp/server-card.jsonagainst a running server. - Document it in the MCP tools reference.
Tool annotations only describe behavior to clients. The server-side gates are what enforce it, so new tools must pass through the same scope checks as existing ones.