
Deploy Automata | WhatsApp, Telegram, SQL MCP
WhatsApp, Telegram & Postgres MCP for Claude | Alt to Zapier, Composio
Automata MCP
Just deployed
Redis
Just deployed
/data
Automata MCP Telegram Bridge
Just deployed
Evolution API Reforged
Just deployed
/evolution/instances
Just deployed
/var/lib/postgresql/data
Deploy and Host Automata | WhatsApp, Telegram, SQL MCP on Railway
Automata is a self-hosted MCP server that connects Claude, ChatGPT, Codex, Cursor and other AI assistants to your WhatsApp, Telegram and PostgreSQL. Link an account by QR code or paste a database URL, then issue connector tokens limited to specific chats, tables and tools. Teams share connections inside an organization, with roles, invitations and email alerts when a connection drops.
About Hosting Automata | WhatsApp, Telegram, SQL MCP
The template deploys five services that share one Postgres, each in its own schema:
- Automata MCP: the dashboard and the
/mcpendpoint. Runs its migrations at boot. - Evolution API (evolution-api-reforged) + Redis: WhatsApp.
- Automata MCP Telegram Bridge: Telegram.
- Postgres: app data, WhatsApp messages, Telegram sync.
Every secret is generated at deploy. Nothing is required to get WhatsApp and SQL working.
After you deploy
- Sign up. Open the Automata MCP service's public domain. The first account becomes the admin, and setup walks you through your first connection and token. Later sign-ups are by invitation only; to change that, set
NUXT_SIGNUP_CODE(orNUXT_SIGNUP=open) on Automata MCP. - Create the WhatsApp indexes. Strongly recommended. On a new deployment they take seconds; see Indexes below.
- Add a connection.
- WhatsApp: scan the QR code from WhatsApp → Settings → Linked devices. The number's past conversations are imported once, at pairing. Test with a spare number, because repeated pairing can get a number banned.
- SQL: paste a
postgres://URL. The role in that URL is the real security boundary, so use one that can only reach the tables you want Claude to see. - Telegram: needs API keys first (step 5).
- Mint a token and connect your assistant. Copy the connector URL from the token screen. In Claude: Settings → Connectors → Add custom connector. The app shows the steps for other assistants.
- Optional: Telegram API keys.
- Sign in at my.telegram.org with your phone number → API development tools → create an app (any name; platform "Other" is fine).
- Copy App api_id and App api_hash. (Telegram's guide)
- On Automata MCP Telegram Bridge → Variables, set
TELEGRAM_API_IDandTELEGRAM_API_HASH. Set both or neither: the bridge won't start with only one. Railway redeploys it, and Telegram appears under Add a connection. - Use your own keys. Telegram rejects pairs copied from tutorials.
- Back up
TELEGRAM_SESSION_ENCRYPTION_KEYsomewhere other than Railway. Losing or changing it unlinks every Telegram account.
- Optional: email. On Automata MCP set
NUXT_SMTP_HOST,NUXT_SMTP_PORT,NUXT_SMTP_USERNAME,NUXT_SMTP_PASSWORDandNUXT_MAIL_FROM(an address your provider accepts). Without SMTP, disconnect alerts aren't sent and invitation links are shown for you to copy. With SMTP set, new sign-ups must verify their email.
Indexes
Evolution indexes its "Message" table by account only. A number with years of history makes reading, chat listing and search time out (the app gives up after 10 s). The app looks for these indexes every 10 minutes and uses them once they exist, with no restart needed.
Run them as the postgres user with railway connect Postgres, one statement at a time. CONCURRENTLY can't run inside a transaction, and it keeps WhatsApp writing while the index builds.
CREATE INDEX CONCURRENTLY IF NOT EXISTS message_instance_ts_idx
ON "Message" ("instanceId", "messageTimestamp" DESC);
CREATE INDEX CONCURRENTLY IF NOT EXISTS message_instance_chat_ts_idx
ON "Message" ("instanceId", (key->>'remoteJid'), "messageTimestamp" DESC);
CREATE INDEX CONCURRENTLY IF NOT EXISTS message_lid_alt_idx
ON "Message" ("instanceId") WHERE key ? 'remoteJidAlt';
-- pg_trgm is installed in the telegram schema by the bridge
CREATE INDEX CONCURRENTLY IF NOT EXISTS isonwhatsapp_jidoptions_trgm
ON "IsOnWhatsapp" USING gin ("jidOptions" telegram.gin_trgm_ops);
For fast message search, also build message_body_trgm. Copy it exactly from docs/whatsapp.md → Indexes on Evolution's tables. Postgres ignores the index if its expression differs from the app's query at all, and nothing reports an error.
Upgrading an earlier deployment of this template (to 1.4)
- Back up Postgres first. Migrations only go forward; an older image can't read a migrated database.
- Evolution moved to the reforged fork. On its first start, the fork removes duplicate messages and adds the unique index
Message_instanceId_key_uniquein one transaction that blocks writes. Evolution serves nothing until it finishes. Under a few hundred thousand messages, just switch the image. Above that, build the index first while the old image keeps running: Moving from stock Evolution 2.3.7. Afterwards, check that the indexes above still exist (SELECT indexname FROM pg_indexes WHERE tablename = 'Message';). - Check the Automata MCP boot log. If it says
"Message" vacuum settings skipped, run this aspostgres:ALTER TABLE "Message" SET (autovacuum_vacuum_insert_scale_factor = 0.01, autovacuum_vacuum_scale_factor = 0.05); - Restart Evolution after any Postgres restart. Otherwise accounts can show as connected while nothing is sent or received.
Common Use Cases
- Let Claude/Codex/Grok read, search and summarize WhatsApp or Telegram conversations, including history imported at linking, and send replies
- Give Claude/Codex/Grok read-only (or write) SQL access to a Postgres database, limited to the tables you choose
- Share messaging accounts and databases across a team, with per-member tokens that can be revoked or rotated
Dependencies for Automata | WhatsApp, Telegram, SQL MCP Hosting
- PostgreSQL (app data, WhatsApp messages, Telegram sync)
- Evolution API (reforged) + Redis with persistence (WhatsApp)
- Automata Telegram bridge (Telegram; API ID/hash optional)
- SMTP server (optional, for alerts, invitations and email verification)
Implementation Details
- Tokens are bound to a single connection. Tools take no account or database argument, so a token can only reach the connection it was issued for.
- Keep Automata MCP at one replica. Disconnect alerts run in-process, so each extra replica sends duplicate emails.
- Keep
WEBHOOK_GLOBAL_ENABLED=falseon Evolution. The app registers a webhook per connection, so turning the global one on delivers every event twice.
Why Deploy Automata | WhatsApp, Telegram, SQL MCP on Railway?
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying Automata | WhatsApp, Telegram, SQL MCP on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.
Template Content
Automata MCP
ghcr.io/ju-li/automata-mcp-web:latestRedis
redis:8.2Automata MCP Telegram Bridge
ghcr.io/ju-li/automata-mcp-telegram-bridge:latestEvolution API Reforged
ghcr.io/operational-intelligence-inc/evolution-api-reforged:latest