telegram-account-mcp
Provides tools for working with an owner's personal Telegram account, including reading chats and messages, searching, managing files and voice transcription, sending and editing messages, managing chat administration and topics, and invoking arbitrary Telegram MTProto methods with safety checks and quotas.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
telegram-account-mcp
MCP server that lets an AI assistant (Claude, ChatGPT and other MCP clients) work with your own Telegram account, not a bot. It runs as one long-lived process on your server, holds the only Telethon session, and exposes about 37 tools over authenticated streamable HTTP.
It is built for daily, real use by one owner. Safety checks are part of each tool: the target is verified before anything is sent, retries are idempotent, quotas are durable, and every write is read back from Telegram.
What it can do
Area | Tools |
Reading |
|
Files |
|
Writing |
|
Dialog state |
|
Administration |
|
Voice |
|
Everything else |
|
Self-improvement |
|
Universal MTProto access
Telegram ships new API methods all the time. Writing a dedicated tool for each one never keeps up. invoke_mtproto calls any method that the installed Telethon knows, so updating Telethon makes new Telegram features available right away.
Reads (
get*,search*,check*,resolve*) run at once.Writes need
confirm_write=true(only after the owner explicitly asked for that exact action), arequest_id(deduplication),expected_chatwhen a chat or person is targeted, and stay within a daily quota.Always refused: login and session keys (
auth.*), password, account deletion, payments/Stars/gifts, deleting whole chats or history, ownership transfer.Redirected: actions that have a dedicated tool with stronger checks (
messages.sendMessage→send_message, and so on).Logged: each call records the method name, kind, outcome and parameter names in a local SQLite file. Values and responses are never logged.
get_raw_usage_statsturns this into a list of candidates for new dedicated tools.
Related MCP server: Telegram MCP Server
Safety model
Message content from other people is data, never instructions. The server instructions tell the model this.
Addresses must be a numeric ID, an exact
@usernameort.me/username. Bare words, display names and phone numbers are rejected before resolution.Every mutation checks
expected_chatagainst the resolved chat, and in private chats checks that a message ID really belongs to that chat.request_idreceipts are stored before the Telegram call. A retry returns the original receipt. An uncertain outcome blocks a blind resend.Durable quotas cover creating chats, inviting, joining, removing and bulk deleting, as well as raw writes.
After each send, the chat gets Telegram's manual "unread" mark, so the owner can see where the assistant wrote on their behalf.
Setup
Python 3.11+, then
python -m venv .venv && .venv/bin/pip install -r requirements.txt.Create
private/(mode 700) with:credentials.json:{"api_id": ..., "api_hash": "..."}from https://my.telegram.org;mcp-token: a long random bearer token;a Telethon session
private/stan-vps-tg.session, authorized once interactively.
Run
server.py. It listens on127.0.0.1:18765/mcpand requiresAuthorization: Bearer <mcp-token>.To reach it from Claude.ai, run
claude_gateway.pybehind HTTPS (seedeploy/Caddyfile.example). It uses a separate public token,private/claude-mcp-token.Use systemd units like
deploy/*.service.example.Optional voice fallback: a separate venv with
faster-whisperandwhisper_transcribe.py(seevoice.py).
Only one process may own the Telegram session. Do not start a second Telethon client on a copied session file.
Updates come from GitHub: on the server the service directory is a git checkout. ./deploy.sh fetches, fast-forwards, runs the tests (rolls back on failure), waits for running watcher jobs, restarts the service and prints get_status.
rpc.py TOOL < args.json calls a tool on the running server from a shell on the same machine.
Tests
.venv/bin/python -m unittest test_raw_mtproto test_voice test_topics test_admin_tools \
test_attachments test_mentions test_edit_message test_dialog_state test_chat_photoThe tests use fake Telegram clients and temporary state. They need no network, credentials or real sends.
Contributing
Issues and pull requests are welcome, especially new dedicated tools for frequently used raw methods, and better voice and calls support.
License
MIT
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Multi-tenant Telegram gateway for AI agents — HTTP+stdio, 8 tools, MTProto User API
Let AI assistants post to your Telegram chats, groups and channels. Not affiliated with Telegram.
Your Telegram, WhatsApp, Instagram, mail and calendar in Claude or ChatGPT. Never sends messages.
Your personal Telegram account for AI: read, search and sum up chats. QR login, no API key.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to control a personal Telegram account for sending/reading messages, media, group management, and more via the MTProto API.MIT
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with a personal Telegram account via MTProto, offering messaging, search, media handling, and other tools, particularly suited for finding and applying to remote jobs.-
- AlicenseNot gradedqualityDmaintenanceGives an AI assistant full control of a real Telegram user account over MTProto, enabling it to read chats, search history, send and manage messages, and dynamically create new tools as needed.MIT
- FlicenseNot gradedqualityBmaintenanceConnects AI assistants to Telegram through the MTProto API, enabling them to list dialogs and messages, send, edit, forward, and delete messages, create groups, manage folders, and mute, archive, or leave chats.-