telegram-mcp
An MCP server that enables interaction with Telegram to send, read, and search messages across chats and dialogs. It supports waiting for incoming messages and retrieving conversation history through natural language commands.
README
telegram-mcp
A Model Context Protocol (MCP) server for interacting with Telegram using mtcute.
Features
- Send text messages to chats
- Wait for incoming messages in specific chats
- Read messages from chats
- Search messages
- List and get information about dialogs (chats)
- Get recent messages across all chats
Setup
Installation
Option 1: Download Pre-built Binary
Download the latest release for your platform from the releases page:
- macOS (Apple Silicon):
telegram-mcp-darwin-arm64.tar.gz - macOS (Intel):
telegram-mcp-darwin-x64.tar.gz - Linux:
telegram-mcp-linux-x64.tar.gz - Windows:
telegram-mcp-win-x64.exe.zip
Extract the archive and make the binary executable (Unix systems):
tar -xzf telegram-mcp-*.tar.gz
chmod +x telegram-mcp
Option 2: Build from Source
-
Clone the repository and install dependencies:
git clone git@github.com:zhigang1992/telegram-mcp.git cd telegram-mcp bun install -
Build the executable:
bun run build
Initial Setup (First Time Only)
-
Get your Telegram API credentials from https://my.telegram.org
-
Run the initial setup to authenticate with Telegram:
export API_ID=your_api_id export API_HASH=your_api_hash ./telegram-mcpThe server will:
- Prompt you to enter your phone number
- Send you a verification code via Telegram
- Ask for the verification code
- Display the absolute storage path (you'll need this for MCP configuration)
-
Note the storage path displayed in the output. It will look something like:
Storage path: /Users/username/telegram-mcp/bot-data/session
Usage
As an MCP Server
Add to your Claude Desktop config using the storage path from the initial setup:
{
"mcpServers": {
"telegram": {
"command": "/path/to/telegram-mcp",
"env": {
"API_ID": "your_api_id",
"API_HASH": "your_api_hash",
"TELEGRAM_STORAGE_PATH": "/absolute/path/from/initial/setup"
}
}
}
}
Important: The TELEGRAM_STORAGE_PATH must be the absolute path shown during initial setup. This ensures the MCP server uses the authenticated session.
Available Tools
Message Tools
-
messages_sendText- Send a text message to a chatchatId(required): Chat/User ID or usernametext(required): Message text to sendreplyToMessageId: Optional message ID to reply to
-
messages_getHistory- Get message history from a chatchatId(required): Chat/User ID or usernamelimit: Number of messages (default: 100, max: 100)offsetId: Message ID for pagination
-
messages_search- Search for messagesquery(required): Search querychatId: Specific chat to search in (optional)limit: Number of results (default: 50)
-
messages_getRecent- Get recent messages from all chatslimit: Number of chats (default: 10)messagesPerChat: Messages per chat (default: 10)
Interactive Tools
wait_for_reply- Wait for the next message in a chatchatId(required): Chat/User ID or username to wait for a message fromtimeoutSeconds: Timeout in seconds (default: 60, max: 300)
Dialog Tools
-
dialogs_list- List all dialogslimit: Maximum dialogs (default: 50)filter: Filter options (onlyUsers, onlyGroups, onlyChannels)
-
dialogs_getInfo- Get detailed dialog informationchatId(required): Chat/User ID or username
Development
Run in development mode:
bun run dev
The server stores session data in bot-data/ directory.
Recommended Servers
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.
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.
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.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
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.
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.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
Neon Database
MCP server for interacting with Neon Management API and databases
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.
E2B
Using MCP to run code via e2b.