telegram-mcp

guangxiangdebizi/telegram-mcp

3.2

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).

Tools
4
Resources
0
Prompts
0

πŸ€– Telegram MCP Server

npm version License: Apache-2.0 TypeScript Telegram Bot API

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

πŸ“š Documentation β€’ πŸš€ Quick Start β€’ πŸ› οΈ API Reference β€’


✨ Features

πŸ’¬ Core Messaging

  • πŸ“ Rich Text Messages - HTML, Markdown & MarkdownV2 support
  • πŸ–ΌοΈ Photo Sharing - Images with captions and formatting
  • πŸ“Ž Document Upload - Files with custom names and descriptions
  • πŸŽ₯ Video Content - Videos with metadata and streaming support
  • ↗️ Message Forwarding - Cross-chat message forwarding
  • πŸ—‘οΈ Message Management - Delete and manage messages

🏒 Chat Management

  • ℹ️ Chat Information - Detailed chat data and permissions
  • πŸ‘₯ User Management - Member info and administration
  • πŸ”’ Permission Control - Fine-grained access control
  • πŸ“Š Analytics Ready - Comprehensive data extraction

πŸš€ 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:

  1. πŸ’¬ Message @BotFather on Telegram
  2. πŸ€– Send /newbot command
  3. πŸ“ Follow the instructions to create your bot
  4. πŸ”‘ Copy the bot token provided by BotFather
  5. βœ… 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_messageSend rich text messagesBasic communication, notifications
send_photoShare images with captionsVisual content, screenshots
send_documentUpload files and documentsFile sharing, reports
send_videoSend video contentMedia sharing, tutorials
forward_messageForward messages between chatsContent distribution
delete_messageRemove messagesContent moderation
get_chatRetrieve chat informationAnalytics, administration

πŸ“€ send_message

πŸ“ Send rich text messages with formatting support

πŸ“‹ Parameters
ParameterTypeRequiredDescription
tokenstringβœ…Telegram bot token
chatIdstring|numberβœ…Chat ID or username
textstringβœ…Message text
parseModestring❌HTML, Markdown, or MarkdownV2
disableWebPagePreviewboolean❌Disable link previews
disableNotificationboolean❌Send silently
replyToMessageIdnumber❌Reply to specific message

πŸ–ΌοΈ send_photo

πŸ“Έ Share images with captions and formatting

πŸ“‹ Parameters
ParameterTypeRequiredDescription
tokenstringβœ…Telegram bot token
chatIdstring|numberβœ…Chat ID or username
photostringβœ…Photo file path, URL, or file_id
captionstring❌Photo caption
parseModestring❌Caption formatting
disableNotificationboolean❌Send silently
replyToMessageIdnumber❌Reply to specific message

πŸ“Ž send_document

πŸ“„ Upload files and documents with custom names

πŸ“‹ Parameters
ParameterTypeRequiredDescription
tokenstringβœ…Telegram bot token
chatIdstring|numberβœ…Chat ID or username
documentstringβœ…Document file path, URL, or file_id
captionstring❌Document caption
parseModestring❌Caption formatting
filenamestring❌Custom filename
disableNotificationboolean❌Send silently
replyToMessageIdnumber❌Reply to specific message

πŸŽ₯ send_video

🎬 Send video content with metadata and streaming

πŸ“‹ Parameters
ParameterTypeRequiredDescription
tokenstringβœ…Telegram bot token
chatIdstring|numberβœ…Chat ID or username
videostringβœ…Video file path, URL, or file_id
durationnumber❌Video duration in seconds
widthnumber❌Video width
heightnumber❌Video height
captionstring❌Video caption
parseModestring❌Caption formatting
supportsStreamingboolean❌Enable streaming
disableNotificationboolean❌Send silently
replyToMessageIdnumber❌Reply to specific message

↗️ forward_message

πŸ”„ Forward messages between different chats

πŸ“‹ Parameters
ParameterTypeRequiredDescription
tokenstringβœ…Telegram bot token
chatIdstring|numberβœ…Destination chat ID
fromChatIdstring|numberβœ…Source chat ID
messageIdnumberβœ…Message ID to forward
disableNotificationboolean❌Send silently

πŸ—‘οΈ delete_message

❌ Remove messages from chats

πŸ“‹ Parameters
ParameterTypeRequiredDescription
tokenstringβœ…Telegram bot token
chatIdstring|numberβœ…Chat ID or username
messageIdnumberβœ…Message ID to delete

ℹ️ get_chat

πŸ“Š Retrieve detailed chat information and permissions

πŸ“‹ Parameters
ParameterTypeRequiredDescription
tokenstringβœ…Telegram bot token
chatIdstring|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

  1. Create a new tool file in src/tools/
  2. Follow the existing tool pattern:
    export const yourTool = {
      name: "your_tool_name",
      description: "Tool description",
      parameters: { /* JSON Schema */ },
      async run(args: any) { /* Implementation */ }
    };
    
  3. Import and register in src/index.ts
  4. Add to both ListToolsRequestSchema and CallToolRequestSchema handlers

πŸš€ Development Scripts

CommandDescriptionUsage
npm run buildπŸ”¨ Compile TypeScriptProduction builds
npm run devπŸ‘€ Watch modeDevelopment
npm startπŸš€ Start MCP serverStdio mode
npm run sse🌐 Start SSE serverPort 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.

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

πŸ—ΊοΈ Roadmap

See for the complete feature roadmap and implementation priorities.


πŸ“„ License

Apache License 2.0

See file for details.


πŸ‘€ Author

Xingyu Chen

Email GitHub LinkedIn NPM


⭐ Star this repo if you find it helpful! ⭐