Skip to content
GitHub stars

CLI Reference

Global Flags

FlagDescription
--configPath to config file (default: ~/.msgvault/config.toml)
--helpShow help

init-db

Initialize the SQLite database.

Terminal window
msgvault init-db

add-account

Add a Gmail account and authorize via OAuth.

Terminal window
msgvault add-account <email>
msgvault add-account <email> --headless
FlagDescription
--headlessUse device authorization flow (no browser)

sync-full

Download all messages from a Gmail account. When called without an email argument, syncs all configured accounts.

Terminal window
msgvault sync-full [email] [flags]
FlagDescription
--limit NMaximum messages to download
--after YYYY-MM-DDOnly messages after this date
--before YYYY-MM-DDOnly messages before this date
--noresumeIgnore checkpoints, start fresh
--verboseDetailed progress output

sync

Sync new and changed messages using Gmail History API. When called without an email argument, syncs all accounts that have completed an initial full sync.

Terminal window
msgvault sync [email]

Search the archive with Gmail-like query syntax.

Terminal window
msgvault search <query> [flags]
FlagDescription
--jsonOutput results as JSON

See Searching for the full operator reference.


tui

Launch the interactive terminal interface.

Terminal window
msgvault tui [flags]
FlagDescription
--account <email>Filter to a specific account

export-eml

Export a message as a .eml file.

Terminal window
msgvault export-eml [flags]
FlagDescription
--message-id NInternal database message ID
--gmail-id <hex>Gmail message ID
--output <path>Output file (default: stdout)

verify

Verify local archive integrity against Gmail.

Terminal window
msgvault verify <email> [flags]
FlagDescription
--sample-size NMessages to sample (default: 100)

stats

Show archive statistics.

Terminal window
msgvault stats

list-senders

List top senders by message count.

Terminal window
msgvault list-senders [flags]
FlagDescription
--limit NNumber of results (default: 10)

list-domains

List top sender domains by message count.

Terminal window
msgvault list-domains [flags]
FlagDescription
--limit NNumber of results (default: 10)

list-labels

List all labels with message counts.

Terminal window
msgvault list-labels

build-cache

Build or update the Parquet analytics cache.

Terminal window
msgvault build-cache [flags]
FlagDescription
--full-rebuildDiscard existing cache and rebuild

mcp

Start the Model Context Protocol server for AI assistant integration.

Terminal window
msgvault mcp [flags]
FlagDefaultDescription
--force-sqlfalseAlways use SQL retrieval instead of FTS5

See MCP Server for configuration and tool reference.


cancel-deletion

Cancel pending or in-progress deletion batches. When called without a batch ID, lists available batches.

Terminal window
msgvault cancel-deletion [batch-id]
msgvault cancel-deletion --all
FlagDescription
--allCancel all pending and in-progress batches

repair-encoding

Fix UTF-8 encoding issues in existing messages.

Terminal window
msgvault repair-encoding