LM

linuxrrze/mcp-mail-oauth

Developer tools

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る

0 stars 0 forks 品質 55 トレンド 8

AIアシスタントがOAuthトークン(XOAUTH2 / OAUTHBEARER)を受け入れるIMAP/SMTPサーバーに読み取り、送信できるようにするMCPサーバー:追加の承認ステップ、保存されたパスワードなし、...

概要

AIアシスタントがOAuthトークン(XOAUTH2 / OAUTHBEARER)を受け入れるIMAP/SMTPサーバーに読み取り、送信できるようにするMCPサーバー : 追加の承認ステップ、保存されたパスワード、サーバー上のパーユーザー状態はありません。 Open WebUI + Keycloak + Dovecot/Postfix 用のビルド。 サーバはメールサーバに存在するクレデンシャルの2つのバリアントをサポートしています。 Open WebUI、Dovecot、Postfixの設定など、他のすべてが同じです。 詳細、決定チャート、およびKeycloakレイアウト: . 1。 ユーザは、KeycloakでWebUIを開くためにログインします。 2. ユーザーのアクセストークンを転送するWebUIのMCPのauthタイプを開きます。 3。 mcp-mail-oauthはそれを検証します(署名、発行者、聴衆mcp-mail、per-toolスコープ)、メールボックス名をメールクレームから取得します。 4。 Dovecot/Postfix にログオンします。 Dovecotは、Keycloak(アクティブ、聴衆のドヴェット、スコープメール)に対するイントロスペクションでチェックします。 2つのKeycloakクライアント:WebUIのオープンとドヴェット。 ステップ1〜3は同じです.

概要(AI 翻訳)

AIアシスタントの読み取りと送信を可能にするMCPサーバー OAuth トークンを受け入れる IMAP/SMTP サーバー (XOAUTH2/) のメール** OAUTHBEARER(OAUTHBEARER)は、ユーザの既存のログインを使用する:追加権限なし ステップ、保存されたパスワード、サーバー上のユーザの状態無し。

Open WebUI + Keycloak + Dovecot/Postfix 用のビルド。 サーバは2つをサポートしています メールサーバに存在するクレデンシャルのバリアント。 その他、 開いた WebUI、Dovecot および Postfix の設定は同じです。 詳細、決定チャート、およびKeycloakレイアウト: docs/mail-credential.md.

フォワードトークン(デフォルト、MAIL_TOKEN_EXCHANGE=off])

1。 ユーザは、KeycloakでWebUIを開くためにログインします。 2。 WebUIのMCP authタイプ**「OAuth」を開くと、ユーザーのアクセストークンが転送されます。 3。 mcp-mail-oauthはそれを検証します(署名、発行者、聴衆[mcp-mail])、 per-tool スコープ) および [email クレームからメールボックス名を受け取ります。 4。 同じトークン**でDovecot/Postfixにログインします。 Dovecotでチェック Keycloak(アクティブ、オーディエンスdovecot]])、スコープ[mailに対するイントロスペクション。

2つのKeycloakクライアント:WebUIと[dovecotを開きます。

トークン交換([T6])

ステップ1〜3は同じです.

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。

README

以下は原文 README の抜粋です。原文を見る。

mcp-mail-oauth

An MCP server that lets an AI assistant read and send the signed-in user’s own mail on an IMAP/SMTP server that accepts OAuth tokens (XOAUTH2 / OAUTHBEARER), using the user’s existing login: no extra authorization step, no stored passwords, no per-user state on the server.

Built for Open WebUI + Keycloak + Dovecot/Postfix. The server supports two variants for the credential it presents to the mail server. Everything else, including the Open WebUI, Dovecot and Postfix configuration, is identical. Details, a decision chart and the Keycloak layouts: docs/mail-credential.md.

Forwarded token (default, MAIL_TOKEN_EXCHANGE=off)

sequenceDiagram
    actor U as User
    participant OW as Open WebUI
    participant KC as Keycloak
    participant MCP as mcp-mail-oauth
    participant MS as Dovecot / Postfix

    U->>OW: Log in
    OW->>KC: OIDC login (client openwebui)
    KC-->>OW: Access tokenaud: mcp-mail, dovecotscope: mail, mcp:mail/*

    U->>OW: "Show my newest mails"
    OW->>MCP: MCP tool callAuthorization: Bearer (user's token)
    Note over MCP: Verifies signature, issuer,audience mcp-mail and tool scope.Mailbox = token's email claim
    MCP->>MS: IMAP / SMTP login,XOAUTH2 with the same token
    MS->>KC: Introspect token (as client dovecot)
    KC-->>MS: active, email, scope mail
    MS-->>MCP: Mailbox data
    MCP-->>OW: Tool result
    OW-->>U: Answer

    Note over OW,KC: Before the token expires, Open WebUIrefreshes it with its refresh token
  1. The user logs in to Open WebUI with Keycloak.
  2. Open WebUI’s MCP auth type “OAuth” forwards that user’s access token.
  3. mcp-mail-oauth verifies it (signature, issuer, audience mcp-mail, per-tool scope) and takes the mailbox name from its email claim.
  4. It logs in to Dovecot/Postfix with the same token. Dovecot checks it by introspection against Keycloak (active, audience dovecot, scope mail).

Two Keycloak clients: Open WebUI’s and dovecot.

Token exchange (MAIL_TOKEN_EXCHANGE=on)

sequenceDiagram
    participant OW as Open WebUI
    participant KC as Keycloak
    participant MCP as mcp-mail-oauth
    participant MS as Dovecot / Postfix

    OW->>KC: OIDC login (client openwebui)
    KC-->>OW: Token Aaud: mcp-mail only, no mail scope
    OW->>MCP: Tool call, Bearer token A
    Note over MCP: Same checks as above
    MCP->>KC: RFC 8693 exchange as client mcp-mail:token A for audience dovecot
    KC-->>MCP: Token B (aud dovecot, scope mail),cached until shortly before expiry
    MCP->>MS: IMAP / SMTP login with token B
    MS->>KC: Introspect token B (as client dovecot)
    KC-->>MS: active, email, scope mail
    MS-->>MCP: Mailbox data
    MCP-->>OW: Tool result

Steps 1 to 3 are the same. In step 4 the server presents a separate token that Keycloak issued to it for the mail server. Token A alone is refused by

GitHub で README 全文を見る

インストール

This server does not publish a one-line install command.

Open the repository installation guide MCP 初心者?mcpskill.org のガイドから始めましょう →