Telegram MCP
Provides read-only access to Telegram chats, including listing chats, reading recent messages, and searching within a chat, using your own Telegram account credentials.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Telegram MCPshow me my unread messages from the family group chat"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Telegram MCP — local read-only access for AI agents
The local MCP server gives Codex, Claude, and other MCP clients three tools:
Tool | Purpose |
| List chats and unread counts |
| Latest messages of the selected chat |
| Search text in the selected chat |
The server is read-only. There are no tools for sending, editing, or deleting messages in the code. The server runs locally via STDIO and intentionally does not provide network HTTP/SSE access.
Supported clients
ChatGPT/Codex Desktop;
Codex CLI and IDE extension;
Claude Code;
Claude Desktop;
any local MCP client with STDIO support.
The local server does not work directly in chatgpt.com, claude.ai, on a
phone, or on another computer: these environments cannot run a process on your
machine.
Related MCP server: tdl-mcp
What you'll need
Windows 10/11, macOS, or Linux;
Git;
at least one supported MCP client.
Installation for beginners
1. Open a terminal
macOS:
Command + Space→ typeTerminal→ Enter.Windows: Start menu → type
PowerShell→ open PowerShell.Linux: press
Ctrl + Alt + Tor open the Terminal app.
2. Download the project
macOS/Linux:
git clone https://github.com/iamalexzatcepin/telegram-mcp-template.git ~/telegram-mcp
cd ~/telegram-mcpWindows PowerShell:
git clone https://github.com/iamalexzatcepin/telegram-mcp-template.git "$env:USERPROFILE\telegram-mcp"
cd "$env:USERPROFILE\telegram-mcp"If GitHub reports that the repository is not found, your account does not yet have access to the private repository.
3. Get your Telegram API ID and API Hash
Open my.telegram.org.
Sign in with your phone number.
Open API development tools.
Create an app, e.g.
Local Telegram MCP.Save
api_idandapi_hash.
Do not send api_hash, the login code, or the cloud password to an AI chat.
Create a local .env.
macOS/Linux:
cp .env.example .env
nano .envSaving in Nano: Ctrl + O → Enter → Ctrl + X.
Windows PowerShell:
Copy-Item .env.example .env
notepad .envFill in the file locally:
TELEGRAM_API_ID=ваш_api_id
TELEGRAM_API_HASH=ваш_api_hash4. Install dependencies and sign in to Telegram
macOS/Linux:
bash setup.shWindows PowerShell:
powershell -ExecutionPolicy Bypass -File setup.ps1The script will find Python 3.10+ itself, create .venv, install dependencies,
and ask for your phone number, the code from Telegram, and, if enabled, the
cloud password. Enter them only in your own terminal.
Connecting to an agent
In all examples, use the absolute paths printed by the setup script. The
command is Python inside .venv, the argument is telegram_mcp_server.py.
Codex CLI and ChatGPT/Codex Desktop
macOS/Linux:
codex mcp add telegram -- "$HOME/telegram-mcp/.venv/bin/python" "$HOME/telegram-mcp/telegram_mcp_server.py"
codex mcp get telegramWindows PowerShell:
codex mcp add telegram -- "$env:USERPROFILE\telegram-mcp\.venv\Scripts\python.exe" "$env:USERPROFILE\telegram-mcp\telegram_mcp_server.py"
codex mcp get telegramIn ChatGPT/Codex Desktop you can also open Settings → MCP servers → Add server, select STDIO, and specify the same Command and Arguments. After saving,
click Restart. Local clients of the same Codex host share the
~/.codex/config.toml configuration.
Claude Code
macOS/Linux:
claude mcp add --transport stdio --scope user telegram -- "$HOME/telegram-mcp/.venv/bin/python" "$HOME/telegram-mcp/telegram_mcp_server.py"
claude mcp get telegramWindows PowerShell:
claude mcp add --transport stdio --scope user telegram -- "$env:USERPROFILE\telegram-mcp\.venv\Scripts\python.exe" "$env:USERPROFILE\telegram-mcp\telegram_mcp_server.py"
claude mcp get telegramStart a new Claude Code session and type /mcp. The user scope makes the
server available across different local projects of this user.
Claude Desktop
Open the Developer/MCP settings and add a local STDIO server. If your Claude Desktop version uses a JSON configuration, add the object while keeping the other servers:
{
"mcpServers": {
"telegram": {
"command": "/absolute/path/to/telegram-mcp/.venv/bin/python",
"args": ["/absolute/path/to/telegram-mcp/telegram_mcp_server.py"]
}
}
}Typical file locations:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.json;Windows:
%APPDATA%\Claude\claude_desktop_config.json.
Fully restart Claude Desktop and open a new chat.
Another STDIO MCP client
Use an equivalent configuration:
{
"mcpServers": {
"telegram": {
"command": "/absolute/path/to/.venv/bin/python",
"args": ["/absolute/path/to/telegram_mcp_server.py"]
}
}
}Final check
Ask the agent:
Use telegram
list_chatswith limit=10 and show the name, type, and number of unread messages.
Do not consider the installation complete until the agent has actually returned the list of your chats.
Multiple accounts
The server supports separate local sessions default, work, personal, and
others. Instructions are in docs/MULTI_ACCOUNT.md.
Instructions for AI agents
If Codex, Claude, or another agent is performing the installation, ask it to fully read docs/AGENT_SETUP.md and follow it step by step. This file contains security rules and branches for different OSes.
Security and limitations
.envandsessions/are excluded from Git;the
.sessionfile grants access to the account — do not copy or publish it;media files are not downloaded, only the
has_mediaflag is returned;requests to Telegram are executed on behalf of your account and obey Telegram's limits;
do not run two operations with the same
.sessionat the same time;do not expose this server to the internet.
More: SECURITY.md.
If something doesn't work
Development
.venv/bin/python -m unittest discover -s tests -vProject structure:
File | Purpose |
| Three read-only MCP tools, STDIO only |
| Loading settings and local Telethon sessions |
| Sign in and create a named session |
| Installation on macOS/Linux |
| Installation on Windows |
| Step-by-step protocol for AI agents |
| Connecting multiple accounts |
| Diagnosing common issues |
License
MIT — the project can be used, modified, and distributed with the copyright notice and the license text preserved.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to interact with Telegram accounts through MCP, supporting messaging, contacts, groups, media, and admin functions.4Apache 2.0
- AlicenseAqualityCmaintenanceRead-only Telegram access for Claude and other MCP hosts. Provides tools to list chats, read recent messages, and download media from your own Telegram account without needing an api_id/api_hash.5MIT
- AlicenseNot gradedqualityCmaintenanceA read-only MCP server that lets AI agents read personal Telegram chats from an allowlist of folders, with no send/edit/delete capability.35MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to interact with a user's Telegram account: list chats, read history, search, and send messages through Telegram's MTProto API.1MIT
Related MCP Connectors
Telegram bridge for your MCP-compatible agent. Bidirectional, no LLM in our stack.
Search your AI chat history (ChatGPT, Claude, Codex) from any MCP client. Remote, private, read-only
Read-only Remote MCP for externally grounded AI agent trust receipts.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/iamalexzatcepin/telegram-mcp-template'
If you have feedback or need assistance with the MCP directory API, please join our Discord server