Himalaya MCP Server

Himalaya MCP Server

Enables AI agents to interact with email accounts via the Himalaya CLI, supporting features like message reading, folder management, and controlled email sending. It prioritizes security with graduated permission modes and the exclusion of destructive operations like permanent deletion.

Category
访问服务器

README

himalaya-mcp-server

MCP server that exposes email operations to AI agents (Claude Cowork, Claude Code, etc.) via the himalaya CLI.

Read-only by default. Write and send operations must be explicitly enabled.

Features

  • Broad himalaya coverage: accounts, folders, envelopes, messages, flags, attachments, templates
  • Three modes: read-only (safe default), full (write operations), and dangerzone (sending emails)
  • No destructive operations: delete, purge, and expunge commands are deliberately excluded (see Excluded Commands)
  • Security-first: write tools labeled [DANGER: WRITE], send tools labeled [DANGERZONE: SENDS EMAIL]
  • No shell injection: all CLI calls use subprocess.run() with list arguments
  • Stdio transport: works natively with Claude Desktop / Cowork via claude_desktop_config.json

Prerequisites

  1. Python 3.12+
  2. uv — install with brew install uv (macOS) or see uv docs
  3. himalaya — installed and configured with at least one email account

Verify himalaya is working:

himalaya account list

Installation

Clone the repository:

git clone https://github.com/andasv/himalaya-mcp-server.git
cd himalaya-mcp-server
uv sync

Usage with Claude Cowork / Claude Desktop

Add the server to your claude_desktop_config.json:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json

Read-only mode (default, recommended)

{
  "mcpServers": {
    "himalaya": {
      "command": "uv",
      "args": ["run", "--project", "/path/to/himalaya-mcp-server", "himalaya-mcp-server"]
    }
  }
}

Full mode (enables move, copy, flag, and other write operations)

Warning: Full mode allows the AI agent to move messages, modify flags, create folders, and save drafts. It does not allow sending emails.

{
  "mcpServers": {
    "himalaya": {
      "command": "uv",
      "args": ["run", "--project", "/path/to/himalaya-mcp-server", "himalaya-mcp-server"],
      "env": {
        "HIMALAYA_MODE": "full"
      }
    }
  }
}

Dangerzone mode (enables sending emails)

Warning: Dangerzone mode allows the AI agent to send real emails to real recipients. This is irreversible. Only enable this if you fully understand the risks.

Dangerzone mode requires the APPROVED_RECIPIENTS environment variable — a comma-separated list of email addresses the AI is allowed to send to. Sending to any other address will be blocked with a friendly error.

{
  "mcpServers": {
    "himalaya": {
      "command": "uv",
      "args": ["run", "--project", "/path/to/himalaya-mcp-server", "himalaya-mcp-server"],
      "env": {
        "HIMALAYA_MODE": "dangerzone",
        "APPROVED_RECIPIENTS": "alice@example.com,bob@example.com",
        "HIMALAYA_SEND_TIMEOUT": "15"
      }
    }
  }
}

After editing the config, restart Claude Desktop for changes to take effect.

Usage with Claude Code

# Read-only (default)
claude mcp add himalaya -- uv run --project /path/to/himalaya-mcp-server himalaya-mcp-server

# Full mode (write operations, no sending)
claude mcp add --env HIMALAYA_MODE=full himalaya -- uv run --project /path/to/himalaya-mcp-server himalaya-mcp-server

# Dangerzone mode (write + send, with approved recipients)
claude mcp add --env HIMALAYA_MODE=dangerzone --env APPROVED_RECIPIENTS=alice@example.com,bob@example.com himalaya -- uv run --project /path/to/himalaya-mcp-server himalaya-mcp-server

Modes

Mode Env var Tools available
readonly (default) HIMALAYA_MODE=readonly or unset List accounts/folders/envelopes, read messages, download attachments, generate templates
full HIMALAYA_MODE=full All of the above + move, copy, flag, create folders, save drafts
dangerzone HIMALAYA_MODE=dangerzone All of the above + send emails

Environment Variables

Variable Required Default Description
HIMALAYA_MODE No readonly Operating mode: readonly, full, or dangerzone
APPROVED_RECIPIENTS In dangerzone Comma-separated list of email addresses allowed as recipients
HIMALAYA_SEND_TIMEOUT No 15 Timeout in seconds for send operations. Himalaya retries SMTP 450 errors indefinitely, so this prevents hangs. Keep below 60s (Cowork's tool timeout).
HIMALAYA_LOG_LEVEL No WARNING Log verbosity: DEBUG, INFO, WARNING, ERROR. Logs never contain email content or credentials — stderr from himalaya CLI is sanitized before logging.

Available Tools

Read-only tools (always available)

Tool Description
account_list List configured email accounts
folder_list List folders/mailboxes
envelope_list List message envelopes with search/filter/pagination
envelope_thread Get thread view of envelopes
message_read Read a message body by ID
message_thread Read a full message thread
attachment_download Download attachments from a message
template_write Generate a blank email template (MML)
template_reply Generate a reply template
template_forward Generate a forward template

Write tools (full and dangerzone modes)

These tools are prefixed with [DANGER: WRITE] in their descriptions so the AI agent clearly sees the risk.

Tool Description
folder_create Create a new folder
message_copy Copy a message to another folder
message_move Move a message to another folder
message_save Save a raw MIME message to a folder
flag_add Add flags to a message
flag_set Replace all flags on a message
flag_remove Remove flags from a message
template_save Compile MML template and save to folder

Send tools (dangerzone mode only)

These tools are prefixed with [DANGERZONE: SENDS EMAIL] in their descriptions. They send real emails to real recipients and cannot be undone.

Tool Description
message_send Send a raw MIME message
template_send Compile MML template and send email

Composing and sending emails

Since himalaya's interactive editor commands can't be used in an MCP context, email composition uses the template pipeline:

  1. Generate a template with template_write, template_reply, or template_forward
  2. Edit the template (the AI fills in To, Subject, body, etc.)
  3. Send with template_send (requires dangerzone mode) or save as draft with template_save (requires full mode)

MML template format

From: you@example.com
To: recipient@example.com
Subject: Hello

Your message body here.

Excluded Commands

The following himalaya commands are deliberately not exposed through this MCP server for safety reasons. Allowing an AI agent to permanently delete emails or folders carries too high a risk of irreversible data loss.

himalaya command What it does Why it's excluded
folder expunge Permanently removes messages marked for deletion Irreversible bulk deletion
folder purge Deletes ALL messages in a folder Irreversible bulk deletion
folder delete Deletes an entire folder and its contents Irreversible data loss
message delete Permanently deletes a single message Irreversible data loss

If you need these operations, use the himalaya CLI directly.

Security

  • Read-only by default — no write tools are even registered unless HIMALAYA_MODE=full or dangerzone
  • Sending requires dangerzone — email send tools are isolated in their own mode, separate from other write operations
  • Recipient allowlist — in dangerzone mode, APPROVED_RECIPIENTS must be set; emails can only be sent to explicitly approved addresses
  • No destructive operations — delete, purge, and expunge commands are excluded entirely
  • Danger labels — write tools show [DANGER: WRITE], send tools show [DANGERZONE: SENDS EMAIL]
  • No shell injection — all subprocess calls use list arguments, never shell=True
  • Input validation — all parameters are validated before being passed to the CLI
  • Subprocess timeouts — all CLI calls have a 30-second timeout to prevent hangs
  • himalaya handles auth — this server never touches credentials; himalaya manages its own auth via its config

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选