Skip to content

MCP Server

Herald includes a standalone MCP server in cmd/herald-mcp-server. It speaks JSON-RPC over stdio, reads the configured SQLite cache, and uses the daemon for tools that must mutate mail or talk to IMAP/SMTP live.

Terminal window
go build -o bin/herald-mcp-server ./cmd/herald-mcp-server
./bin/herald-mcp-server -config ~/.herald/conf.yaml

Smoke-test the server:

Terminal window
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | ./bin/herald-mcp-server -config ~/.herald/conf.yaml

If the cache is empty, open the TUI first and let Herald sync at least one folder.

Claude Code:

Terminal window
claude mcp add herald -- "$(pwd)/bin/herald-mcp-server" -config ~/.herald/conf.yaml

Cursor .cursor/mcp.json:

{
"mcpServers": {
"herald": {
"command": "/path/to/herald/bin/herald-mcp-server",
"args": ["-config", "~/.herald/conf.yaml"]
}
}
}

Codex:

Terminal window
CODEX_MCP_SERVERS='{"herald":{"command":"/path/to/herald/bin/herald-mcp-server","args":["-config","~/.herald/conf.yaml"]}}' codex
CategoryTools
Read/searchlist_recent_emails, search_emails, get_sender_stats, get_email_classifications, get_email_body, list_unread_emails, search_by_date, search_by_sender, semantic_search_emails
AI/classificationclassify_email, classify_folder, summarise_email, summarise_thread, extract_action_items, draft_reply, list_classification_prompts, classify_email_custom, get_custom_category
Rules and cleanuplist_rules, add_rule, run_rules, list_cleanup_rules, create_cleanup_rule, run_cleanup_rules
Contactslist_contacts, search_contacts, semantic_search_contacts, get_contact
Folder/synclist_folders, get_server_info, sync_folder, sync_all_folders, get_sync_status, create_folder, rename_folder, delete_folder
Message mutationmark_read, mark_unread, delete_email, archive_email, move_email, delete_thread, archive_thread, bulk_delete, archive_sender, bulk_move, unsubscribe_sender, soft_unsubscribe_sender
Compose/draftssend_email, save_draft, list_drafts, send_draft, reply_to_email, forward_email
Attachmentslist_attachments, get_attachment

Read-only cache tools can work without the daemon after the TUI has populated the cache. Write, sync, send, draft, attachment, unsubscribe, folder mutation, and many live classification tools require the daemon.

At startup, the MCP server probes the configured daemon port, defaulting to 127.0.0.1:7272. If the daemon is running, daemon-backed tools call local HTTP endpoints. If it is not running, those tools fail gracefully with a daemon-not-running message.

Start the daemon when you want MCP tools to mutate mail:

Terminal window
./bin/herald serve -config ~/.herald/conf.yaml

The MCP server exposes cached email data to the MCP client you configure. The client may include returned mail data in its own model requests. Daemon-backed tools can mutate IMAP mail, send SMTP messages, save drafts, retrieve attachments, run cleanup rules, and trigger unsubscribe actions.

If tools/list fails, confirm the binary path and -config path. If read tools return no rows, run the TUI and sync a folder. If write tools fail, start herald serve and check herald status.