Gmail MCP Server

by Samarth2001
MIT License
  • Apple
  • Linux

Integrations

  • Enables complete email management through Gmail, including sending emails with attachments, reading and searching emails, managing labels and organization, handling drafts, and performing batch operations on multiple emails.

  • Integrates with Google Cloud for authentication and API access, allowing the MCP server to securely connect to Gmail services through OAuth 2.0 credentials.

Gmail MCP 서버

Claude AI가 Gmail과 직접 상호 작용할 수 있도록 하는 강력한 MCP(Model Context Protocol) 서버입니다.

📖 목차

📋 개요

Gmail MCP 서버는 클로드와 같은 AI 비서가 자연어를 통해 Gmail과 직접 상호작용할 수 있도록 하는 포괄적인 구현입니다. 이메일 관리를 위한 다양한 도구를 제공하여 대화형 AI와 받은편지함 간의 원활한 통합을 지원합니다.

💡 주요 특징

  • 완벽한 이메일 관리
    • 첨부 파일이 포함된 일반 텍스트 및 HTML 이메일 보내기
    • 복잡한 메시지 구조를 적절히 분석하여 이메일을 읽습니다.
    • Gmail의 강력한 쿼리 구문으로 받은 편지함을 검색하세요
    • 초안 이메일 만들기 및 업데이트
    • 라벨, 읽음/읽지 않음 상태 및 휴지통 관리
    • 여러 이메일에 대한 일괄 작업 수행
  • 고급 통합
    • async/await 패턴을 적용한 최신 Python 코드베이스
    • 포괄적인 오류 처리 및 복구
    • 자세한 진행 상황 보고
    • 보안 OAuth 인증 흐름
    • 다양한 전송 모드(STDIO 및 SSE)
    • 다양한 배포 시나리오 지원

🚀 빠른 시작

필수 조건

  • Python 3.8 이상
  • Gmail API가 활성화된 Google Cloud 프로젝트
  • Gmail API에 대한 OAuth 2.0 자격 증명

설치

  1. 저장소를 복제합니다지엑스피1
  2. 가상 환경 설정
    python -m venv venv # On Windows venv\Scripts\activate # On macOS/Linux source venv/bin/activate
  3. 종속성 설치
    pip install -r requirements.txt
  4. Google Cloud 및 OAuth 자격 증명 설정Google Cloud Console을 방문하여 다음을 확인하세요.
    • 새 프로젝트를 만듭니다
    • Gmail API 활성화
    • OAuth 동의 화면 설정
    • OAuth 클라이언트 ID 자격 증명 만들기(데스크톱 애플리케이션)
    • 프로젝트 루트에 credentials.json 으로 자격 증명을 다운로드합니다.

첫 번째 실행 및 인증

서버를 한 번 실행하여 인증합니다.

python gmail_server.py

Google 계정으로 인증하라는 브라우저 창이 열립니다. 인증 후 token.json 파일이 생성되어 나중에 사용할 수 있도록 저장됩니다.

Claude Desktop 구성

  1. Claude Desktop 구성 파일을 편집하세요.
    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • Windows: %APPDATA%\Claude\claude_desktop_config.json
  2. 구성에 Gmail MCP 서버를 추가합니다.
    { "mcpServers": { "gmail": { "command": "python", "args": [ "/absolute/path/to/gmail-mcp-server/gmail_server.py" ] } } }
  3. 파일을 저장하고 Claude Desktop을 다시 시작하세요.

참고: "/absolute/path/to/gmail-mcp-server/gmail_server.py" 복제된 저장소의 gmail_server.py 파일에 대한 실제 절대 경로로 바꾸세요.

🧰 사용 가능한 도구

Gmail MCP 서버는 Claude에게 다음 도구를 제공합니다.

이메일 전송

  • send_email - 텍스트/HTML 콘텐츠로 기본 이메일 보내기
  • send_email_with_attachment - 첨부 파일이 있는 이메일 보내기
  • send_email_with_multiple_attachments - 여러 개의 첨부 파일이 포함된 이메일 보내기

이메일 읽기

  • read_email - ID로 특정 이메일의 내용을 읽습니다.
  • get_unread_emails - 읽지 않은 이메일 목록 가져오기
  • get_important_emails - 이메일을 중요한 것으로 표시
  • get_emails_with_attachments - 첨부 파일이 있는 이메일 받기
  • get_recent_emails - 지난 X일간의 이메일 가져오기

이메일 검색 및 구성

  • search_emails - Gmail의 쿼리 구문을 사용하여 이메일 검색
  • get_email_labels - 모든 Gmail 라벨/폴더 나열
  • create_email_label - 새 라벨을 만듭니다
  • delete_email_label - 기존 라벨 삭제
  • label_email - 이메일에 라벨을 적용합니다
  • remove_email_label - 이메일에서 라벨 제거

이메일 상태 관리

  • mark_as_read - 이메일을 읽음으로 표시
  • mark_as_unread - 이메일을 읽지 않음으로 표시
  • delete_email - 이메일을 휴지통으로 이동

초안 관리

  • create_email_draft - 새 임시 이메일 만들기
  • update_email_draft - 기존 초안 업데이트
  • list_email_drafts - 사용 가능한 초안 목록
  • send_draft - 기존 초안 보내기

배치 작업

  • batch_apply_label - 여러 이메일에 라벨을 적용합니다.
  • batch_delete_emails - 여러 이메일을 휴지통으로 이동

계정 정보

  • get_email_profile - Gmail 프로필 정보 가져오기
  • summarize_recent_emails - 최근 이메일 요약을 만듭니다.

💬 사용 예시

클로드에 대한 몇 가지 예시 프롬프트는 다음과 같습니다.

Send an email to john@example.com with the subject "Project Update" and let them know we're still on track for the deadline next week.
Search my inbox for any emails from Bank of America in the last month and summarize them for me.
Find all unread emails from my boss and create a summary of any action items mentioned in them.
Draft an email to the team about the upcoming meeting on Thursday at 2pm. Remind everyone to prepare their weekly updates.

🔧 고급 구성

환경 변수

서버는 사용자 정의를 위해 여러 환경 변수를 지원합니다.

변하기 쉬운설명
GMAIL_TOKEN_PATHOAuth 토큰을 저장하는 사용자 지정 경로
GMAIL_CREDENTIALS_PATHOAuth 자격 증명에 대한 사용자 지정 경로
GOOGLE_CLIENT_IDOAuth 클라이언트 ID(자격 증명 파일의 대안)
GOOGLE_CLIENT_SECRETOAuth 클라이언트 비밀번호(자격 증명 파일의 대안)
MCP_PORTSSE 전송을 위한 포트(기본값: 3000)
DEBUG디버그 모드 활성화( true 또는 false )

SSE 서버 모드

HTTP 기반 통합을 위해 서버는 SSE(Server-Sent Events) 모드로 실행될 수 있습니다.

python gmail_server.py --sse [port]

이렇게 하면 지정된 포트(기본값: 3000)에서 서버가 시작되어 HTTP를 통해 접근할 수 있습니다.

📚 문서

🔒 보안 고려 사항

  • 서버는 안전한 Gmail API 인증을 위해 OAuth 2.0을 사용합니다.
  • 모든 작업은 로컬 컴퓨터에서 실행됩니다. 이메일은 타사 서버를 거치지 않습니다.
  • 인증 토큰은 로컬에 저장되며 언제든지 취소할 수 있습니다.
  • 서버는 첨부 파일을 읽기 위해서만 로컬 파일 액세스가 필요합니다.
  • Claude는 이메일을 보내거나 삭제하기 전에 항상 확인을 요청합니다.

🤝 기여하기

기여를 환영합니다! 풀 리퀘스트를 제출해 주세요.

  1. 저장소를 포크하세요
  2. 기능 브랜치를 생성합니다( git checkout -b feature/amazing-feature )
  3. 변경 사항을 커밋하세요( git commit -m 'Add some amazing feature' )
  4. 브랜치에 푸시( git push origin feature/amazing-feature )
  5. 풀 리퀘스트 열기

📝 라이센스

이 프로젝트는 MIT 라이선스에 따라 라이선스가 부여되었습니다. 자세한 내용은 라이선스 파일을 참조하세요.

🙏 감사의 말

  • Gmail API를 위한 Google
  • Claude와 모델 컨텍스트 프로토콜을 위한 인류학적
  • Python Gmail API 클라이언트 라이브러리에 기여한 사람들

-
security - not tested
A
license - permissive license
-
quality - not tested

Claude AI가 Gmail과 상호 작용하여 자연어 명령을 통해 이메일 전송, 읽기, 검색, 라벨 지정, 초안 관리 및 일괄 작업을 지원할 수 있는 모델 컨텍스트 프로토콜 서버입니다.

  1. 📖 목차
    1. 📋 개요
      1. 💡 주요 특징
    2. 🚀 빠른 시작
      1. 필수 조건
      2. 설치
      3. 첫 번째 실행 및 인증
      4. Claude Desktop 구성
    3. 🧰 사용 가능한 도구
      1. 이메일 전송
      2. 이메일 읽기
      3. 이메일 검색 및 구성
      4. 이메일 상태 관리
      5. 초안 관리
      6. 배치 작업
      7. 계정 정보
    4. 💬 사용 예시
      1. 🔧 고급 구성
        1. 환경 변수
        2. SSE 서버 모드
      2. 📚 문서
        1. 🔒 보안 고려 사항
          1. 🤝 기여하기
            1. 📝 라이센스
              1. 🙏 감사의 말

                Related MCP Servers

                • -
                  security
                  F
                  license
                  -
                  quality
                  A Model Context Protocol server that enables AI assistants to interact with Gmail services, supporting email operations, draft management, and calendar functionality through Google API integration.
                  Last updated -
                  TypeScript
                • -
                  security
                  A
                  license
                  -
                  quality
                  A Model Context Protocol server that provides a seamless email management interface through Claude, allowing users to search, read, and send emails directly through natural language conversations.
                  Last updated -
                  40
                  Python
                  MIT License
                  • Apple
                • -
                  security
                  A
                  license
                  -
                  quality
                  A Model Context Protocol server that enables AI assistants like Claude to interact with Gmail through natural language, providing comprehensive email management capabilities including sending, reading, organizing, searching, and managing drafts and labels.
                  Last updated -
                  Python
                  GPL 3.0
                  • Apple
                • -
                  security
                  F
                  license
                  -
                  quality
                  A Model Context Protocol server that enables AI assistants to access and manage email through IMAP, supporting browsing, searching, reading, and organizing emails while learning user preferences over time.
                  Last updated -
                  2
                  Python
                  • Linux
                  • Apple

                View all related MCP servers

                ID: sc123prv7q