Set up Claude Code

Claude Code connects to Mbox Viewer with one claude mcp add command that you copy from the Settings dialog. The command registers the server under the name mbox-viewer for every project and passes your access token in an environment variable. After that, Claude Code can search and read the mailboxes you shared.

What do I need before I start?

  • You need Mbox Viewer 0.4.0 or later and Claude Code on the same computer.
  • The MCP server must be on. Open Settings, go to MCP server (AI agents) and tick Enable the MCP server.
  • At least one mailbox must be ticked under Mailboxes the agent may see, and it must be fully indexed.
  • On macOS the app must run from the Applications folder. The copied command holds the path of the running copy, and a copy opened from the disk image or from Downloads runs from a temporary path (Install on macOS explains this).

Step 1: copy the command

  1. In the MCP server (AI agents) section, open Other ways to connect.
  2. Click Copy for Claude Code. The app shows the message "Configuration copied".

The copied command has this shape on macOS:

claude mcp add --scope user mbox-viewer -e MBOX_VIEWER_MCP_TOKEN=<token> -- '/Applications/Mbox Viewer.app/Contents/MacOS/mbox-viewer' --mcp

On Windows the path is in double quotes instead of single quotes. The app quotes the path for your shell, so you never edit the command.

Step 2: run it in a terminal

Paste the command into a terminal and run it. Then check the result:

claude mcp list

The list shows mbox-viewer. Inside a Claude Code session, the /mcp command shows the same server with its status. Start a new session if one was already open, because the first setup needs a client restart.

What does each part of the command mean?

Part Meaning
--scope user The server is available in every project. Without it, Claude Code registers it for the current project only.
mbox-viewer The name of the server in Claude Code.
-e MBOX_VIEWER_MCP_TOKEN=<token> The environment variable that carries the access token.
-- The end of the Claude Code options. Everything after it is the server command.
The quoted path The Mbox Viewer executable of the copy that you are running.
--mcp The argument that starts the executable as an MCP server with no window.

What can I ask Claude Code?

Claude Code reads the instructions of the server and starts with list_mailboxes to get the ids of your mailboxes. You can ask it to find the invoices you received in 2024, to summarize a thread or to count the messages of a sender. It writes the queries with the same operators as the search bar of the app. The Tools reference lists everything it can call.

What are the Windows specifics?

  • When Claude Code was installed through npm and the command fails in PowerShell, run it from cmd.exe. The npm claude.ps1 shim can swallow the --.
  • When the path of the app contains ", %, $ or a backtick, it cannot be quoted safely for a command line. The Copy for Claude Code button stays disabled in that case. Install Mbox Viewer in another folder to get the command.

How do I update or remove the server?

After Regenerate token…, the token stored by Claude Code no longer works and the tools answer invalid_token. Remove the entry and add it again with the new command:

claude mcp remove --scope user mbox-viewer

Do the same after you move the app to another folder, because the command holds its path. An update of Mbox Viewer in the same place needs no change, since the command starts the installed copy.

Frequently asked questions

Where do I get the Claude Code command?

Open Other ways to connect in the MCP server (AI agents) section of Settings and click Copy for Claude Code. The copied command already holds your token and the path of the app.

What does --scope user do?

It registers Mbox Viewer for every project on your computer. Without it, Claude Code registers the server for the current project only.

How do I check that Claude Code sees the server?

Run claude mcp list in a terminal, or type /mcp inside a Claude Code session. The mbox-viewer entry appears with its connection status.

Does Mbox Viewer need to be open while Claude Code uses it?

No. Claude Code starts its own copy of the server, which reads the indexes of the app on disk. Each mailbox must have been opened and indexed in Mbox Viewer at least once.

The command fails in PowerShell on Windows. What should I do?

Run the same command from cmd.exe. When Claude Code was installed through npm, the claude.ps1 shim of PowerShell can swallow the -- that separates the options from the server command.

Why is the Copy for Claude Code button disabled?

The button stays disabled while the server is off, and on Windows it also stays disabled when the path of the app contains ", %, $ or a backtick. Tick Enable the MCP server, or install Mbox Viewer in a folder whose path has none of these characters.

What do I do after regenerating the token?

Remove the old entry with claude mcp remove --scope user mbox-viewer, then copy and run the new command. Start a new Claude Code session afterwards, because a token change needs a client restart.

Where does Claude Code store the token?

Claude Code stores the token in clear text in ~/.claude.json, and the command also stays in your shell history. Any program running under your account can read both, so click Regenerate token… if you think the token leaked.

Where do I see the errors of the server in Claude Code?

Type /mcp in a session to see the status of the server, or start Claude Code with claude --debug to see its messages. A server that stops before the handshake writes the reason on its error output.