Connect MultiMail to Neovim for AI Email

Add email tools to Neovim's AI workflow through mcp.nvim. Fully customizable MCP integration with Lua configuration.


Neovim's extensible architecture makes it possible to integrate MCP servers through community plugins like mcp.nvim. Combined with an AI chat plugin like avante.nvim or codecompanion.nvim, you get a fully terminal-native AI assistant with email capabilities powered by MultiMail.

The setup requires more configuration than GUI-based editors, but the result is a deeply customizable workflow. MCP servers are configured in Lua within your init.lua or a dedicated plugin config file, giving you fine-grained control over how MultiMail's tools are exposed to your AI assistant.

For developers who live in the terminal and prefer Neovim's modal editing, this integration means you never have to leave your editor to handle email. Read bug reports, send deployment updates, and manage contacts — all through your familiar Neovim keybindings and workflow.

Get started

1

Get your MultiMail API key

Sign up at multimail.dev and create an API key from your dashboard. This key authenticates all MCP server requests.

2

Install mcp.nvim plugin

Add mcp.nvim to your Neovim plugin manager. If using lazy.nvim, add it to your plugin spec. This plugin provides the MCP client infrastructure for Neovim.

3

Install an AI chat plugin

Install avante.nvim, codecompanion.nvim, or another AI chat plugin that supports MCP tool use. The AI plugin provides the interface for interacting with MCP tools.

4

Configure MultiMail in your init.lua

Add the MultiMail MCP server configuration to your Neovim config.

json
require('mcp').setup({
  servers = {
    multimail = {
      command = 'npx',
      args = { '-y', '@multimail/mcp-server' },
      env = {
        MULTIMAIL_API_KEY = 'mm_live_your_key_here',
      },
    },
  },
})
5

Create an agent mailbox

In the MultiMail dashboard, create a mailbox for your Neovim AI assistant. Set oversight to gated_send so outbound emails require approval.

6

Verify the connection

Open your AI chat plugin and ask it to list your mailboxes. You can also run :McpStatus (if available) to check server connectivity.


Available MCP tools

ToolDescriptionExample
send_emailSend an email from your agent mailbox to any recipient.Send a patch summary email after finishing a refactor in Neovim.
reply_emailReply to a received email, maintaining the thread context.Reply to a mailing list discussion with your code analysis.
check_inboxCheck a mailbox for new or unread messages.Check for new patch review emails between editing sessions.
read_emailRead the full content of a specific email including headers and body.Read a bug report before diving into the relevant source file.
create_mailboxCreate a new agent mailbox on your MultiMail account.Create a mailbox for an open-source project you maintain.
list_mailboxesList all mailboxes on your MultiMail account.View available mailboxes to pick the right sender.
get_threadRetrieve an entire email thread to see the full conversation history.Review a full discussion thread on a mailing list.
search_contactsSearch your contact list by name, email, or tags.Find a maintainer's email to send a patch for review.
add_contactAdd a new contact to your MultiMail contact list.Save a contributor's email after they submit their first patch.
tag_emailTag or categorize an email for organization and filtering.Tag emails by project or component for quick filtering.
list_pendingList all emails currently awaiting human approval.Review pending emails before closing your terminal session.
decide_emailApprove or reject a pending email in the oversight queue.Approve a release announcement email after reviewing content.

Usage examples

mcp.nvim configuration with lazy.nvim
lua
{
  'mcp-hub/mcp.nvim',
  dependencies = { 'nvim-lua/plenary.nvim' },
  config = function()
    require('mcp').setup({
      servers = {
        multimail = {
          command = 'npx',
          args = { '-y', '@multimail/mcp-server' },
          env = {
            MULTIMAIL_API_KEY = vim.env.MULTIMAIL_API_KEY or 'mm_live_your_key_here',
          },
        },
      },
    })
  end,
}

Add this to your lazy.nvim plugin spec to configure MultiMail.

Environment variable approach
lua
-- In your shell profile (.zshrc, .bashrc):
-- export MULTIMAIL_API_KEY='mm_live_your_key_here'

-- In your init.lua:
require('mcp').setup({
  servers = {
    multimail = {
      command = 'npx',
      args = { '-y', '@multimail/mcp-server' },
      env = {
        MULTIMAIL_API_KEY = vim.env.MULTIMAIL_API_KEY,
      },
    },
  },
})

Use an environment variable for the API key instead of hardcoding it.

Email workflow prompt
text
Check my MultiMail inbox for unread emails. Summarize each one in a line. For any that look like bug reports, read the full email and check if the mentioned file exists in our project.

Example interaction with your AI chat plugin using MultiMail tools.

Keybinding for quick inbox check
lua
vim.keymap.set('n', '<leader>mi', function()
  -- Trigger your AI chat plugin with an inbox check prompt
  -- Adjust this to match your specific AI chat plugin's API
  require('avante').ask('Check my MultiMail inbox and summarize any unread emails.')
end, { desc = 'Check MultiMail inbox' })

Set up a keybinding to quickly check your inbox through the AI assistant.


Best practices

Use environment variables for your API key

Instead of hardcoding your API key in init.lua, use vim.env.MULTIMAIL_API_KEY to read it from the environment. Set the key in your .zshrc or .bashrc with 'export MULTIMAIL_API_KEY=mm_live_your_key_here' to keep secrets out of your dotfiles repo.

Choose the right AI chat plugin

mcp.nvim provides the MCP transport layer, but you need a chat plugin for the AI interface. avante.nvim offers a sidebar chat with tool support, while codecompanion.nvim integrates more tightly with Neovim's buffers. Try both to see which fits your workflow.

Create custom keybindings for email

Map frequently used email operations to keybindings. For example, map <leader>mi to check your inbox, <leader>ms to draft an email, and <leader>mp to list pending approvals. This keeps email operations as fast as your regular Neovim workflow.

Terminal-native debugging

If the MCP server fails to connect, you can debug it directly in your terminal by running 'npx -y @multimail/mcp-server' to verify the server starts. Check Neovim's :messages or the mcp.nvim log for connection errors.


Common questions

Which Neovim plugins do I need for MCP support?
You need two plugins: mcp.nvim (or a similar MCP client plugin) for the transport layer, and an AI chat plugin like avante.nvim or codecompanion.nvim for the user interface. mcp.nvim handles connecting to MCP servers and routing tool calls, while the chat plugin provides the conversational interface where you interact with the tools.
Can I use a local LLM with MultiMail in Neovim?
Yes. Neovim's AI chat plugins typically support multiple model backends, including local models through Ollama. You can run a local model for the AI conversation while using MultiMail's MCP server for email operations. The MCP server communicates with MultiMail's cloud API, but your prompts stay local.
Does this work in regular Vim?
No, MCP integration requires Neovim's Lua runtime and plugin ecosystem. Regular Vim does not support the plugins needed for MCP connectivity. If you're on Vim, consider switching to Neovim for AI and MCP features while keeping your existing vimrc configuration.
How do I keep my API key secure in my dotfiles?
Never hardcode your API key in init.lua if you track your dotfiles in git. Instead, use vim.env.MULTIMAIL_API_KEY to read the key from an environment variable set in your shell profile. Alternatively, use a secrets manager or a separate untracked file that you source in your config.
Can I use this with Neovim inside tmux?
Yes, mcp.nvim works inside tmux sessions without any special configuration. The MCP server runs as a child process of Neovim, so tmux does not interfere with the stdio communication. Your email tools work the same whether Neovim is running directly or inside a tmux pane.

More MCP clients

The only agent email with a verifiable sender

Email infrastructure built for AI agents. Verifiable identity, graduated oversight, and a 38-tool MCP server. Formally verified in Lean 4.