guangxiangdebizi/telegram-mcp
If you are the rightful owner of telegram-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
The Telegram MCP Server is a robust server implementation that integrates Telegram Bot API functionalities using the Model Context Protocol (MCP).
🤖 Telegram MCP Server
A comprehensive Model Context Protocol (MCP) server for seamless Telegram Bot API integration
Empower your AI assistants with full Telegram functionality through a modern, type-safe interface
✨ Features
💬 Core Messaging
|
🏢 Chat Management
|
🚀 Installation
Option 1: NPM Package (Recommended)
# Install the package
npm install @xingyuchen/telegram-mcp
# Or using yarn
yarn add @xingyuchen/telegram-mcp
Option 2: From Source
# Clone the repository
git clone https://github.com/guangxiangdebizi/telegram-mcp.git
cd telegram-mcp
# Install dependencies
npm install
# Build the project
npm run build
📋 Usage
🔧 Setup Your Telegram Bot
First time? You'll need a Telegram Bot Token:
- 💬 Message @BotFather on Telegram
- 🤖 Send
/newbotcommand - 📝 Follow the instructions to create your bot
- 🔑 Copy the bot token provided by BotFather
- ✅ Use this token in the MCP tool calls
🚀 Deployment Options
📡 Option 1: Local Development (Stdio)
Step 1: Start the MCP server
npm start
Step 2: Configure Claude Desktop
{
"mcpServers": {
"telegram-mcp": {
"command": "node",
"args": ["path/to/@xingyuchen/telegram-mcp/build/index.js"]
}
}
}
🌐 Option 2: SSE Deployment (Supergateway)
Step 1: Start the SSE server
npm run sse
Step 2: Configure Claude Desktop with SSE
{
"mcpServers": {
"telegram-mcp": {
"type": "sse",
"url": "http://localhost:3100/sse",
"timeout": 600
}
}
}
🛠️ Available Tools
| 🔧 Tool | 📝 Description | 🎯 Use Case |
|---|---|---|
send_message | Send rich text messages | Basic communication, notifications |
send_photo | Share images with captions | Visual content, screenshots |
send_document | Upload files and documents | File sharing, reports |
send_video | Send video content | Media sharing, tutorials |
forward_message | Forward messages between chats | Content distribution |
delete_message | Remove messages | Content moderation |
get_chat | Retrieve chat information | Analytics, administration |
📤 send_message
📝 Send rich text messages with formatting support
📋 Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
token | string | ✅ | Telegram bot token |
chatId | string|number | ✅ | Chat ID or username |
text | string | ✅ | Message text |
parseMode | string | ❌ | HTML, Markdown, or MarkdownV2 |
disableWebPagePreview | boolean | ❌ | Disable link previews |
disableNotification | boolean | ❌ | Send silently |
replyToMessageId | number | ❌ | Reply to specific message |
🖼️ send_photo
📸 Share images with captions and formatting
📋 Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
token | string | ✅ | Telegram bot token |
chatId | string|number | ✅ | Chat ID or username |
photo | string | ✅ | Photo file path, URL, or file_id |
caption | string | ❌ | Photo caption |
parseMode | string | ❌ | Caption formatting |
disableNotification | boolean | ❌ | Send silently |
replyToMessageId | number | ❌ | Reply to specific message |
📎 send_document
📄 Upload files and documents with custom names
📋 Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
token | string | ✅ | Telegram bot token |
chatId | string|number | ✅ | Chat ID or username |
document | string | ✅ | Document file path, URL, or file_id |
caption | string | ❌ | Document caption |
parseMode | string | ❌ | Caption formatting |
filename | string | ❌ | Custom filename |
disableNotification | boolean | ❌ | Send silently |
replyToMessageId | number | ❌ | Reply to specific message |
🎥 send_video
🎬 Send video content with metadata and streaming
📋 Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
token | string | ✅ | Telegram bot token |
chatId | string|number | ✅ | Chat ID or username |
video | string | ✅ | Video file path, URL, or file_id |
duration | number | ❌ | Video duration in seconds |
width | number | ❌ | Video width |
height | number | ❌ | Video height |
caption | string | ❌ | Video caption |
parseMode | string | ❌ | Caption formatting |
supportsStreaming | boolean | ❌ | Enable streaming |
disableNotification | boolean | ❌ | Send silently |
replyToMessageId | number | ❌ | Reply to specific message |
↗️ forward_message
🔄 Forward messages between different chats
📋 Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
token | string | ✅ | Telegram bot token |
chatId | string|number | ✅ | Destination chat ID |
fromChatId | string|number | ✅ | Source chat ID |
messageId | number | ✅ | Message ID to forward |
disableNotification | boolean | ❌ | Send silently |
🗑️ delete_message
❌ Remove messages from chats
📋 Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
token | string | ✅ | Telegram bot token |
chatId | string|number | ✅ | Chat ID or username |
messageId | number | ✅ | Message ID to delete |
ℹ️ get_chat
📊 Retrieve detailed chat information and permissions
📋 Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
token | string | ✅ | Telegram bot token |
chatId | string|number | ✅ | Chat ID or username |
🔧 Development
📁 Project Structure
📦 telegram-mcp/
├── 📂 src/
│ ├── 📄 index.ts # 🚀 MCP server entry point
│ └── 📂 tools/ # 🛠️ Business tool modules
│ ├── 📄 sendMessage.ts # 💬 Text messaging
│ ├── 📄 sendPhoto.ts # 🖼️ Photo sharing
│ ├── 📄 sendDocument.ts # 📎 Document upload
│ ├── 📄 sendVideo.ts # 🎥 Video sharing
│ ├── 📄 getChat.ts # ℹ️ Chat information
│ ├── 📄 forwardMessage.ts # ↗️ Message forwarding
│ └── 📄 deleteMessage.ts # 🗑️ Message deletion
├── 📂 examples/
│ ├── 📄 claude-config.json # ⚙️ Claude configuration
│ └── 📄 usage-examples.md # 💡 Usage examples
├── 📄 package.json
├── 📄 tsconfig.json
└── 📄 README.md
🔨 Adding New Tools
- Create a new tool file in
src/tools/ - Follow the existing tool pattern:
export const yourTool = { name: "your_tool_name", description: "Tool description", parameters: { /* JSON Schema */ }, async run(args: any) { /* Implementation */ } }; - Import and register in
src/index.ts - Add to both
ListToolsRequestSchemaandCallToolRequestSchemahandlers
🚀 Development Scripts
| Command | Description | Usage |
|---|---|---|
npm run build | 🔨 Compile TypeScript | Production builds |
npm run dev | 👀 Watch mode | Development |
npm start | 🚀 Start MCP server | Stdio mode |
npm run sse | 🌐 Start SSE server | Port 3100 |
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
🗺️ Roadmap
See for the complete feature roadmap and implementation priorities.
📄 License
Apache License 2.0
See file for details.