JMAP MCP
A Model Context Protocol (MCP) server that provides tools for interacting with JMAP (JSON Meta Application Protocol) email servers. Built with Deno and using the jmap-jam client library.
README
JMAP MCP Server
A Model Context Protocol (MCP) server that provides tools for interacting with JMAP (JSON Meta Application Protocol) email servers. Built with Deno and using the @htunnicliff/jmap-jam client library.
Features
Email Management Tools
- Search Emails: Search emails with text queries, sender/recipient filters, date ranges, and keywords
- Get Emails: Retrieve specific emails by ID with full details
- Get Threads: Retrieve email threads (conversation chains)
- Mark Emails: Mark emails as read/unread, flagged/unflagged
- Move Emails: Move emails between mailboxes
- Delete Emails: Delete emails permanently
Mailbox Management
- Get Mailboxes: List all mailboxes/folders with hierarchy support
Email Composition
- Send Email: Compose and send new emails with support for plain text and HTML
- Reply to Email: Reply to existing emails with reply-all support
Key Capabilities
- Full JMAP RFC 8620/8621 compliance via jmap-jam
- Comprehensive input validation with Zod schemas
- Pagination support for all list operations
- Rich error handling and connection management
- Functional programming patterns throughout
- TypeScript support with strong typing
Installation
Prerequisites
- Deno v1.40 or later
- A JMAP-compliant email server (e.g., Cyrus IMAP, Stalwart Mail Server, FastMail)
- Valid JMAP authentication credentials
Setup
Add the following to your agent of choice:
{
"mcpServers": {
"fastmail": {
"type": "stdio",
"command": "deno",
"args": [
"run",
"--allow-net=api.fastmail.com",
"--allow-env=JMAP_SESSION_URL,JMAP_BEARER_TOKEN,JMAP_ACCOUNT_ID",
"jsr:@wyattjoh/jmap-mcp@0.1.1"
],
"env": {
"JMAP_SESSION_URL": "https://api.fastmail.com/jmap/session",
"JMAP_BEARER_TOKEN": "API_TOKEN"
}
}
}
}
Usage
Environment Variables
| Variable | Required | Description |
|---|---|---|
JMAP_SESSION_URL |
Yes | JMAP server session URL (usually ends with /.well-known/jmap) |
JMAP_BEARER_TOKEN |
Yes | Bearer token for authentication |
JMAP_ACCOUNT_ID |
No | Account ID (auto-detected if not provided) |
Available Tools
search_emails
Search for emails with various filters.
Parameters:
query(optional): Text search queryfrom(optional): Filter by sender email addressto(optional): Filter by recipient email addresssubject(optional): Filter by subject textinMailbox(optional): Search within specific mailboxhasKeyword(optional): Filter by keyword (e.g., '$seen', '$flagged')notKeyword(optional): Exclude by keywordbefore(optional): Only emails before date (ISO datetime)after(optional): Only emails after date (ISO datetime)limit(optional): Max results (1-100, default: 50)position(optional): Starting position for pagination (default: 0)
get_emails
Retrieve specific emails by their IDs.
Parameters:
ids: Array of email IDs (1-50 IDs)properties(optional): Specific properties to return
get_mailboxes
Get list of mailboxes/folders.
Parameters:
parentId(optional): Filter by parent mailboxlimit(optional): Max results (1-200, default: 100)position(optional): Starting position for pagination
get_threads
Get email threads by their IDs.
Parameters:
ids: Array of thread IDs (1-20 IDs)
mark_emails
Mark emails with keywords (read/unread, flagged/unflagged).
Parameters:
ids: Array of email IDs (1-100 IDs)seen(optional): Mark as read (true) or unread (false)flagged(optional): Mark as flagged (true) or unflagged (false)
move_emails
Move emails to a different mailbox.
Parameters:
ids: Array of email IDs (1-100 IDs)mailboxId: Target mailbox ID
delete_emails
Delete emails permanently.
Parameters:
ids: Array of email IDs (1-100 IDs)
send_email
Send a new email.
Parameters:
to: Array of recipients withnameandemailcc(optional): Array of CC recipientsbcc(optional): Array of BCC recipientssubject: Email subjecttextBody(optional): Plain text bodyhtmlBody(optional): HTML bodyidentityId(optional): Identity to send from
reply_to_email
Reply to an existing email.
Parameters:
emailId: ID of email to reply toreplyAll(optional): Reply to all recipients (default: false)subject(optional): Custom reply subjecttextBody(optional): Plain text bodyhtmlBody(optional): HTML bodyidentityId(optional): Identity to send from
JMAP Server Compatibility
This server should work with any JMAP-compliant email server, including:
- Cyrus IMAP 3.0+
- Stalwart Mail Server
- FastMail (commercial)
- Apache James (with JMAP support)
Development
Running in Development
deno run --allow-env --allow-net --watch src/mod.ts
Testing
# Test connection
deno run --allow-env --allow-net src/mod.ts
Architecture
The server is built using:
- Deno: Modern JavaScript/TypeScript runtime
- @modelcontextprotocol/sdk: MCP server framework
- jmap-jam: Lightweight, typed JMAP client
- Zod: Runtime type validation
Security
- All input is validated using Zod schemas
- Environment variables are used for sensitive configuration
- No secrets are logged or exposed in responses
- Follows JMAP security best practices
Contributing
- Fork the repository
- Create a feature branch
- Make changes following the functional programming style
- Test your changes thoroughly
- Submit a pull request
License
MIT License - see LICENSE file for details.
Related Projects
- jmap-jam - JMAP client library
- Model Context Protocol - MCP specification
- JMAP RFC 8620 - JMAP core protocol
- JMAP RFC 8621 - JMAP for Mail
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。