Get the FREE Ultimate OpenClaw Setup Guide →

gmail-telegram

Gmail Telegram MCP Server

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio benitomartin-gmail-telegram-mcp-server uvx run run_bot.py \
  --env OPENAI__MODEL="gpt-4o-mini" \
  --env GOOGLE__SCOPES="'["https://www.googleapis.com/auth/gmail.readonly"]'" \
  --env OPENAI__API_KEY="your_openai_api_key" \
  --env GOOGLE__AUTH_URI="https://accounts.google.com/o/oauth2/auth" \
  --env GOOGLE__CLIENT_ID="your_client_id" \
  --env GOOGLE__TOKEN_URI="https://oauth2.googleapis.com/token" \
  --env GOOGLE__GMAIL_TOKEN="your_gmail_token (generated after first auth)" \
  --env TELEGRAM__BOT_TOKEN="your_bot_token" \
  --env GOOGLE__CLIENT_SECRET="your_client_secret" \
  --env GOOGLE__REDIRECT_URIS="'["http://localhost"]'" \
  --env GOOGLE__APPLICATION_CREDENTIALS="path_to_your_credentials.json"

How to use

This MCP server connects Gmail to Telegram by running a Python-based MCP server that exposes a Telegram bot interface. The bot lets you interact with your Gmail inbox via chat, offering commands to summarize today's emails and to generate smart summaries across timeframes. The server is organized into a Voice Agent, Client, Host (Telegram bot), Server (Gmail logic, prompts, and tools), and Utils for parsing, Gmail auth, logging, and OpenAI integration. To use it, configure the environment variables with your Telegram bot token, Google OAuth credentials, and OpenAI API key. Then start the bot using the MCP runner (uv) so the Telegram bot can receive user messages and fetch Gmail data as needed. The main user-facing capabilities are: /start to begin, /summary_today for a quick text summary of today's messages, /audio_today for an audio summarization, and /summary which uses a smart agent to decide timeframe and format (text, audio, or both).

How to install

Prerequisites:

  • Python 3.12+ installed
  • uv (for environment and package management)
  • Google Cloud project with Gmail API enabled
  • Telegram bot token
  • OpenAI API key

Install steps:

  1. Clone the repository
git clone git@github.com:benitomartin/gmail-telegram-mcp-server.git
cd gmail-telegram-mcp-server
  1. Create and activate a Python virtual environment (via uv):
uv venv
source .venv/bin/activate
  1. Install dependencies and sync groups via uv:
uv sync --all-groups
  1. Create a .env file from the example:
cp env.example .env
  1. Start the MCP server (via uv runner in this project):
uv run run_bot.py
  1. Ensure your Google application credentials are placed as described in the .env file and that all required environment variables are populated.

Additional notes

Environment variables are critical for authentication and API access. Ensure GOOGLE__APPLICATION_CREDENTIALS points to your Google credentials JSON and that GOOGLE__SCOPES includes Gmail read access. After first Gmail authentication, GOOGLE__GMAIL_TOKEN will be created and appended to the .env file for session persistence. If the bot stops unexpectedly, verify network access to Google and Telegram, and check logs under the src/utils and server directories. For updates or upgrades, re-run: uv sync --all-groups. If you plan to run this in Docker or a different runtime, adapt the mcp_config accordingly.

Related MCP Servers

Sponsor this space

Reach thousands of developers