mcp-telegram

mcp-telegram

Enables AI assistants like Claude to read, search, and send messages through your personal Telegram account via MCP tools.

Category
Visit Server

README

mcp-telegram

MCP (Model Context Protocol) server that connects Claude Desktop, Claude Code or Cursor to your personal Telegram account. Ask your AI assistant in plain language:

«Что мне написали за утро? Суммаризируй рабочий чат.» «Найди сообщение, где Иван скидывал адрес офиса.» «Ответь Ивану, что буду в 15:00.»

The assistant picks the right tool, your account does the work.

Tools

Tool What it does
list_chats Recent chats, optionally only ones with unread messages
read_chat Last N messages of a chat (by name, @username or id)
search Full-text search in one chat or across all chats
send_message Send a text message (only when you explicitly ask)

Built on the official MCP Python SDK (FastMCP) and Telethon (MTProto — your real account, not a bot; bots can't read your own chats).

Setup

1. Get Telegram API credentials (2 minutes, one time): go to my.telegram.org → API development tools → create an app → copy api_id and api_hash.

2. Install and log in:

git clone https://github.com/StepanCEO/mcp-telegram
cd mcp-telegram
pip install -r requirements.txt
cp .env.example .env          # put api_id/api_hash there
python -m mcp_telegram.login  # one-time: phone number + code from Telegram

The login creates a session file (~/.mcp-telegram.session); after that the server runs non-interactively.

3. Wire it into your client.

Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "telegram": {
      "command": "python",
      "args": ["-m", "mcp_telegram"],
      "cwd": "C:/path/to/mcp-telegram"
    }
  }
}

Claude Code:

claude mcp add telegram -- python -m mcp_telegram

Cursor (.cursor/mcp.json) — same shape as Claude Desktop.

Restart the client — the telegram tools appear automatically.

Security notes

  • The session file grants full access to your account — it stays on your machine, is never sent anywhere, and is .gitignored. Treat it like a password.
  • send_message is described to the model as "use only when the user explicitly asks", and MCP clients ask for your confirmation before tool calls by default.
  • This is your personal account: respect Telegram's terms — no spam, no mass messaging.

Tests

pip install pytest pytest-asyncio
pytest

Tests run against a fake Telethon client — no network or real account needed. They cover unread filtering, message ordering, search, sending, and chat-id parsing.

Project structure

mcp_telegram/
├── server.py    # MCP tools (FastMCP, stdio transport)
├── service.py   # Telegram operations + formatting (testable core)
├── login.py     # one-time interactive sign-in
└── config.py    # .env settings
tests/
└── test_service.py

License

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured