展示 HN: JMAP MCP – 您的客服邮箱
Show HN: JMAP MCP – Email for your agents

原始链接: https://github.com/wyattjoh/jmap-mcp

## JMAP-MCP:一个 JMAP 邮件交互服务器 JMAP-MCP 是一个基于 Deno 的服务器,提供与 JMAP(JSON Meta Application Protocol)邮件服务器交互的标准化接口。它利用 `@htunnicliff/jmap-jam` 库,使代理能够执行核心邮件操作,例如搜索、检索、发送和管理邮件及邮箱。 **主要特性:** * **全面的 JMAP 支持:** 完全符合 JMAP RFC 8620/8621 标准。 * **核心邮件操作:** 支持使用过滤器搜索邮件、按 ID 获取邮件、管理线程、标记邮件(已读/未读、已标记)、移动/删除邮件、列出邮箱、发送和回复邮件。 * **健壮且安全:** 包含通过 Zod 模式进行输入验证、安全的环境变量处理,并遵循 JMAP 安全最佳实践。 * **代理集成:** 易于使用定义的配置格式与代理集成。 * **分页:** 支持分页,以高效处理大型数据集。 需要一个符合 JMAP 标准的服务器(例如 FastMail、Cyrus IMAP)和有效的身份验证凭据。使用 TypeScript 和函数式编程原则构建。

一位开发者在Hacker News分享了一个新的“Show HN”项目:一个用Deno构建的JMAP MCP服务器,允许AI代理,特别是Claude,通过FastMail等服务提供商访问和管理电子邮件。该项目提供了搜索、阅读和发送电子邮件的工具。 讨论迅速转向JMAP的采用,评论者希望有更广泛的服务提供商支持——Thundermail(基于Stalwart)是一个即将到来的可能性。一个关键的需求是IMAP到JMAP的桥接,以便用户可以继续使用当前的服务提供商。 人们提出了安全问题,特别是关于将电子邮件搜索暴露给AI时可能出现的提示注入漏洞。开发者承认了这一点,并指出该项目目前通过JMAP功能支持只读模式,但最初是为原始数据访问而快速构建的。它目前仅支持基本的邮件和提交声明,缺乏完整的JMAP扩展支持。 许多用户表达了对该项目潜力的兴奋。
相关文章

原文

JSR JSR Score JSR Scope

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.

  • 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
  • Get Mailboxes: List all mailboxes/folders with hierarchy support
  • 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
  • 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
  • Deno v1.40 or later
  • A JMAP-compliant email server (e.g., Cyrus IMAP, Stalwart Mail Server, FastMail)
  • Valid JMAP authentication credentials

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/[email protected]"
      ],
      "env": {
        "JMAP_SESSION_URL": "https://api.fastmail.com/jmap/session",
        "JMAP_BEARER_TOKEN": "API_TOKEN"
      }
    }
  }
}
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)

Search for emails with various filters.

Parameters:

  • query (optional): Text search query
  • from (optional): Filter by sender email address
  • to (optional): Filter by recipient email address
  • subject (optional): Filter by subject text
  • inMailbox (optional): Search within specific mailbox
  • hasKeyword (optional): Filter by keyword (e.g., '$seen', '$flagged')
  • notKeyword (optional): Exclude by keyword
  • before (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)

Retrieve specific emails by their IDs.

Parameters:

  • ids: Array of email IDs (1-50 IDs)
  • properties (optional): Specific properties to return

Get list of mailboxes/folders.

Parameters:

  • parentId (optional): Filter by parent mailbox
  • limit (optional): Max results (1-200, default: 100)
  • position (optional): Starting position for pagination

Get email threads by their IDs.

Parameters:

  • ids: Array of thread IDs (1-20 IDs)

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 to a different mailbox.

Parameters:

  • ids: Array of email IDs (1-100 IDs)
  • mailboxId: Target mailbox ID

Delete emails permanently.

Parameters:

  • ids: Array of email IDs (1-100 IDs)

Send a new email.

Parameters:

  • to: Array of recipients with name and email
  • cc (optional): Array of CC recipients
  • bcc (optional): Array of BCC recipients
  • subject: Email subject
  • textBody (optional): Plain text body
  • htmlBody (optional): HTML body
  • identityId (optional): Identity to send from

Reply to an existing email.

Parameters:

  • emailId: ID of email to reply to
  • replyAll (optional): Reply to all recipients (default: false)
  • subject (optional): Custom reply subject
  • textBody (optional): Plain text body
  • htmlBody (optional): HTML body
  • identityId (optional): Identity to send from

JMAP Server Compatibility

This server should work with any JMAP-compliant email server, including:

deno run --allow-env --allow-net --watch src/mod.ts
# Test connection
deno run --allow-env --allow-net src/mod.ts

The server is built using:

  • 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
  1. Fork the repository
  2. Create a feature branch
  3. Make changes following the functional programming style
  4. Test your changes thoroughly
  5. Submit a pull request

MIT License - see LICENSE file for details.

联系我们 contact @ memedata.com