DAVS Gmail MCP Server
📧 Model Context Protocol (MCP) を使用した Gmail AI アシスタント
このプロジェクトは、Model Context Protocol (MCP) を使用して Gmail アカウントと直接対話できるインテリジェントアシスタントを実装します。
ローカル LLM(Ollama)と外部 API(Google Workspace)の安全な統合を実証し、モデルがメールの読み取り、要約、送信に加え、動的テンプレートによる静的リソース(PDF)の利用を可能にし、すべて標準化されたクライアント・サーバーアーキテクチャの下で動作します。
🏗️ システムアーキテクチャ
MCP サーバー(
gmail_mcp_server.py): ツール、静的リソースおよび動的リソース(Resources/Resource Templates)、事前定義されたプロンプトをクライアントに公開します。Google Cloud による OAuth2 認証を処理します。MCP クライアント(
client.py): MCP サーバーに接続し、利用可能な機能を検出して、言語モデル(Llama 3.1)が Function Calling として使用できるように動的にフォーマットします。グラフィカルインターフェース(
app.py): Streamlit で構築された対話型アプリケーションで、会話履歴を管理し、サーバーの応答に応じて動的 UI コンポーネントをレンダリングし、クイックプロンプトの使用を容易にします。セキュリティ: 認証情報の厳格な管理。認証はローカルで実行され、セッショントークンは実行環境内に保持され、外部に漏洩することはありません。
Related MCP server: Gmail Streamable MCP Server
✨ エージェントの機能
ツール:
list_emails(検索とフィルタリング)およびsend_email(作成と送信)。リソース: Gmail ユーザープロフィールへのアクセス。
リソーステンプレート: ローカル PDF マニュアル(例:
docs://setup-manual/{version})からコンテキストを読み取り、LLM コンテキストに直接注入します。プロンプト: 日次要約やプロフェッショナルなメール作成のための事前構築されたフロー。
🚀 インストールと設定
前提条件
Python 3.10+
llama3.1モデルがインストールされた OllamaGoogle Cloud Platform(GCP)アカウント
1. Google 認証情報の設定(必須)
セキュリティ上の理由により、このリポジトリには認証情報は含まれていません。ご自身で生成する必要があります:
Google Cloud Console にアクセスします。
新しいプロジェクトを作成し、Gmail API を有効にします。
OAuth 同意画面を設定します(テストユーザーとして自分のメールアドレスを追加します)。
OAuth クライアント ID(デスクトップアプリケーション)タイプの認証情報を作成します。
JSON ファイルをダウンロードし、
credentials.jsonに名前を変更して、このプロジェクトのルートに配置します。
2. 環境の実行
# Clonar repositorio
git clone [https://github.com/tu-usuario/gmail-mcp-server.git](https://github.com/tu-usuario/gmail-mcp-server.git)
cd gmail-mcp-server
# Crear entorno virtual e instalar dependencias
python -m venv venv
source venv/bin/activate # En Windows: venv\Scripts\activate
pip install -r requirements.txt
# Iniciar la interfaz gráfica
streamlit run app.pyThis server cannot be deployed
Maintenance
Related MCP Connectors
Email infrastructure for AI agents — send, receive, search, and reply to email over MCP.
Remote streamable-HTTP MCP server running on a single Cloudflare Worker. Your assistant gets live Airbnb, Amazon, Booking.com, Google Flights, Maps and Reddit data, social search on X, Instagram and TikTok, the Meta Ad Library, and image/video generation without any keys. Connect your own accounts to let it send WhatsApp or Telegram messages, work an IMAP inbox, manage Meta Ads campaigns and publish to X and LinkedIn. OAuth 2.1 with PKCE; stored credentials are AES-256-GCM encrypted.
MCP server connecting AI agents to 100+ apps (Gmail, Slack, Notion, GitHub) via one-click OAuth.
Let Claude or ChatGPT search, read and send your WhatsApp messages over MCP. OAuth sign-in.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables Gmail access through MCP, allowing LLMs to read, compose, and send emails.10MIT
- AlicenseNot gradedqualityCmaintenanceStreamable HTTP MCP server for Gmail that enables AI agents to search threads, read messages, manage drafts, and organize the inbox via OAuth authentication.181 npm10MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that provides Gmail access for LLMs, enabling email composition, sending, searching, and label management via the Gmail API.MIT
- FlicenseNot gradedqualityDmaintenanceEnables users to access and manage their Gmail and Google Drive data via a Streamlit UI or Claude Desktop, supporting email counts, searches, file listings, and storage queries using OAuth authentication.-