A keyboard-first email client with one inbox for all your accounts.
pnpm install
cp .env.example .env
pnpm dev/mcp is a remote MCP server for the mail in all accounts of a workspace. Add ${APP_URL}/mcp as a custom connector in Claude, ChatGPT, or another MCP client. The client signs in with OAuth 2.1. The tools are list_accounts, search_threads, get_thread, get_attachment, modify_threads, send_message, and compose_message.
-
The server uses mcp-use. The tools are in
app/mcp/server.ts. ThemcpUse()Vite plugin runs that file in its own Vite environment, andapp/routes/mcp.tsforwards/mcpand/mcp/*to it. -
compose_messageis an MCP App. It sends nothing. The chat shows the email in the viewapp/mcp/views/compose-message/view.tsx, where the user edits it and presses Send. Send callssend_message. A client without MCP Apps gets the draft as text. -
mcp-env.d.tsgives the view the types of the tools. mcp-use makes it again when Vite starts. -
Better Auth (
@better-auth/mcp) is the authorization server, under/api/auth. It supports Client ID Metadata Documents and Dynamic Client Registration. The config is inapp/server/agent-auth.server.ts. -
A workspace has no password. The login step (
/oauth/login) uses the mail session of the browser. The consent step is/oauth/consent. -
The scopes are
mail:read,mail:write, andmail:send.offline_accessgives a refresh token. -
Settings › AI agents lists the connected agents. Disconnect takes effect at once.
-
/agentsis the public documentation of the connector. The Claude and ChatGPT directory listings link to it. -
/reviewis the sign-in for directory reviewers.REVIEW_PASSWORDturns it on. Each sign-in gets a new workspace with three demo accounts, so reviewers never share a workspace. Demo accounts send nothing. -
OPENAI_APPS_CHALLENGEis the domain token for ChatGPT, at/.well-known/openai-apps-challenge.
ENCRYPTION_KEY encrypts the account credentials and the cached thread summaries in the database. Each stored value names the key that encrypted it, so you can replace the key without a loss of data. Replace the key if it possibly leaked, for example after a security incident at the host.
- Make a new key with
openssl rand -base64 32. - In production, move the old key to
ENCRYPTION_KEY_PREVIOUS, and put the new key inENCRYPTION_KEY.ENCRYPTION_KEY_PREVIOUScan hold more than one key, separated by commas. - Redeploy. The app now encrypts with the new key, and it decrypts with the old and the new key.
- Run
pnpm reencryptwith the productionDATABASE_URL,ENCRYPTION_KEY, andENCRYPTION_KEY_PREVIOUS. It encrypts all stored values again with the new key. - Run
pnpm reencrypt --check. It must say "All values use the current key." - Remove
ENCRYPTION_KEY_PREVIOUSin production, and redeploy.
If a step fails, do not remove the old key. The app cannot read a value without its key.