TeleMCP
Provides tools for interacting with a Telegram account, enabling AI assistants to manage chats, messages, contacts, groups and channels, media, and profile settings through Telegram's API.
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.
โจ What is TeleMCP?
TeleMCP is a Python-based integration that exposes Telegram account operations as tools for applications that support the Model Context Protocol (MCP). It lets an MCP-compatible AI client work with Telegram chats, messages, contacts, groups, channels, media, and supported profile operations through a configured Telegram account.
TeleMCP runs as a local MCP process and communicates with Telegram over the network. Local execution does not mean that Telegram API requests or account data never leave your device.
Related MCP server: Telegram MCP Server
At a glance
Area | Capabilities |
Chats | Discover conversations, inspect chats, send messages, archive and mute chats |
Messages | Read history, search, reply, forward, edit, delete, and pin messages |
Contacts | Search, add, remove, import, export, block, and unblock contacts |
Groups & channels | Create and manage groups and channels, members, invitations, and permissions |
Media | Send files, voice messages, stickers, and GIFs; inspect and download media |
Profile | Read account information and manage supported profile and privacy settings |
How it works
flowchart LR
A[AI assistant / MCP host] <-->|MCP requests and results| B[TeleMCP server]
B <-->|Telegram API requests| C[Telegram]The MCP host launches TeleMCP as a local process. The assistant discovers the tools exposed by the server, calls the relevant tool, and receives the result from TeleMCP.
๐งฐ Tool showcase
The following tool names are documented for this project. The tools available at runtime depend on the installed code version and its configuration.
get_chatsโ List chats with paginationlist_chatsโ List detailed metadata for users, groups, and channelsget_chatโ Get information about a specific chatget_direct_chat_by_contactโ Find a direct chat for a contactsend_messageโ Send a text messagearchive_chat/unarchive_chatโ Archive or restore a chatmute_chat/unmute_chatโ Manage chat notificationsget_invite_link/export_chat_inviteโ Retrieve or export an invite linkjoin_chat_by_link/import_chat_inviteโ Join using an invite link
get_messages/list_messagesโ Retrieve messagesget_message_contextโ Get context around a messageget_historyโ Retrieve chat history with filterssearch_messagesโ Search messages in a chatreply_to_messageโ Reply to a messageforward_messageโ Forward a messageedit_messageโ Edit a sent messagedelete_messageโ Delete messagespin_message/unpin_messageโ Manage pinned messagesmark_as_readโ Mark messages as readget_pinned_messagesโ List pinned messages
list_contactsโ List account contactssearch_contactsโ Search by name, username, or phoneget_contact_idsโ Resolve contact IDsget_contact_chatsโ Find chats for contactsget_last_interactionโ Get the most recent interaction with a contactadd_contact/delete_contactโ Manage contactsimport_contacts/export_contactsโ Import or export contactsblock_user/unblock_userโ Manage blocked usersget_blocked_usersโ List blocked usersresolve_usernameโ Resolve a Telegram usernamesearch_public_chatsโ Search public chats
create_group/create_channelโ Create a group or channelinvite_to_groupโ Invite membersleave_chatโ Leave a group or channelget_participantsโ List participantsedit_chat_titleโ Change a chat titleedit_chat_photo/delete_chat_photoโ Manage a chat photopromote_admin/demote_adminโ Manage administrator rolesban_user/unban_userโ Manage membership restrictionsget_adminsโ List administratorsget_banned_usersโ List banned usersget_recent_actionsโ View recent administrative actions
send_fileโ Send a document, photo, or videodownload_mediaโ Download media from a messageget_media_infoโ Inspect media metadatasend_voiceโ Send a voice messagesend_stickerโ Send a stickerget_sticker_setsโ List available sticker setsget_gif_searchโ Search for GIFssend_gifโ Send a GIF
get_meโ Get information about the authenticated accountupdate_profileโ Update supported profile fieldsset_profile_photo/delete_profile_photoโ Manage profile photosget_privacy_settings/set_privacy_settingsโ Read or update privacy settingsget_user_photosโ Retrieve a user's profile photosget_user_statusโ Check a user's online statusget_bot_infoโ Get bot informationset_bot_commandsโ Configure bot commands
๐ Installation
Clone the repository
git clone https://github.com/Adarshukumar/telemcp.git
cd telemcpInstall from source
Run this from the project root, where pyproject.toml is located:
python -m pip install -e .Using an editable install means changes made in this checkout are available to the installed Python environment.
๐ Telegram credentials
TeleMCP requires Telegram API credentials. Create a private .env file in your project directory, or provide the same values through your MCP client's environment configuration:
TELEGRAM_API_ID=your_api_id
TELEGRAM_API_HASH=your_api_hash
TELEGRAM_SESSION_NAME=telemcp
# Optional alternative to a session file:
# TELEGRAM_SESSION_STRING=your_session_stringGet your API ID and API hash from Telegram's official API development page. Never commit your API hash, session string, .env file, or .session file.
First-time authentication
Choose one authentication method.
Session string:
python -m telemcp.session_string_generatorAdd the generated value to TELEGRAM_SESSION_STRING in your private environment. Treat it like a password: anyone who obtains it may be able to access the authenticated Telegram session.
Session file:
python -m telemcp.authenticateThis creates a local session file. Keep it private and out of version control.
๐ Connect to an MCP client
Visual Studio Code
Add a server entry to .vscode/mcp.json. This example uses Python to launch the TeleMCP module and prompts for credentials instead of storing real secrets in the repository:
{
"servers": {
"telegram": {
"type": "stdio",
"command": "python",
"args": ["-m", "telemcp"],
"env": {
"TELEGRAM_API_ID": "${input:telegram-api-id}",
"TELEGRAM_API_HASH": "${input:telegram-api-hash}",
"TELEGRAM_SESSION_STRING": "${input:telegram-session-string}",
"MCP_NONINTERACTIVE": "true"
}
}
},
"inputs": [
{
"id": "telegram-api-id",
"type": "promptString",
"description": "Telegram API ID"
},
{
"id": "telegram-api-hash",
"type": "promptString",
"description": "Telegram API hash",
"password": true
},
{
"id": "telegram-session-string",
"type": "promptString",
"description": "Telegram session string",
"password": true
}
]
}The example uses the session-string method. For file-based authentication, replace TELEGRAM_SESSION_STRING with TELEGRAM_SESSION_NAME and use the session name configured on your machine. Keep the session file local.
The Python executable used by the MCP client must be the environment where TeleMCP is installed. MCP client configuration formats differ; adapt the example to the client you use.
โถ๏ธ Run locally
From the project root, start the module with:
python -m telemcp๐ Use from Python
import asyncio
from telemcp import client
async def main() -> None:
await client.start()
try:
me = await client.get_me()
print(f"Connected account: {me.first_name}")
await client.send_message("username", "Hello from TeleMCP!")
finally:
await client.disconnect()
if __name__ == "__main__":
asyncio.run(main())Replace username with the intended Telegram username or chat reference. Use this example only with an account and conversations you are authorized to access.
โ๏ธ Tool configuration
TeleMCP's tool groups are controlled by environment settings in the project configuration. The exact variable names should match the implementation in telemcp/tool_config.py. Check that file in your checkout before adding optional switches to an MCP client configuration; renaming a variable in documentation alone does not change the runtime behavior.
๐ก๏ธ Security notes
Keep
TELEGRAM_API_HASH,TELEGRAM_SESSION_STRING, and session files private.Add
.env,*.session, and local credential files to.gitignorebefore committing.Prefer environment variables or your MCP client's secret/input mechanism over hard-coded credentials.
Enable only the tool groups required for the task, especially administrative tools.
Review Telegram actions before allowing an AI client to send, edit, delete, forward, or administer content.
TeleMCP needs network access to Telegram. Review the account permissions and trust boundary of every MCP client you connect.
๐งช Verification checklist
Before treating a checkout as ready for use, verify it in the environment where you intend to run it:
Install the project in a clean virtual environment.
Generate a session using the chosen authentication method.
Start the MCP server and confirm that the client can discover its tools.
Test read-only operations before enabling message-sending or administrative actions.
Confirm that optional tool-group settings behave as expected.
Confirm that
.envand session files are excluded from Git.
This README describes the documented project interface; the checklist is included so that runtime behavior can be verified against the exact checkout. It is not a claim that these tests have already been run.
๐ค Contributing
Contributions, bug reports, and documentation improvements are welcome. When reporting an issue, include the Python version, MCP client, relevant tool name, and a sanitized error message. Never include API hashes, session strings, phone numbers, or private chat content in an issue.
๐ License and maintenance
This repository retains its existing MIT license. Keep the original copyright and license notice in LICENSE intact when redistributing or modifying the code.
Documentation and ongoing maintenance for this repository are presented under Adarsh Kumar. This maintainer credit does not transfer authorship or ownership of previously published material.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogโฆ
Related MCP Connectors
Telegram bridge for your MCP-compatible agent. Bidirectional, no LLM in our stack.
Hosted Telegram MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Schedule posts, read analytics and manage Telegram channels in TGStudio from any MCP client.
Let AI assistants post to your Telegram chats, groups and channels. Not affiliated with Telegram.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to interact with Telegram accounts through MCP, supporting messaging, contacts, groups, media, and admin functions.4Apache 2.0
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with Telegram accounts, chats, messages, media, and more via MCP, using Telethon.Apache 2.0
- FlicenseBqualityDmaintenanceEnables MCP clients to interact with Telegram user accounts, providing tools for messaging, contacts, groups, channels, and media management through the Telegram API.853-
- AlicenseNot gradedqualityCmaintenanceEnables MCP-compatible clients to interact with a Telegram account programmatically, covering chat and group management, messaging, contacts, profiles, media info, search, stickers, bots, privacy settings, and related operations.Apache 2.0