
Google Mail-MCP-Server
3 years
Works with Finder
1
Github Watches
0
Github Forks
1
Github Stars
gmail-mcp-server
Repositorio oficial: https://github.com/ivanlhz/gmail-mcp-server
Servidor para exponer la API de Gmail mediante el Model Context Protocol (MCP), diseñado para su integración con LLMs y uso en entornos como Claude Desktop.
Descripción
Este proyecto permite exponer la API de Gmail vía MCP, facilitando su integración con LLMs y uso en entornos como Claude Desktop.
Tools MCP disponibles
El servidor expone las siguientes tools MCP para interactuar con Gmail:
Tool | Descripción |
---|---|
get_labels() |
Obtiene todas las etiquetas del usuario Gmail. |
get_label_by_id(label_id) |
Obtiene los datos de una etiqueta específica a partir de su ID. |
create_label(name, bg_color, text_color) |
Crea una nueva etiqueta en Gmail con nombre y colores opcionales. |
update_label(label_id, name, bg_color, text_color) |
Actualiza una etiqueta existente. |
delete_label(label_id) |
Elimina una etiqueta de Gmail a partir de su ID. |
mark_emails_as_read(emails_ids: List[str]) |
Marca como leídos los emails cuyo ID se pase en la lista. |
mark_emails_as_unread(emails_ids: List[str]) |
Marca como no leídos los emails cuyo ID se pase en la lista. |
add_labels(emails_ids: List[str], labels: List[str]) |
Asigna una o varias etiquetas a todos los emails indicados en la lista de IDs. |
get_all_emails_ids_by_query(query: str, max_results: int, next_page_token: str = None) |
Devuelve una lista paginada de IDs de emails según la consulta de Gmail. Usa next_page_token para paginar. |
get_email_detail(email_id: str) |
Devuelve los detalles completos de un email específico por su ID. |
Estructura del proyecto
.
├── src/
│ ├── gmail/ # Lógica de integración con Gmail
│ │ ├── __init__.py
│ │ ├── auth.py # Autenticación y OAuth
│ │ ├── service.py # Lógica de negocio (mensajes, etiquetas)
│ │ └── models/
│ │ └── label_model.py # Modelos de etiquetas de Gmail
│ ├── gmail_mcp_server/
│ │ ├── __init__.py
│ │ └── main.py # Punto de entrada MCP y definición de tools
│ └── gmail_mcp_server.egg-info/ # Info de empaquetado
├── pyproject.toml # Configuración del paquete y dependencias
├── uv.lock # Lockfile de dependencias (usado por uv)
├── README.md # Este archivo
├── LICENSE # Licencia MIT
└── .venv/ # Entorno virtual (no versionar)
Requisitos
- Python 3.11 o superior
- uv (para la gestión de dependencias y entornos)
- build (solo si quieres empaquetar el módulo)
- Claude Desktop (si se va a usar allí)
Instalación de dependencias
- Clona el repositorio:
git clone <URL_DEL_REPOSITORIO> cd gmail-mcp-server
- Instala las dependencias del proyecto con uv:
uv pip install -r uv.lock
Construcción y empaquetado
- (Opcional) Instala la herramienta build:
uv pip install build
- Empaqueta el módulo:
Esto generará archivosuv run -m build
.whl
y.tar.gz
en el directoriodist/
.
Instalación local del paquete
Instala el paquete en tu entorno:
uv pip install dist/gmail_mcp_server-0.1.1-py3-none-any.whl
(Asegúrate de ajustar el nombre del archivo .whl
si cambia la versión.)
Gestión de dependencias con uv
Este proyecto utiliza uv para gestionar las dependencias y los entornos virtuales.
- Instalar todas las dependencias del proyecto:
uv pip install -r uv.lock
- Instalar nuevas dependencias:
uv pip install <paquete> uv pip freeze > uv.lock
Consulta la documentación oficial de uv para más detalles.
Obtener credenciales de Google (GOOGLE_CLIENT_ID y SECRET)
Para que el servidor pueda acceder a la API de Gmail, necesitas crear credenciales OAuth 2.0 en Google Cloud:
- Ve a la Google Cloud Console.
- Crea un nuevo proyecto o selecciona uno existente.
- Ve a "APIs y servicios" > "Biblioteca" y busca "Gmail API". Haz clic en "Habilitar".
- Ve a "APIs y servicios" > "Credenciales" y haz clic en "Crear credenciales" > "ID de cliente de OAuth".
- Selecciona "Aplicación de escritorio" como tipo de aplicación.
- Asigna un nombre y haz clic en "Crear".
- Descarga el archivo JSON, ábrelo y copia los valores de
client_id
yclient_secret
. - Usa estos valores como variables de entorno
GOOGLE_CLIENT_ID
yGOOGLE_CLIENT_SECRET
al lanzar el servidor.
Más información en la guía oficial de Google.
Integración con Claude Desktop y otros clientes MCP
Windows
- El ejecutable se encuentra en:
C:\Users\<usuario>\develop\proyectos\mcp\gmail-mcp-server\.venv\Scripts\gmail-mcp-server.exe
- Puedes ejecutarlo directamente desde esa ruta o añadir
.venv\Scripts\
al PATH para poder usargmail-mcp-server
desde cualquier terminal. -
Si has añadido la carpeta de scripts al PATH (recomendado):
Ahora puedes usar simplemente
gmail-mcp-server
como comando global en cualquier terminal. -
Recomendación para Claude Desktop:
En tu configuración (por ejemplo,
claude.config.json
):- Si NO tienes el PATH configurado:
{ "mcpServers": { "gmail": { "command": "C:\\Users\\<usuario>\\develop\\proyectos\\mcp\\gmail-mcp-server\\.venv\\Scripts\\gmail-mcp-server.exe", "env": { "GOOGLE_CLIENT_ID": "TU_ID", "GOOGLE_CLIENT_SECRET": "TU_SECRET" } } } }
- Si SÍ tienes el PATH configurado:
{ "mcpServers": { "gmail": { "command": "gmail-mcp-server", "env": { "GOOGLE_CLIENT_ID": "TU_ID", "GOOGLE_CLIENT_SECRET": "TU_SECRET" } } } }
- Si NO tienes el PATH configurado:
- Cambia
<usuario>
por tu nombre de usuario de Windows y completa tus credenciales.
Mac/Linux
- El ejecutable se encuentra en:
/ruta/a/tu/proyecto/.venv/bin/gmail-mcp-server
- Puedes ejecutarlo directamente desde esa ruta.
Para agregar el ejecutable al PATH de forma permanente:
- Abre tu archivo de configuración de shell (
~/.bashrc
,~/.zshrc
, etc.). - Añade la línea:
export PATH="/ruta/a/tu/proyecto/.venv/bin:$PATH"
- Guarda el archivo y ejecuta
source ~/.bashrc
osource ~/.zshrc
(según tu shell), o reinicia la terminal.
Ahora podrás usar simplemente gmail-mcp-server
como comando global.
-
Recomendación para Claude Desktop:
- Si NO tienes el PATH configurado:
{ "mcpServers": { "gmail": { "command": "/ruta/a/tu/proyecto/.venv/bin/gmail-mcp-server", "env": { "GOOGLE_CLIENT_ID": "TU_ID", "GOOGLE_CLIENT_SECRET": "TU_SECRET" } } } }
- Si SÍ tienes el PATH configurado:
{ "mcpServers": { "gmail": { "command": "gmail-mcp-server", "env": { "GOOGLE_CLIENT_ID": "TU_ID", "GOOGLE_CLIENT_SECRET": "TU_SECRET" } } } }
- Si NO tienes el PATH configurado:
-
Cambia
/ruta/a/tu/proyecto/
por la ruta real y completa tus credenciales. -
Tras cualquier cambio, reinicia Claude Desktop para que detecte y ejecute el servidor MCP correctamente.
Referencias
- Guía oficial de empaquetado Python
- Documentación pyproject.toml
- Google API Python Client (Gmail)
- google-auth
- dotenv (python-dotenv)
- mcp[cli] (Model Context Protocol CLI)
- Model Context Protocol (MCP)
Comunidad y contribución
- ¿Tienes dudas, sugerencias o encontraste un bug? Abre un issue.
- ¿Quieres contribuir? Haz un fork y envía tu pull request. ¡Las contribuciones son bienvenidas!
- Para cualquier consulta, también puedes abrir una discusión en la pestaña Discussions del repositorio.
相关推荐
🧑🚀 全世界最好的 llm 资料总结(数据处理、模型训练、模型部署、 O1 模型、 MCP 、小语言模型、视觉语言模型) | Zusammenfassung der weltbesten LLM -Ressourcen.
🔥 1Panel bietet eine intuitive Weboberfläche und einen MCP -Server, um Websites, Dateien, Container, Datenbanken und LLMs auf einem Linux -Server zu verwalten.
⛓️Rugele ist ein leichter, leistungsstarker, leistungsstarker, eingebetteter Komponenten-Orchestrierungsregel-Motor-Rahmen für GO.
Ein Plugin-basiertes Gateway, das andere MCPs orchestriert und es Entwicklern ermöglicht, auf IT-Agenten zu bauen.
Erstellen Sie einfach LLM -Tools und -Argarten mit einfachen Bash/JavaScript/Python -Funktionen.
😎简单易用、🧩丰富生态 - 大模型原生即时通信机器人平台 | 适配 qq / 微信(企业微信、个人微信) / 飞书 / 钉钉 / diskord / telegram / slack 等平台 | 支持 Chatgpt 、 Deepseek 、 Diffy 、 Claude 、 Gemini 、 xai 、 ppio 、 、 ulama 、 lm Studio 、阿里云百炼、火山方舟、 siliconflow 、 qwen 、 mondshot 、 chatglm 、 sillytraven 、 mcp 等 llm 的机器人 / agent | LLM-basierte Instant Messaging Bots-Plattform, unterstützt Zwietracht, Telegramm, Wechat, Lark, Dingtalk, QQ, Slack
Reviews

user_kSmy1o0v
As a dedicated user of the gmail-mcp-server by ivanlhz, I can confidently say that this product is a game-changer for managing multiple Gmail accounts efficiently. Its intuitive interface and robust features make email administration seamless and hassle-free. Highly recommended for anyone looking to streamline their email management!

user_CIAMv9gE
As a dedicated user of the gmail-mcp-server, I can attest to its exceptional performance and reliability. Ivanlhz has truly outdone himself with this product. The seamless integration and user-friendly interface make managing emails a breeze. Highly recommended for anyone looking to streamline their email server management!

user_UgLaTHps
I recently started using the gmail-mcp-server by ivanlhz, and it has been a game-changer for managing my email traffic. It's incredibly user-friendly and reliable. The setup process was seamless, and it effectively handles high volumes of emails without any issues. Highly recommend it for anyone in need of a robust email management solution.

user_EAgRpWAK
The gmail-mcp-server by ivanlhz is a phenomenal tool that has significantly improved my email management experience. It's user-friendly and integrates seamlessly with my existing workflow. The setup is straightforward, and its efficiency in handling multiple tasks has saved me countless hours. Highly recommended for anyone looking to streamline their email processes!

user_GCVw0fIP
As a dedicated user of the gmail-mcp-server, I must say it has significantly improved my email management efficiency. Created by ivanlhz, this server integrates seamlessly with my existing systems, providing unparalleled reliability and support. Highly recommend for anyone looking to streamline their email workflow!

user_R4I0AgG5
The gmail-mcp-server by ivanlhz is an outstanding application that significantly enhances the efficiency of managing emails. Its intuitive interface and seamless integration with Gmail make it incredibly user-friendly. I highly recommend it to anyone looking to streamline their email workflow.

user_qkGyGSQE
Gmail-mcp-server created by ivanlhz is an outstanding product for managing multiple Gmail accounts efficiently. Its user-friendly interface and reliable performance make it indispensable for both personal and professional use. Highly recommended for anyone looking to streamline their email workflow!

user_C0yNlhk6
I have been using the gmail-mcp-server by ivanlhz, and I must say it has significantly improved my email management experience. The server is reliable, efficient, and integrates seamlessly with my existing workflows. Highly recommend it for anyone looking for a robust and user-friendly email server solution. Kudos to the developer for creating such a fantastic tool!

user_hEoEafrx
I have been using the gmail-mcp-server by ivanlhz, and it has truly transformed my email management experience. The server is robust, efficient, and integrates seamlessly with my workflow, helping me stay organized and focused. The welcome message and the easy-to-follow start URL made the setup process a breeze. Highly recommend this product for anyone looking to enhance their email productivity!