Self-host Meerko
Run the whole of Meerko yourself: the API, the background worker that sends and reads email, the web dashboard and Postgres. It's the same code as Meerko Cloud, under AGPL-3.0. Credits are off, so lead search and enrichment run on your own provider key.
Docs menu
What you'll run
| Piece | What it does |
|---|---|
| Postgres | All your data. docker-compose.yml runs Postgres 17 on port 54329. |
| API · :8787 | Everything the CLI, agents and the dashboard call, including the MCP server at /mcp. Also signs apps in (OAuth) and serves unsubscribe links. |
| Worker | Sends due emails every 30 seconds (at most one per mailbox per pass) and scans for replies every 2 minutes. |
| Web · :3000 | The dashboard: leads, sequences, the inbox and settings. |
You need Node 20 or later, pnpm and Docker.
Step 1: Install
$ git clone --branch main https://github.com/polynode-co/meerko ~/meerko$ cd ~/meerko$ pnpm install$ cp .env.example .env
main is the released code, the same that runs Meerko Cloud; dev has changes not released yet. .env works as-is for a local install. You'll fill in the Google and search keys in steps 4 and 5.
Step 2: Start the database
$ pnpm db:up # Postgres on localhost:54329$ pnpm db:migrate$ pnpm db:seed # prints your API key (mk_…)
The seed creates a workspace and an API key named "seed", and prints the key once. Keep it: the CLI, your agent and the dashboard can all log in with it.
Step 3: Run Meerko
$ pnpm dev
This starts the API on http://localhost:8787, the worker and the dashboard on http://localhost:3000. Open localhost:3000/login and log in with the API key from the seed. To run them one at a time, use pnpm --filter @meerko/api dev, @meerko/worker or @meerko/web.
Until MEERKO_ENCRYPTION_KEY is set (step 4), the worker logs "Sender idle" and sends nothing. Tables, imports and AI columns already work. Once Google or email sign-in is on (step 4), the login page offers it instead; the API-key form stays at localhost:3000/login?method=key.
Step 4: Connect a mailbox (to send email)
Meerko sends from your own mailbox: Gmail and Google Workspace, Zoho, Fastmail or any IMAP/SMTP server with an app password, or Outlook and Microsoft 365 (below). App passwords need no Google Cloud or other developer setup. Set a key to encrypt the stored passwords and tokens:
# generate with: openssl rand -base64 32$ MEERKO_ENCRYPTION_KEY=…
Restart pnpm dev, then connect a mailbox from Connections in the dashboard (pick your provider), or with pnpm meerko mailboxes connect (--provider zoho, fastmail or other with your IMAP and SMTP hosts). Both explain how to create the app password; Mailboxes has the details.
Never change MEERKO_ENCRYPTION_KEY once mailboxes are connected: the stored passwords and tokens can't be read without it.
Optional: Outlook and Microsoft 365. Outlook connects with Sign in with Microsoft, through your own app. In Microsoft Entra (App registrations), register an app for "any organizational directory and personal Microsoft accounts", with the redirect URI http://localhost:8787/oauth/microsoft/callback and the delegated Microsoft Graph permissions Mail.Send, Mail.Read, User.Read and offline_access. Create a client secret and put both in .env; Connections then offers Outlook:
$ MICROSOFT_CLIENT_ID=…$ MICROSOFT_CLIENT_SECRET=…
Microsoft accepts plain http:// redirect URIs only for localhost: on a server, the API needs HTTPS. Work accounts need a Microsoft 365 license with Exchange Online (Outlook); Meerko refuses an account without a mailbox and says so.
Optional: Sign in with Google. For the dashboard's "Sign in with Google", create an OAuth client of type Web application in a Google Cloud project, with the authorized redirect URI http://localhost:8787/auth/google/callback, and put it in .env:
$ GOOGLE_CLIENT_ID=…apps.googleusercontent.com$ GOOGLE_CLIENT_SECRET=…
Then invite your address with pnpm db:invite you@example.com. With MEERKO_SIGNUP=open, any Google account can create a workspace.
Optional: sign-in links by email. To let people sign in without Google, give Meerko any SMTP server to send from (your own mail provider, or a service such as Postmark or Resend). The login page then offers "Email me a sign-in link"; each link works once and expires in 15 minutes:
$ MEERKO_SMTP_URL=smtp://user:password@smtp.example.com:587$ MEERKO_MAIL_FROM=Meerko <noreply@example.com>
Optional: connect mailboxes through Google instead. The same client can connect Gmail through Google's consent page (the Gmail API) instead of app passwords. Enable the Gmail API, add http://localhost:8787/oauth/google/callback to the redirect URIs, and set MEERKO_GMAIL_OAUTH=1. If everyone who'll send works in one Google Workspace organisation, make the consent screen Internal: Google then needs no verification. An External app in "Testing" expires its tokens after 7 days (Google's docs), and Meerko then pauses that mailbox until you reconnect it.
Step 5: Turn on lead search
People and company search and email finding run on Icypeas. Put your Icypeas API key in ICYPEAS_API_KEY for the whole server, or store one per workspace in Connections or with pnpm meerko keys set icypeas <key> (needs MEERKO_ENCRYPTION_KEY). Without either, search and enrichment return an error; everything else works, including importing your own CSV.
Environment variables
All of them live in .env at the repo root; .env.example has comments for each. Running from source, the dashboard (pnpm dev) reads apps/web/.env.local instead, and its defaults work for a local install.
| Variable | What it's for |
|---|---|
| DATABASE_URL | Postgres connection string. Required. |
| PORT | The API's port. Default 8787. |
| MEERKO_PUBLIC_URL | The API's public URL: Google redirects, unsubscribe links, and the API and MCP addresses the dashboard shows. Default http://localhost:8787. |
| MEERKO_APP_URL | The dashboard's URL. After connecting Gmail or signing in, the browser comes back here, and apps are approved on its consent page. Required for Google sign-in, agent sign-in and billing; .env.example sets http://localhost:3000. |
| MEERKO_API_URL | Where the dashboard's server, the CLI and the MCP server reach the API. Default http://localhost:8787. |
| MEERKO_ENCRYPTION_KEY | 32 bytes, base64. Encrypts mailbox app passwords and tokens, provider keys and unsubscribe links. Required to send, to sign in with Google, for agent sign-in and to store provider keys. |
| GOOGLE_CLIENT_ID · GOOGLE_CLIENT_SECRET | Your OAuth client, for Sign in with Google, and for mailboxes connected through Google's consent page. Not needed to send with app passwords. |
| MEERKO_GMAIL_OAUTH | 1 offers Google's consent page (Gmail API) for connecting mailboxes, besides app passwords. Needs the OAuth client and the Gmail API. Off by default. |
| MICROSOFT_CLIENT_ID · MICROSOFT_CLIENT_SECRET | Your app in Microsoft Entra, for connecting Outlook and Microsoft 365 mailboxes (step 4). Without them, Outlook isn't offered. |
| SLACK_CLIENT_ID · SLACK_CLIENT_SECRET · SLACK_SIGNING_SECRET | Your Slack app, for replies and drafts in a channel with Approve buttons, and /meerko. Without them, Connections → Slack takes a pasted incoming webhook instead, which only posts. Setup in Slack. |
| MEERKO_ALLOW_PRIVATE_HOOKS | 1 lets Autopilot webhooks call private addresses such as localhost or your LAN. Self-hosting only; off by default. |
| MEERKO_SIGNUP | invite (default): only addresses added with pnpm db:invite can sign in. open: anyone can sign up, with Google or an email link. |
| MEERKO_SMTP_URL · MEERKO_MAIL_FROM | Any SMTP server (smtp://user:password@host:587, smtps:// for 465) and the sender address, for sign-in links by email. Needs MEERKO_APP_URL. Without them, the login page offers Google (or an API key) only. |
| ICYPEAS_API_KEY | Lead search and email finding for every workspace on this server. |
| MEERKO_CREDITS | off (default) when self-hosting. on meters search and enrichment in credits, as on Meerko Cloud. Setting up Stripe turns it on. |
| MEERKO_OPENAI_APPS_CHALLENGE | The token served at /.well-known/openai-apps-challenge, which OpenAI reads to verify the domain behind a ChatGPT plugin. Leave it empty unless you list your own server as one. |
| MEERKO_GLAMA_CLAIM | The claim served at /.well-known/glama.json, which Glama reads to verify who owns a hosted connector it lists. Leave it empty unless you claim your own server there. |
| MEERKO_TICK_SECRET | Meerko Cloud only, where a scheduler replaces the worker. Leave it empty. |
| STRIPE_* | Billing, as on Meerko Cloud (see .env.example). Leave them empty: no billing and no plan limits. |
| POSTHOG_API_KEY · NEXT_PUBLIC_POSTHOG_KEY · POSTHOG_HOST | Product analytics (POSTHOG_HOST defaults to PostHog's EU cloud). Leave the keys empty and nothing is sent anywhere. |
| MEERKO_TELEMETRY | 1 sends Meerko one anonymous ping a day so we can count installs. Off by default; see Telemetry. |
| NEXT_PUBLIC_SITE_URL | The dashboard's public URL, built into its image (Docker builds only). Same as MEERKO_APP_URL. |
Connect your agent
The API serves the MCP server at http://localhost:8787/mcp. With Google or email sign-in on (step 4), agents and the CLI sign in with the browser, as on Meerko Cloud:
$ claude mcp add --transport http --scope user meerko http://localhost:8787/mcp$ pnpm meerko login
Without either, use the key from the seed: add --header "Authorization: Bearer mk_…" to the first command, and --key mk_… to the second. More in Claude Code and Codex & Cursor.
Run it all with Docker
docker-compose.selfhost.yml runs everything in containers: Postgres, the migrations, the API, the worker and the dashboard. You need Docker and the .env from step 1, with the encryption key filled in (step 4).
$ docker compose -f docker-compose.selfhost.yml up -d --build$ docker compose -f docker-compose.selfhost.yml run --rm tools packages/core/src/seed.ts # prints an API key
The dashboard is on http://localhost:3000 and the API on http://localhost:8787, as with pnpm dev, so the same Google redirect URIs work. Migrations run on every up. Invite someone with run --rm tools packages/core/src/invite.ts you@example.com.
Running it in production
- Serve the API on a public URL and set
MEERKO_PUBLIC_URLto it: recipients click unsubscribe links on it, and Google, Microsoft and Slack redirect to it. Update the redirect URIs in each app you set up to match (/auth/google/callback,/oauth/google/callback,/oauth/microsoft/callback, and the Slack app's URLs). - Set
MEERKO_APP_URLto the dashboard's public URL too, and serve both over HTTPS behind a reverse proxy. With Docker Compose, point the proxy at ports 3000 and 8787. - Or build the images yourself from the repo root:
apps/api/Dockerfile,apps/worker/Dockerfileandapps/web/Dockerfile. Each listens on port 8080 (the worker listens on none). The dashboard takesNEXT_PUBLIC_SITE_URLat build time, andMEERKO_API_URLandMEERKO_PUBLIC_URLat runtime. - Keep one worker running (more is safe): it sends the emails and finds the replies. On shutdown it finishes the current pass first.
- Outside Docker Compose, run
pnpm db:migrateagainst the production database before each deploy; migrations don't run on start. - Back up Postgres, and the encryption key with it.
Telemetry
Off by default: a self-hosted Meerko sends nothing to us. If you'd like to be counted, set MEERKO_TELEMETRY=1 for the worker. Once a day it posts one field to https://api.meerko.ai/telemetry/ping: install_id, a SHA-256 hash of your first workspace's id. That lets us count installs without being able to tell whose they are.
Nothing else goes with it: no leads, mail, mailboxes, users, workspace names, hostnames or usage counts. The code is packages/core/src/telemetry.ts. Unset the variable to stop. The worker only pings once MEERKO_ENCRYPTION_KEY is set and a workspace exists.
Updating
$ git pull$ pnpm install$ pnpm db:migrate
With Docker: git pull, then docker compose -f docker-compose.selfhost.yml up -d --build, which also migrates.