展示 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: JMAP MCP – 为你的代理提供的邮件 (github.com/wyattjoh) 10 分,wyattjoh 发表于 1 小时前 | 隐藏 | 过去 | 收藏 | 1 条评论 我编写了这个 JMAP MCP 服务器,它为 Claude 添加了邮件管理工具,可以通过 FastMail 和其他 JMAP 提供商搜索、阅读和发送邮件,使用 Deno! struklji 发表于 10 分钟前 [–] 你用 https://github.com/stalwartlabs/stalwart/ 测试过吗?它支持哪些 JMAP 扩展?回复 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请 YC | 联系 搜索:
相关文章

原文

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