Skip to main content
Glama
Manojbonthu

notifications-mcp

by Manojbonthu

notifications-mcp

統合型 Notifications MCP サーバー — フェーズ 1: Gmail 任意の AI エージェント(Claude、LangGraph、GPT)から Model Context Protocol を介してメールアラートを送信します。


これは何をするのか

この MCP サーバーは、MCP 互換の任意の AI エージェントが Gmail 経由でメールを送信するために呼び出せる mail_send ツールを公開します。

ユースケース: 工場の機械が停止 → AI 監視エージェントが mail_send を呼び出す → マネージャー、技術者、スタッフ全員に即座にアラートメールが届きます。

Machine stops → AI Agent → mail_send tool → Gmail → Manager + Technician notified

MCP エンドポイント: http://localhost:8100/mcp


アーキテクチャ

notifications-mcp/
├── src/
│   ├── server.py          ← Entrypoint (Streamable HTTP + OAuth routes)
│   ├── config.py          ← Loads config.yaml
│   ├── registry.py        ← Dynamically loads channel tools
│   └── channels/
│       ├── mail/          ← Gmail channel (Phase 1)
│       ├── teams/         ← Microsoft Teams (Phase 2 placeholder)
│       └── sms/           ← SMS via Twilio (Phase 3 placeholder)

新しいチャネルを追加するには: channels/<name>/tools.py を作成し、register(mcp, cfg) 関数を含め、config.yamlenabled_channels にチャネル名を追加します。他のファイルは変更しません。


セットアップ

1. 前提条件

  • Python 3.11+

  • Gmail API が有効化された Google Cloud プロジェクト

2. Google Cloud セットアップ

  1. Google Cloud Console にアクセス

  2. プロジェクトで Gmail API を有効化

  3. API とサービス → 認証情報 → 認証情報を作成 → OAuth 2.0 クライアント ID に移動

  4. アプリケーションの種類: ウェブ アプリケーション

  5. 承認済みのリダイレクト URI を追加: http://localhost:8100/auth/gmail/callback

  6. JSON をダウンロード → credentials/google_credentials.json として保存

3. 依存関係のインストール

pip install -r requirements.txt
# or for development:
pip install -e ".[dev]"

4. サーバーの起動

python -m src.server

次のように表示されます:

{"level": "INFO", "message": "Starting notifications-mcp | host=0.0.0.0 | port=8100"}
{"level": "INFO", "message": "MCP endpoint  → http://localhost:8100/mcp"}
{"level": "INFO", "message": "Gmail OAuth   → http://localhost:8100/auth/gmail/start"}

5. Gmail の認証 (初回のみ)

ブラウザで次の URL を開きます:

http://localhost:8100/auth/gmail/start
  1. Google の同意画面にリダイレクトされます

  2. 送信元として使用する Gmail アカウントでログイン

  3. 「メールを送信」権限を許可

  4. ✅ Gmail Authenticated! と表示されたらタブを閉じます

  5. トークンは credentials/gmail_token.json に保存され、以降は自動的にサイレント更新されます


mail_send ツールの使用方法

MCP Inspector から (テスト)

npx @modelcontextprotocol/inspector http://localhost:8100/mcp

mail_send を次のパラメータで呼び出します:

{
  "to": ["manager@yourcompany.com", "technician@yourcompany.com"],
  "subject": "ALERT: Machine #3 stopped",
  "body": "Machine #3 on Floor B stopped at 18:02.\nError code: E-404.\nPlease investigate immediately."
}

AI エージェントから (Claude / LangGraph)

エージェントには次のツール説明が表示されます:

mail_send — 1 人以上の受信者に Gmail 経由でメールを送信します。工場の機械ダウンタイムアラートの場合、機械名、場所、停止時間、エラーコードを含めてください。

エージェントは次のように呼び出します:

result = await client.call_tool("mail_send", {
    "to": ["manager@factory.com", "tech@factory.com"],
    "subject": "ALERT: Machine #3 stopped",
    "body": "Machine #3 stopped at 18:02. Error: E-404. Location: Floor B, Line 2."
})

Antigravity / Claude Desktop から

MCP 設定に追加:

{
  "mcpServers": {
    "notifications": {
      "url": "http://localhost:8100/mcp"
    }
  }
}

ツールリファレンス

mail_send

1 人以上の受信者に Gmail 経由でメールを送信します。

パラメータ

タイプ

必須

説明

to

list[str]

受信者のメールアドレスリスト

subject

str

メールの件名

body

str

メール本文(プレーンテキスト)

cc

list[str]

CC 受信者

bcc

list[str]

BCC 受信者

成功時の戻り値:

{"status": "sent", "message_id": "18b3c...", "recipients": ["manager@co.com"]}

失敗時の戻り値:

{"status": "failed", "error": "rate_limited", "message": "Gmail rate limit hit. Wait 60s."}

設定

config.yaml を編集して設定を変更します:

server:
  host: "0.0.0.0"
  port: 8100          # Change port here

enabled_channels:
  - mail              # Add 'teams' or 'sms' here in Phase 2/3

channels:
  mail:
    credentials_path: "credentials/google_credentials.json"
    token_path: "credentials/gmail_token.json"
    scopes:
      - "https://www.googleapis.com/auth/gmail.send"
    oauth_redirect_uri: "http://localhost:8100/auth/gmail/callback"

テストの実行

pytest tests/ -v

期待される出力:

tests/channels/mail/test_tools.py::test_mail_send_success PASSED
tests/channels/mail/test_tools.py::test_mail_send_not_authenticated PASSED
tests/channels/mail/test_tools.py::test_mail_send_rate_limited PASSED
tests/channels/mail/test_tools.py::test_mail_send_missing_to_field PASSED
tests/channels/mail/test_tools.py::test_mail_send_missing_subject PASSED
tests/channels/mail/test_tools.py::test_mail_send_multiple_recipients PASSED
tests/channels/mail/test_tools.py::test_mail_send_with_cc_bcc PASSED

フェーズ 2 (Teams) またはフェーズ 3 (SMS) の追加

  1. チャネルフォルダを作成:

    src/channels/teams/__init__.py
    src/channels/teams/auth.py
    src/channels/teams/client.py
    src/channels/teams/schemas.py
    src/channels/teams/tools.py   ← must have def register(mcp, cfg)
  2. config.yaml に追加:

    enabled_channels:
      - mail
      - teams       ← add this
    channels:
      teams:
        tenant_id: "..."
        client_id: "..."
  3. 完了。 server.pyregistry.py は変更不要です。


セキュリティに関する注意事項

  • credentials/ は gitignore されています — Google 認証情報をコミットしないでください

  • OAuth トークンは自動的にサイレント更新されます — 同意は 1 回だけです

  • サーバーは localhost で実行されます — デフォルトではインターネットに公開されません

  • localhost での使用に API キーは不要です


フェーズ 1: Gmail ✅ | フェーズ 2: Teams 🔜 | フェーズ 3: SMS 🔜

-
license - not tested
-
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

  • Phone, SMS & email for AI agents — one remote MCP endpoint, OAuth login, zero install.

  • Push notifications for AI agents - send instant iPhone notifications from any MCP client.

  • Read, search, send, organize, draft and schedule email across your inboxes from any MCP client.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Manojbonthu/Custom_MCP_Server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server