trackmcp
Back to directory
dryeab

mcp-telegram

View on GitHub

MCP Server for Telegram

252 stars PythonOthers Updated Sep 4, 2026
claudellmmcptelegramaicursortelethonmtprotobottelegram-botanthropicanthropic-claudemodel-context-protocolmodel-context-protocol-server

Documentation

**Connect Large Language Models to Telegram via the Model Context Protocol (MCP).**

Built with Telethon, this server allows AI agents to interact with Telegram, enabling features like sending/editing/deleting messages, searching chats, managing drafts, downloading media, and more using the MTProto.


Table of Contents


๐Ÿš€ Getting Started

Prerequisites

Installation

Install the `mcp-telegram` CLI tool:

bash
uv tool install mcp-telegram

โš™๏ธ Usage

> [!IMPORTANT]

> Please ensure you have read and understood Telegram's ToS before using this tool. Misuse of this tool may result in account restrictions.

The `mcp-telegram` command-line tool is your entry point.

bash
mcp-telegram --help # See all commands

Login

First, authenticate with your Telegram account:

bash
mcp-telegram login

This interactive command will prompt you for:

  • API ID & API Hash: Obtain these from my.telegram.org/apps.
  • Phone Number: Your Telegram-registered phone number (international format, e.g., `+1234567890`).
  • Verification Code: Sent to your Telegram account upon first login.
  • 2FA Password: If you have Two-Factor Authentication enabled.

Your credentials are securely stored in the session file for future use.

> [!WARNING]

> Keep your API credentials private and never share them publicly

> [!NOTE]

> Use `mcp-telegram logout` to logout from current session or `mcp-telegram clear-session` to remove all stored session data.

Connect to the MCP server

To use MCP Telegram with MCP clients like Claude Desktop or Cursor, you'll need to configure the MCP server. The configuration process varies by client and operating system.

For detailed setup instructions, please refer to:

The configuration file should contain:

json
{
  "mcpServers": {
    "mcp-telegram": {
      "command": "mcp-telegram" /* Use full path if client can't find the command (e.g. "/usr/local/bin/mcp-telegram"). See IMPORTANT section below for full path instructions. */,
      "args": ["start"],
      "env": {
        "API_ID": "",
        "API_HASH": ""
      }
    }
  }
}

> [!Note]

> Configuration paths vary by OS and client. For example:

>

> - macOS: `~/Library/Application Support/Claude/` or `~/.cursor/`

> - Windows: `%APPDATA%\Claude\` or `%APPDATA%\Cursor\`

> [!IMPORTANT]

> If your client cannot execute `mcp-telegram` despite it being accessible in the terminal, try using the full path to the executable. You can find this by running `which mcp-telegram` (macOS/Linux) or `where mcp-telegram` (Windows) in your terminal. Replace the `command` value in the configuration with the full path.

After saving the configuration file, restart your application.

๐Ÿงฐ Available Tools

Here's a comprehensive list of tools you can use to interact with Telegram through MCP:

๐Ÿ“จ Messaging Tools

ToolDescription
`send_message`โœ‰๏ธ Send text messages or files to any user, group, or channel
`edit_message`โœ๏ธ Modify content of previously sent messages
`delete_message`๐Ÿ—‘๏ธ Remove one or multiple messages
`get_messages`๐Ÿ“œ Retrieve message history with advanced filtering options

๐Ÿ” Search & Navigation

ToolDescription
`search_dialogs`๐Ÿ”Ž Find users, groups, and channels by name or username
`message_from_link`๐Ÿ”— Access specific messages using Telegram links

๐Ÿ“ Draft Management

ToolDescription
`get_draft`๐Ÿ“‹ View current message draft for any chat
`set_draft`โœ๏ธ Create or clear message drafts

๐Ÿ“‚ Media Handling

ToolDescription
`media_download`๐Ÿ“ธ Download photos, videos, and documents from messages

> [!Note]

> For detailed parameter information and example use cases, run `mcp-telegram tools` in your terminal.

๐Ÿ› ๏ธ Troubleshooting

Database Locked Errors

Running multiple `mcp-telegram` instances using the _same session file_ can cause `database is locked` errors due to Telethon's SQLite session storage. Ensure only one instance uses a session file at a time.

Force-Stopping Existing Processes

If you need to stop potentially stuck processes:

  • macOS / Linux: `pkill -f "mcp-telegram"`
  • Windows: `taskkill /F /IM mcp-telegram.exe /T` (Check Task Manager for the exact process name)

๐Ÿค Contributing

We welcome contributions! If you'd like to help improve MCP Telegram, please feel free to submit issues, feature requests, or pull requests. Your feedback and contributions help make this project better for everyone.

๐Ÿ“ License

This project is licensed under the MIT License - see the LICENSE file for details.


Frequently asked questions

What is mcp-telegram?

mcp-telegram is MCP Server for Telegram

How do I install mcp-telegram?

Open the GitHub repository and follow its README. Most MCP servers are added to your client's MCP config, then called by your agent.

Is mcp-telegram open source?

Yes โ€” it is hosted on GitHub at https://github.com/dryeab/mcp-telegram and has 252 stars.

Related MCP tools

CoplayDevunity-mcp

Unity MCP acts as a bridge between AI assistants and your Unity Editor. Give your LLM tools to manage assets, control scenes, edit scripts, and automate tasks within Unity.

13,915 C#
aiai-integrationmcp+13
IvanMurzakUnity-MCP

AI Skills, MCP Tools, and CLI for Unity Engine. Full AI develop and test loop. Use cli for quick setup. Efficient token usage, advanced tools. Any C# method may be turned into a tool by a single line. Works with Claude Code, Gemini, Copilot, Cursor and any other absolutely for free.

4,137 C#
aiai-integrationgame-development+16
taylorwilsdongoogle_workspace_mcp

Control Gmail, Google Calendar, Docs, Sheets, Slides, Chat, Forms, Tasks, Search & Drive with AI - Comprehensive Google Workspace MCP Server & CLI Tool

3,117 Python
aigmailgoogle-calendar+17
jgravellejcodemunch-mcp

Cut AI token costs 95%+ on code exploration. The leading MCP server for precise, symbol-level GitHub code retrieval via tree-sitter AST. Works with Claude Code, Cursor & any MCP client. 313B+ tokens saved.

2,651 Python
claudeclaude-codeai-coding+17
OpenOSINTOpenOSINT

AI-powered OSINT agent with interactive REPL, MCP server, and CLI. 19 tools. Works with Claude, GPT-4, or local models. For authorized security research only.

1,523 Python
ai-agentanthropicclaude+16
riponcmprojectmem

Open-source coding agent memory. Records issues, attempts, fixes and decisions, then warns your agent before it repeats an approach that already failed. Native MCP server for Claude Code, Cursor, Antigravity and Codex. 100% local, no cloud, no telemetry. MIT.

796 Python
ai-agentsai-memoryai-tools+17

Run your own MCP server? See who uses it and what to fix.

Measure it with TrackMCP