Skip to main content
Glama
Telegram MCP Server

Telegram MCP Server

by DLHellMe

Telegram MCP Server

A powerful MCP (Model Context Protocol) server that enables Claude to interact with Telegram channels and groups. This server provides both web scraping and direct API access to Telegram content.

🚀 Features

Version 0.3.0 - Dual Mode Operation

  • 100x faster than web scraping

  • Direct access via Telegram's MTProto protocol

  • Search functionality within channels

  • Access to private channels you're a member of

  • Complete message metadata (views, reactions, forwards)

  • Persistent sessions - authenticate once

  • No browser automation needed

  • Unlimited post retrieval by default

Web Scraping Mode 🌐

  • No API credentials required

  • Browser-based scraping with Puppeteer

  • Authentication support for restricted content

  • Visual media extraction

  • Suitable for quick, anonymous access

Related MCP server: Telegram MCP Server

📋 Prerequisites

  • Node.js 18.0.0 or higher

  • Chrome/Chromium (for web scraping mode)

  • Telegram API credentials (for API mode) - Get them here

🛠️ Installation

  1. Clone this repository:

git clone https://github.com/DLHellMe/telegram-mcp-server.git
cd telegram-mcp-server
  1. Install dependencies:

npm install
  1. Copy the example environment file:

cp .env.example .env
  1. Edit .env and add your configuration:

    • For API mode: Add your TELEGRAM_API_ID and TELEGRAM_API_HASH

    • For web scraping: Default settings work out of the box

  2. Build the project:

npm run build

🔧 Configuration

Getting Telegram API Credentials

  1. Go to https://my.telegram.org

  2. Log in with your phone number

  3. Click "API development tools"

  4. Create a new application

  5. Copy your api_id and api_hash to the .env file

Claude Desktop Configuration

Add this to your Claude Desktop config file:

Windows: %APPDATA%\Claude\claude_desktop_config.json
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "telegram-scraper": {
      "command": "node",
      "args": ["/absolute/path/to/telegram-mcp-server/dist/index.js"],
      "env": {
        "TELEGRAM_API_ID": "your_api_id",
        "TELEGRAM_API_HASH": "your_api_hash"
      }
    }
  }
}

📖 Usage

After configuration, restart Claude Desktop. The Telegram tools will be available in Claude.

API Mode Tools

  1. telegram_api_login - Authenticate with Telegram (first time only)

    Use telegram_api_login to connect to Telegram
  2. api_scrape_channel - Scrape channel posts (unlimited by default)

    Use api_scrape_channel with url="https://t.me/channelname"

    Or with a limit:

    Use api_scrape_channel with url="https://t.me/channelname" and max_posts=50
  3. api_search_channel - Search within a channel

    Use api_search_channel with url="https://t.me/channelname" and query="keyword"

Web Scraping Tools

  1. scrape_channel - Scrape public channels

    Use scrape_channel with url="https://t.me/channelname"
  2. telegram_login - Login for restricted content

    Use telegram_login with phone="+1234567890"

🔒 Data Storage

Session data and cookies are stored in platform-specific directories:

  • Windows: %APPDATA%\telegram-mcp-data

  • macOS: ~/Library/Application Support/telegram-mcp-data

  • Linux: ~/.config/telegram-mcp-data

You can override this with the TELEGRAM_DATA_PATH environment variable.

🛡️ Security Notes

  • Never commit your .env file - it contains sensitive API credentials

  • API credentials are personal - each user needs their own

  • Session files contain authentication data - keep them secure

  • Use the .gitignore file to prevent accidental commits

📝 Development

# Run in development mode
npm run dev

# Build the project
npm run build

# Watch for changes
npm run watch

🤝 Contributing

Contributions are welcome! Please:

  1. Fork the repository

  2. Create a feature branch

  3. Make your changes

  4. Submit a pull request

📄 License

MIT License - see LICENSE file for details

🙏 Acknowledgments

Built with:

⚠️ Disclaimer

This tool is for educational and research purposes. Please respect Telegram's Terms of Service and the privacy of channel members. Always obtain permission before scraping private channels.

🐛 Troubleshooting

API Mode Issues

  • "Not connected to Telegram API": Run telegram_api_login first

  • Phone number format: Include country code (e.g., +1234567890)

  • 2FA errors: Enter your 2FA password when prompted

Web Scraping Issues

  • "No Chrome binary found": Install Chrome or Chromium

  • Login issues: Ensure you're using the correct phone format

  • Timeout errors: Increase BROWSER_TIMEOUT in .env

📞 Support

  • Create an issue on GitHub for bugs

  • Check existing issues before creating new ones

  • Include error messages and logs when reporting issues

Available Tools

15 tools
api_get_channel_infoC

Get detailed information about a Telegram channel using the API

Inputs: url (required).

api_logoutB

Disconnect from Telegram API

Inputs: no named parameters.

api_scrape_channelC

Scrape a Telegram channel using the API (fast and efficient)

Inputs: url (required), max_posts, date_from, date_to.

api_search_channelC

Search for messages within a Telegram channel

Inputs: url (required), query (required), limit.

get_channel_infoA

Get only the channel/group information without scraping posts. Uses authenticated session if logged in.

Inputs: url (required).

scrape_channelB

Scrape a Telegram channel and return posts in markdown format. Uses authenticated session if logged in.

Inputs: url (required), max_posts, include_reactions.

scrape_channel_authenticatedB

Scrape a Telegram channel using authenticated session (can access restricted content)

Inputs: url (required), max_posts.

scrape_channel_fullA

Scrape ALL posts from a Telegram channel and save to file. Uses authenticated session if logged in. Returns file location.

Inputs: url (required), save_to_file.

scrape_date_rangeB

Scrape posts within a specific date range. Uses authenticated session if logged in.

Inputs: url (required), date_from (required), date_to.

scrape_groupB

Scrape a Telegram group and return posts in markdown format. Uses authenticated session if logged in.

Inputs: url (required), max_posts.

scrape_manualA

Manual scraping mode: Opens browser for you to login and navigate to any channel, then scrapes it

Inputs: limit, save_to_file.

telegram_api_loginC

Login to Telegram using API credentials for fast, efficient scraping

Inputs: api_id, api_hash.

telegram_auth_statusB

Check if authenticated with Telegram

Inputs: no named parameters.

telegram_loginC

Authenticate with Telegram Web to access restricted content

Inputs: phone_number.

telegram_logoutB

Clear Telegram authentication cookies

Inputs: no named parameters.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.1/5.0

    Scored across 15 tools

    Disambiguation2/5

    Multiple tools have overlapping purposes that could cause confusion. For example, 'scrape_channel', 'scrape_channel_authenticated', and 'scrape_channel_full' all scrape channels with slight variations in authentication or output format, while 'api_scrape_channel' and 'scrape_channel' seem to do similar things via different methods. The 'get_channel_info' and 'api_get_channel_info' tools also appear redundant, differing mainly in authentication approach.

    Naming Consistency3/5

    The naming is mixed but somewhat readable. There are two main patterns: 'api_' prefix for API-based tools (e.g., 'api_get_channel_info') and no prefix for session-based tools (e.g., 'scrape_channel'), but this is inconsistently applied (e.g., 'telegram_api_login' vs. 'telegram_login'). Verbs like 'scrape', 'get', and 'login' are used repeatedly, but the lack of a uniform structure (e.g., mixing prefixes and suffixes) reduces clarity.

    Tool Count3/5

    With 15 tools, the count is borderline high for a Telegram-focused server, but not excessive. The domain involves channel/group scraping and authentication, which could justify multiple tools, but the overlap suggests redundancy rather than necessity. It feels heavy due to the duplication, but the scope is broad enough to warrant a moderate number of tools.

    Completeness4/5

    The tool set covers core Telegram operations well: authentication (login, logout, status), channel/group info retrieval, and scraping with various modes (e.g., date range, manual, full). However, there are minor gaps, such as no tools for sending messages, managing chats, or handling media beyond scraping, which might limit some agent workflows but are not critical for the scraping-focused purpose.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    • Discord MCP server for ChatGPT, Claude and any AI agent: list servers and channels, read channel messages, search messages, send message, reply to message, send DM, read mentions and assign role in your own Discord account. Cotlet works in the account through your Cloud Browser, a real Chrome where you sign in to Discord yourself; Cotlet does not store your password and you need no Discord API key. About the official Discord API: Yes, Discord has an official API for bots and OAuth2 apps, but it acts as a bot that a server manager adds, not as you, and Discord has no official MCP server for it (checked 5 Nov 2026). The MCP server on Discord's docs site only searches documentation. Setup and FAQ: https://cotlet.dev/integrations/discord-api-mcp-server

      https://cotlet.dev/mcp/v1/discord
    • Skool MCP server for ChatGPT, Claude and any AI agent: list members, approve membership request, create post, reply to comment, send DM, get members, churn and MRR, create calendar event and add course lesson in your own Skool account. Cotlet works in the account through your Cloud Browser, a real Chrome where you sign in to Skool yourself; Cotlet does not store your password and you need no Skool API key. About the official Skool API: Skool has no public API and no developer docs (checked 10 Oct 2026). The only official connection is the Zapier plugin on the Pro plan, which sends new paid members and Membership Questions answers out and can invite a member or unlock a course. Setup and FAQ: https://cotlet.dev/integrations/skool-api-mcp-server

      https://cotlet.dev/mcp/v1/skool
    • Mode Analytics MCP server for ChatGPT, Claude and any AI agent: list reports, run report, read run results, edit query, create schedule, share report to Slack and archive report in your own Mode Analytics account. Cotlet works in the account through your Cloud Browser, a real Chrome where you sign in to Mode Analytics yourself; Cotlet does not store your password and you need no Mode Analytics API key. About the official Mode Analytics API: Mode has a REST API, but only for Workspaces on a paid plan, and it signs in with a token: a Workspace token an Admin creates, or a member token that expires after 90 days once an Admin turns member tokens on; Mode offers no official MCP server (checked 5 Nov 2026). It covers reports, queries, report runs, exports, schedules and subscriptions, and it has no one-off share to Slack or email. Setup and FAQ: https://cotlet.dev/integrations/mode-analytics-api-mcp-server

    • Substack MCP server for ChatGPT, Claude and any AI agent: create post, schedule post, publish Note, reply to Notes, send direct message, moderate comments, list subscribers and get post stats in your own Substack account. Cotlet works in the account through your Cloud Browser, a real Chrome where you sign in to Substack yourself; Cotlet does not store your password and you need no Substack API key. About the official Substack API: Substack has only a limited API (checked 11 Oct 2026). Its Developer API looks up public creator profiles after approval, and there is no public API to write posts or Notes, manage subscribers or send email. Setup and FAQ: https://cotlet.dev/integrations/substack-api-mcp-server

    Related MCP Servers

    • A
      license
      C
      quality
      D
      maintenance
      A bridge allowing Claude Desktop to access Telegram chats and messages via the Model Context Protocol, providing read-only capabilities to retrieve dialogs and messages from Telegram.
      2
      190
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      A Model Context Protocol server that enables AI assistants to interact with Telegram, allowing them to search channels, list available channels, retrieve messages, and filter messages by regex patterns.
      396 npm
      44
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      MCP server that enables Claude Code to interact with a personal Telegram account via MTProto, providing over 120 tools for messaging, media, chat management, and more.
      100
      3
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      A read-only Telegram MCP server that retrieves messages from your DMs, groups, and channels, enabling Claude to generate executive briefings from Telegram conversations.
      MIT