Telegram MCP Server
Provides tools for sending messages, getting channel info, forwarding messages, pinning messages, and getting channel members; supports AI-powered responses with mention-only mode, rate limiting, and access control.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Telegram MCP Serversend 'Hi there' to @mygroup"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Telegram MCP Server
Overview
An MCP (Model Context Protocol) server for interacting with Telegram bots and channels using the Telegraf library. This server enables AI agents to send messages, manage channels, forward content, and respond intelligently to Telegram conversations.
By implementing the Model Context Protocol (MCP), this server allows Large Language Models (LLMs) to interact with Telegram directly through their context window, bridging the gap between AI and messaging platforms.
Features
Core Tools
SEND_MESSAGE: Send messages to channels or chats with optional topic support
GET_CHANNEL_INFO: Get information about channels/chats
FORWARD_MESSAGE: Forward messages between chats
PIN_MESSAGE: Pin messages in channels
GET_CHANNEL_MEMBERS: Get list of channel administrators
AI Sampling (Enhanced)
Intelligent Responses: AI-powered responses using FastMCP sampling
Mention-Only Mode: Smart filtering - responds when mentioned in groups
Multi-Message Types: Supports text, photos, documents, voice, video, stickers, locations, contacts, polls
Access Control: Configurable user/chat allow/block lists
Rate Limiting: Per-user and per-chat rate limiting
Advanced Configuration: Highly customizable behavior and templates
Installation
Using npx (Recommended)
To use this server without installing it globally:
npx @iqai/mcp-telegramBuild from Source
git clone https://github.com/IQAIcom/mcp-telegram.git
cd mcp-telegram
pnpm install
pnpm run buildRunning with an MCP Client
Add the following configuration to your MCP client settings (e.g., claude_desktop_config.json).
Minimal Configuration
{
"mcpServers": {
"telegram": {
"command": "npx",
"args": ["-y", "@iqai/mcp-telegram"],
"env": {
"TELEGRAM_BOT_TOKEN": "your_bot_token_here"
}
}
}
}Advanced Configuration (Local Build)
{
"mcpServers": {
"telegram": {
"command": "node",
"args": ["/absolute/path/to/mcp-telegram/dist/index.js"],
"env": {
"TELEGRAM_BOT_TOKEN": "your_bot_token_here",
"SAMPLING_ENABLED": "true",
"SAMPLING_MENTION_ONLY": "true"
}
}
}
}Configuration (Environment Variables)
Required
Variable | Required | Description |
| Yes | Your Telegram bot token from @BotFather |
Sampling Configuration
Variable | Default | Description |
|
| Enable/disable AI sampling entirely |
|
| Only respond when mentioned in groups |
|
| Always respond in DMs |
|
| Max tokens per AI response |
|
| Show typing indicator |
|
| Log but don't respond |
Access Control
Variable | Default | Description |
|
| Comma-separated chat IDs/usernames to allow (empty = all) |
|
| Comma-separated chat IDs/usernames to ignore |
|
| Comma-separated user IDs to allow (empty = all) |
|
| Comma-separated user IDs to ignore |
|
| Comma-separated user IDs who can use admin commands |
Rate Limiting
Variable | Default | Description |
|
| Max requests per user per minute |
|
| Max requests per chat per minute |
Message Type Support
Variable | Default | Description |
|
| Enable text messages |
|
| Enable photo messages |
|
| Enable document uploads |
|
| Enable voice messages |
|
| Enable video messages |
|
| Enable sticker messages |
|
| Enable location sharing |
|
| Enable contact sharing |
|
| Enable poll messages |
Content Filtering
Variable | Default | Description |
|
| Minimum message length |
|
| Maximum message length |
|
| Only respond to messages with these keywords |
|
| Ignore messages starting with / |
Usage Examples
Market Discovery
"Send a message to @mychannel saying hello"
"Get information about @telegram channel"
"Forward message 123 from @source to @destination"
Bot Commands
/start: Initialize the bot and get a welcome message/help: Get help information about available features/config: View current configuration (admin users only)
MCP Tools
FORWARD_MESSAGE
Forward a message from one chat to another
Parameter | Type | Required | Description | |
| string | number | Yes | Source chat ID or username |
| string | number | Yes | Destination chat ID or username |
| number | Yes | ID of the message to forward | |
| boolean | Forward message silently |
GET_CHANNEL_INFO
Get information about a Telegram channel or chat
Parameter | Type | Required | Description | |
| string | number | Yes | The channel ID or username (e.g., @channelname or -1001234567890) |
GET_CHANNEL_MEMBERS
Get a list of channel administrators and members
Parameter | Type | Required | Default | Description | |
| string | number | Yes | The channel ID or username | |
| number | 10 | Maximum number of members to retrieve (1-50) |
PIN_MESSAGE
Pin a message in a Telegram chat or channel
Parameter | Type | Required | Description | |
| string | number | Yes | The chat ID or channel username |
| number | Yes | ID of the message to pin | |
| boolean | Pin message silently |
SEND_MESSAGE
Send a message to a Telegram chat or channel
Parameter | Type | Required | Description | |
| string | number | Yes | The chat ID or channel username (e.g., @channelname or -1001234567890) |
| string | Yes | The message text to send | |
| number | The topic ID for forum channels (optional) | ||
| string | Parse mode for Telegram rendering. Use Text for plain text without formatting. |
Development
Build Project
pnpm run buildDevelopment Mode (Watch)
pnpm run watchLinting & Formatting
pnpm run lint
pnpm run formatProject Structure
src/tools/: Individual tool definitionssrc/services/: Telegram service and bot logicsrc/sampling/: AI sampling feature implementationsrc/config.ts: Configuration with Zod validationsrc/index.ts: Server entry point
Getting Your Bot Token
Message @BotFather on Telegram
Use
/newbotcommandFollow the prompts to create your bot
Copy the bot token provided
Set it as an environment variable
Resources
Disclaimer
This project is an unofficial tool. Users should ensure their bot usage complies with Telegram's Terms of Service and Bot API policies.
License
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/IQAIcom/mcp-telegram'
If you have feedback or need assistance with the MCP directory API, please join our Discord server