Skip to main content
Glama
Manojbonthu

notifications-mcp

by Manojbonthu

notifications-mcp

Unified Notifications MCP Server — Phase 1: Gmail 모든 AI 에이전트(Claude, LangGraph, GPT)에서 Model Context Protocol을 통해 이메일 알림을 보냅니다.


이 기능의 역할

이 MCP 서버는 mail_send 도구를 제공하며, MCP 호환 AI 에이전트가 Gmail을 통해 이메일을 보내기 위해 호출할 수 있습니다.

사용 사례: 공장 기계가 작동을 멈춤 → AI 모니터링 에이전트가 mail_send 호출 → 관리자, 기술자, 직원 모두 즉시 알림 이메일을 받습니다.

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

MCP endpoint: 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. APIs & Services → Credentials → Create Credentials → OAuth 2.0 Client ID로 이동

  4. Application type: Web application

  5. Add Authorized redirect 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 인증 (최초 1회만)

브라우저를 열고 다음 주소로 이동하세요:

http://localhost:8100/auth/gmail/start
  1. Google 동의 페이지로 리디렉션됩니다.

  2. 이메일을 보내려는 Gmail 계정으로 로그인하세요.

  3. "Send email" 권한을 부여하세요.

  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 — 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

Gmail을 통해 하나 이상의 수신자에게 이메일을 보냅니다.

매개변수

유형

필수

설명

to

list[str]

수신자 이메일 주소 목록

subject

str

이메일 제목

body

str

이메일 본문 (일반 텍스트)

cc

list[str]

참조 수신자

bcc

list[str]

숨은 참조 수신자

성공 시 반환:

{"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

Phase 2 (Teams) 또는 Phase 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)
  1. config.yaml에 추가:

enabled_channels:
  - mail
  - teams       ← add this
channels:
  teams:
    tenant_id: "..."
    client_id: "..."
  1. 완료. server.pyregistry.py는 전혀 변경할 필요가 없습니다.


보안 참고 사항

  • credentials/는 gitignore에 포함되어 있습니다 — Google 자격 증명을 커밋하지 마세요.

  • OAuth 토큰이 자동으로 조용히 갱신됩니다 — 한 번만 동의하면 됩니다.

  • 서버는 localhost에서 실행됩니다 — 기본적으로 인터넷에 노출되지 않습니다.

  • localhost 사용 시 API 키가 필요하지 않습니다.


Phase 1: Gmail ✅ | Phase 2: Teams 🔜 | Phase 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