MCP Connector

Integrate Claude with Telegram Channels

MCP server enabling Claude to scrape and search Telegram channels via API (100x faster) or web scraping, with support for private channels and unlimited post

Works with telegram

91
Spark score
out of 100
Updated Jul 2025
Version 1.0.0
Models

Add to Favorites

Why it matters

Connect Claude to Telegram channels and groups for enhanced interaction. Leverage both API access and web scraping for efficient data retrieval and analysis.

Outcomes

What it gets done

01

Authenticate with Telegram API and access private channels.

02

Extract unlimited posts from public and private Telegram channels.

03

Search within Telegram channels using keywords.

04

Scrape public Telegram channels via web scraping.

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/vb-telegram-mcp-server | bash

Capabilities

Tools your agent gets

telegram_api_login

Authenticate with Telegram API for first-time use to enable direct MTProto protocol access.

api_scrape_channel

Extract posts from Telegram channels with unlimited retrieval using direct API access.

api_search_channel

Search within a Telegram channel by keywords using the API.

scrape_channel

Extract posts from public Telegram channels via web scraping with Puppeteer.

telegram_login

Login to access restricted Telegram content via web scraping mode.

Overview

Telegram-mcp-server MCP Server

Telegram-mcp-server is an MCP server that provides dual-mode access to Telegram channels: API mode using MTProto protocol and web scraping mode using Puppeteer. Use API mode for fast, frequent access to channels with search capabilities and metadata extraction; use web scraping mode for quick anonymous access to public channels without API credentials.

What it does

Telegram-mcp-server is an MCP (Model Context Protocol) server that enables interaction with Telegram channels and groups through two operational modes: a high-speed API mode using Telegram's MTProto protocol (100x faster than scraping) and a browser-based web scraping mode using Puppeteer. It provides tools for retrieving channel posts, searching within channels, accessing private channels you're a member of, and obtaining message metadata including views, reactions, and forwards.

When to use - and when NOT to

Use this connector when you need to analyze Telegram channel content, monitor public or private channels you belong to, search historical messages within channels, or extract data from Telegram posts for research or monitoring purposes. API mode is recommended for frequent access, large-scale retrieval (unlimited posts by default), and when you need search functionality or access to private channels. Web scraping mode suits quick, anonymous access to public channels without API setup.

Do NOT use this for scraping private channels you're not a member of, as it respects Telegram's access controls. Avoid web scraping mode for high-volume or frequent operations, as it's significantly slower than API mode.

Inputs and outputs

For API mode, you provide Telegram API credentials (api_id and api_hash from https://my.telegram.org), authenticate via telegram_api_login, then supply channel URLs and optional parameters like max_posts or search queries. For web scraping mode, you provide channel URLs and optionally phone numbers for authentication.

API mode provides complete message metadata including views, reactions, and forwards. Web scraping mode extracts visual media. Both modes retrieve message content from channels.

Integrations

Configured for Claude Desktop by adding to your config file:

{
  "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"
      }
    }
  }
}

Built with GramJS (Telegram client library) for API access and Puppeteer for browser automation. Requires Node.js 18.0.0 or higher and Chrome/Chromium for web scraping mode.

Who it's for

Researchers analyzing Telegram content at scale, developers building Telegram monitoring tools, analysts tracking public discourse across channels, and users needing programmatic access to Telegram data. API mode serves users with Telegram developer credentials who need fast, reliable access and search capabilities. Web scraping mode suits users wanting quick public channel access without API setup. API mode features persistent sessions requiring authentication only once.

Source README

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

API Mode (Recommended) โšก
  • 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

๐Ÿ“‹ 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

FAQ

Common questions

Discussion

Questions & comments ยท 0

Sign In Sign in to leave a comment.