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
π Documentation β’ π Quick Start β’ π οΈ API Reference β’
β¨ 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
/newbot
command - π 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
ListToolsRequestSchema
andCallToolRequestSchema
handlers
π 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.