Skip to the documentation
CLI

AI and MCP

Translate, write and summarise mail, connect AI clients to your mailbox, call MCP tools, and ask the docs.

AI commands

CommandWhat it doesSign-in
ai translateTranslate a subject and body without sending anythingEither kind, with emails:send
ai languagesList every language translation acceptsAny, or none: signed out it prints the table built into the CLI
ai compose "<prompt>"Write an email body in your own styleA browser sign-in
ai summarize <thread-id>Print the summary Nextmail keeps for a threadA browser sign-in

translate and compose each spend one AI action from the workspace allowance for the day, and compose spends one more for each web search it runs. A spent allowance stops with exit code 8. compose and summarize run through the MCP tools composeEmail and getThreadSummary, which is why they need a browser sign-in: an API key cannot reach the MCP server.

Translate

Terminal
nextmail ai translate --to de --subject "Your invoice" --text "The invoice is attached."nextmail ai translate --to Japanese --body-file reply.html --no-originalcat notes.txt | nextmail ai translate --to frnextmail ai languages --search port

It runs the translation a translated send would run and prints the result, so you can read it before anything leaves. Nothing is stored or sent. --to takes a code, an English name or the language’s own name. The body comes from --text, --html, --body-file or stdin, and --text and --html also read a file with @path.

  • Your original text is kept below the translation, unless you pass --no-original.
  • The detected source language is printed on stderr, and --json prints the whole translation.
  • To translate as you send, use nextmail send --translate de.

Write and summarise

Terminal
nextmail ai compose "thank Ada for the invoice and ask for a PDF copy" --to ada@example.comnextmail ai compose "say yes to Tuesday at 3pm" --thread CAHk7pQ2x9LmZ4 --tone friendlynextmail ai compose "decline politely" --thread CAHk7pQ2x9LmZ4 | nextmail send --from you@acme.com --to ada@example.com --subject "Re: Proposal"nextmail ai summarize CAHk7pQ2x9LmZ4
  • compose prints a body written in your style and sends nothing, so pipe it into nextmail send when you are happy with it. With --thread it reads the latest messages of the thread first and writes a reply. --tone is one of formal, friendly, casual, concise, direct or warm.
  • summarize prints the summary with the subject, sender and date, and writes it first when there is none yet or new mail has arrived since. A thread with no summary, such as one holding an encrypted message, exits with code 5.

Connect an AI client

The Nextmail MCP server gives an AI client the tools the assistant in the app uses: it can read and send mail and manage contacts, templates, domains and more, limited to what you approve. A client connects in one of two ways, and nextmail mcp config prints both for the client you use:

  • The remote server. The client runs its own browser sign-in, you approve it on the Nextmail consent page, and it appears in Account → Connected apps. This is the simpler choice when the client supports it. Unless the client can ask you for a verification code itself, a tool that needs one is refused until you choose Allow changes for 60 minutes on that app there.
  • The local bridge, nextmail mcp serve, which the client starts through npx. It uses the sign-in of this CLI, so run nextmail login first. It suits clients that only start local servers.
Terminal
nextmail mcp confignextmail mcp config --client claude-codenextmail mcp config --client cursor --profile worknextmail mcp config --client vscode --json
claude mcp add --transport http nextmail https://api.nextmail.sh/mcp
claude mcp add nextmail -- npx -y @nextmail/cli mcp serve

After adding the remote server, Claude Code signs in from /mcp and Codex with codex mcp login nextmail. Claude Desktop adds it under Settings → Connectors → Add custom connector. nextmail mcp config --client <name> also says which file each client reads.

The local bridge

nextmail mcp serve reads newline-delimited JSON-RPC on stdin, forwards each message to the MCP server with your saved browser sign-in, and writes each answer to stdout as one line. It refreshes an expired access token without the client noticing, answers a batch as one array, and stops when stdin closes. Only protocol reaches stdout, and stderr stays quiet unless you pass --debug.

Terminal
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | nextmail mcp servenextmail mcp serve --profile worknextmail mcp serve --debug 2> mcp.log

The bridge cannot ask for a verification code over stdio. A tool that needs one reaches the client as a refusal, and the bridge prints one hint on stderr. Run nextmail verify in a terminal with the same profile, or choose Allow changes for 60 minutes on this sign-in in Account → Command line, and those tools run for the next 60 minutes.

Call tools yourself

Terminal
nextmail mcp toolsnextmail mcp tools composeEmailnextmail mcp call whoAmInextmail mcp call listThreads --arg folder=inbox --arg maxResults=5nextmail mcp call getThread --args '{"threadId":"CAHk7pQ2x9LmZ4"}'
  • mcp tools lists the tools this sign-in may use, which already leaves out any your role or the approval does not allow. Name a tool to see its description and arguments.
  • mcp call takes the arguments as one JSON object in --args (inline, @file or -), and --arg key=value sets one at a time. A value is read as JSON when it parses, so quote a number you mean as text.
  • The MCP server never asks for confirmation, so a tool that sends or deletes acts at once.
  • A result that starts with Refused ( exits with code 4. An unknown tool exits with 5, invalid arguments with 7, and a spent AI allowance with 8.

Some tools make a change the REST API guards with a verification code, and they ask for the same code. The API Authentication page lists them. In a terminal, mcp call asks for the code and calls the tool again. Unattended it exits with code 4, so run nextmail verify first.

Ask the docs

Terminal
nextmail docs ask "how do I verify a domain?"nextmail docs open cli/authenticationnextmail docs read cli/commandsnextmail docs read
  • docs ask puts a question to the docs assistant and prints the answer as it is written, then the pages it came from. It answers only from this documentation, needs no sign-in and never sends your credentials. A question can be up to 600 characters, and each network can ask a limited number a day.
  • docs open opens a page in your browser, and --print prints its link instead.
  • docs read prints a page as Markdown. With no page it prints the index of every page.