Telegram MCP Server

Telegram MCP Server

Model Context Protocol server for Telegram. Let AI read, search, send, and forward your Telegram messages.

Category
Visit Server

README

Telegram MCP Server

Model Context Protocol server for Telegram. Let AI read, search, send, and forward your Telegram messages.

Quick Start

# Install dependencies
npm install

# Configure environment
cp .env.example .env
# Edit .env with your Telegram API credentials

# Authenticate (first time only)
npm run auth

# Build and run
npm run build
npm start

What It Does

This MCP server exposes Telegram as a set of tools that any MCP-compatible AI client can use:

Tool Description
telegram_list_chats List all your conversations, groups, and channels
telegram_get_me Get info about the authenticated account
telegram_read_messages Read message history from any chat
telegram_search_messages Search messages across all chats
telegram_send_message Send a message to any chat
telegram_forward_message Forward a message between chats

Prerequisites

  • Node.js 18+
  • Telegram API credentials — Get them at my.telegram.org:
    1. Log in with your phone number
    2. Go to API Development Tools
    3. Create an application
    4. Copy api_id and api_hash

Configuration

Edit .env with your credentials:

API_ID=12345678
API_HASH=your_api_hash_here
SESSION_STRING=

Note: SESSION_STRING is generated automatically when you run npm run auth.

Authentication

First-time setup requires interactive login:

npm run auth

You'll be prompted for:

  1. Phone number (with country code, e.g. +628123456789)
  2. Auth code (sent to your Telegram app)
  3. 2FA password (if enabled)

On success, your session is saved to .env automatically.

Running

Production

npm run build
npm start

Development (with hot reload)

npm run dev

Tool Reference

telegram_list_chats

List all chats (conversations, groups, channels).

Parameters:
  limit (number, optional, default: 100)
    Maximum number of chats to return

telegram_get_me

Get current authenticated user info. No parameters required.

Returns: id, firstName, lastName, username, phone

telegram_read_messages

Read messages from a specific chat.

Parameters:
  chat_id (string, required)
    Chat ID or username (e.g., "@channel", "123456789")

  limit (number, optional, default: 20)
    Number of messages to fetch

  offset_id (number, optional)
    Message ID to start from (for pagination)

telegram_search_messages

Search messages across all your Telegram chats.

Parameters:
  query (string, required)
    Search query

  limit (number, optional, default: 20)
    Maximum number of results

telegram_send_message

Send a message to any chat.

Parameters:
  chat_id (string, required)
    Chat ID or username

  text (string, required)
    Message text to send

telegram_forward_message

Forward a message from one chat to another.

Parameters:
  to_chat_id (string, required)
    Target chat ID or username

  from_chat_id (string, required)
    Source chat ID or username

  message_id (number, required)
    Message ID to forward

Example: Connect to Claude Desktop

Add to your Claude Desktop config (claude_desktop_config.json):

{
  "mcpServers": {
    "telegram": {
      "command": "node",
      "args": ["path/to/telegram-mcp/dist/index.js"]
    }
  }
}

Project Structure

telegram-mcp/
├── src/
│   ├── index.ts              # MCP server entry (stdio transport)
│   ├── auth.ts               # First-time authentication helper
│   ├── telegram-client.ts    # Telegram client wrapper
│   └── tools/
│       ├── index.ts          # Tool registry
│       ├── list.ts           # list_chats, get_me
│       ├── read.ts           # read_messages, search_messages
│       └── send.ts           # send_message, forward_message
├── .env.example              # Environment template
├── package.json
└── tsconfig.json

Tech Stack

Package Purpose
@modelcontextprotocol/sdk MCP protocol implementation
telegram Telegram client (MTProto)
zod Input validation
dotenv Environment configuration

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/my-feature)
  3. Commit your changes (git commit -m 'Add my feature')
  4. Push to the branch (git push origin feature/my-feature)
  5. Open a Pull Request

License

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured