q0t-telegram-mcp
Provides tools to interact with Telegram, including sending messages, listing dialogs, getting account info, and marking messages as read.
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., "@q0t-telegram-mcpsend 'see you at 5' to @alice"
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.
q0t-telegram-mcp
A production-quality Telegram MCP server in Python that actually sends messages.
Why This Exists
The reference Go implementation (@chaindead/telegram-mcp) ships with two bugs that make it silently broken:
tg_sendsaves a draft instead of sending. The implementation callsMessagesSaveDraftinstead ofSendMessage. Messages are stored as unsent drafts — they never arrive at the recipient.Parameter naming inconsistency. The MCP tool advertises a parameter named
to, but the Go struct uses the JSON tagname. The value passed by the caller is silently ignored and the dialog name is never set.
This project fixes both and builds a reliable, well-tested replacement.
Related MCP server: Better Telegram MCP
MCP Tools
Tool | Parameters | Returns | Description |
| — |
| Get current Telegram account info |
|
| List of dialogs — each has | List dialogs (chats, groups, channels) |
|
| List of messages | Get messages from a dialog |
|
|
| Send a message — calls |
|
|
| Mark all messages in a dialog as read |
Identifying a dialog
Three selectors are available for tg_dialog, tg_send, and tg_read. Supply at least one:
Selector | Type | Notes |
| int | Numeric ID from |
| str | Telegram @handle. Leading |
| str | Display name (e.g. |
When more than one selector is supplied, priority is: dialog_id > username > name.
Disambiguation: when to use dialog_id vs name
Use name only as a fallback. Two real problems arise when you rely on it:
Duplicate names. If two contacts are both named "Adilet", name-based resolution scans your dialog list and picks whichever comes first — it may be the wrong person.
Display names are not Telegram handles. Telethon's
get_entity()cannot resolve a human display name like"Алёна 😍"directly. Under the hood this server scans your cached dialog list for an exact match, which is slower and can fail if the dialog is not yet cached.
Recommended workflow:
Call
tg_dialogsto get the list. Each entry includes bothidandusername(when the contact has a public handle).Pass
dialog_id(preferred) orusernametotg_send,tg_dialog, andtg_read.Fall back to
nameonly when neitheridnorusernameis available (e.g. phone-only contacts without a handle).
Prerequisites
Obtain API credentials from https://my.telegram.org/apps:
Variable | Where to get it |
| |
|
Installation & Authentication
No repository clone is needed. Use uvx to run directly from PyPI.
API credentials (TG_APP_ID and TG_API_HASH) can be supplied either as environment variables
or as CLI flags — flags take priority.
First-time authentication
# Via environment variables
TG_APP_ID=your_app_id TG_API_HASH=your_api_hash uvx q0t-telegram-mcp auth --phone +1234567890
# Via CLI flags (no env vars needed)
uvx q0t-telegram-mcp auth --phone +1234567890 --app-id your_app_id --api-hash your_api_hashWith 2FA enabled
# Via environment variables
TG_APP_ID=your_app_id TG_API_HASH=your_api_hash uvx q0t-telegram-mcp auth --phone +1234567890 --password your_2fa_password
# Via CLI flags
uvx q0t-telegram-mcp auth --phone +1234567890 --app-id your_app_id --api-hash your_api_hash --password your_2fa_passwordYou will be prompted to enter the OTP sent to your Telegram app (or SMS). After successful authentication, a session file is saved locally and subsequent connections reuse it automatically.
Session File Location
The session is stored at .telegram-mcp/session.session relative to whichever directory auth was run from. The MCP server must be started from the same directory so it can find the session.
For Claude Code users, add .telegram-mcp/ to .gitignore to avoid committing credentials:
.telegram-mcp/Claude Code Configuration
Add the following to your project's .mcp.json:
{
"mcpServers": {
"telegram": {
"command": "uvx",
"args": ["q0t-telegram-mcp"],
"env": {
"TG_APP_ID": "your_app_id",
"TG_API_HASH": "your_api_hash"
}
}
}
}Claude Code starts the server from your project root, so run auth from the same directory before using the tools.
Publishing to PyPI (Maintainers)
uv build
uv publishThis 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.
Latest Blog Posts
- 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/q0tik/q0t-telegram-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server