@xingyuchen/telegram-mcp
v1.0.0
Published
A Model Context Protocol (MCP) server for Telegram Bot API integration
Maintainers
Readme
Telegram MCP Server
A Model Context Protocol (MCP) server that provides comprehensive Telegram Bot API integration. This server enables AI assistants to interact with Telegram through a standardized interface.
Features
Core Messaging
- Send Messages - Send text messages with formatting support
- Send Photos - Share images with captions
- Send Documents - Upload and share files
- Send Videos - Share video content with metadata
- Forward Messages - Forward messages between chats
- Delete Messages - Remove messages from chats
Chat Management
- Get Chat Info - Retrieve detailed chat information and permissions
Installation
- Clone the repository:
git clone <repository-url>
cd telegram-mcp- Install dependencies:
npm install- Build the project:
npm run buildUsage
Local Development (Stdio)
- Start the MCP server:
npm start- Configure your Claude Desktop with the following MCP server configuration:
{
"mcpServers": {
"telegram-mcp": {
"command": "node",
"args": ["path/to/telegram-mcp/build/index.js"]
}
}
}SSE Deployment (Supergateway)
- Start the SSE server:
npm run sse- Configure your Claude Desktop with SSE configuration:
{
"mcpServers": {
"telegram-mcp": {
"type": "sse",
"url": "http://localhost:3100/sse",
"timeout": 600
}
}
}Available Tools
send_message
Send a text message to a Telegram chat.
Parameters:
token(string, required) - Telegram bot tokenchatId(string|number, required) - Chat ID or usernametext(string, required) - Message textparseMode(string, optional) - HTML, Markdown, or MarkdownV2disableWebPagePreview(boolean, optional) - Disable link previewsdisableNotification(boolean, optional) - Send silentlyreplyToMessageId(number, optional) - Reply to specific message
send_photo
Send a photo to a Telegram chat.
Parameters:
token(string, required) - Telegram bot tokenchatId(string|number, required) - Chat ID or usernamephoto(string, required) - Photo file path, URL, or file_idcaption(string, optional) - Photo captionparseMode(string, optional) - Caption formattingdisableNotification(boolean, optional) - Send silentlyreplyToMessageId(number, optional) - Reply to specific message
send_document
Send a document to a Telegram chat.
Parameters:
token(string, required) - Telegram bot tokenchatId(string|number, required) - Chat ID or usernamedocument(string, required) - Document file path, URL, or file_idcaption(string, optional) - Document captionparseMode(string, optional) - Caption formattingfilename(string, optional) - Custom filenamedisableNotification(boolean, optional) - Send silentlyreplyToMessageId(number, optional) - Reply to specific message
send_video
Send a video to a Telegram chat.
Parameters:
token(string, required) - Telegram bot tokenchatId(string|number, required) - Chat ID or usernamevideo(string, required) - Video file path, URL, or file_idduration(number, optional) - Video duration in secondswidth(number, optional) - Video widthheight(number, optional) - Video heightcaption(string, optional) - Video captionparseMode(string, optional) - Caption formattingsupportsStreaming(boolean, optional) - Enable streamingdisableNotification(boolean, optional) - Send silentlyreplyToMessageId(number, optional) - Reply to specific message
forward_message
Forward a message from one chat to another.
Parameters:
token(string, required) - Telegram bot tokenchatId(string|number, required) - Destination chat IDfromChatId(string|number, required) - Source chat IDmessageId(number, required) - Message ID to forwarddisableNotification(boolean, optional) - Send silently
delete_message
Delete a message from a Telegram chat.
Parameters:
token(string, required) - Telegram bot tokenchatId(string|number, required) - Chat ID or usernamemessageId(number, required) - Message ID to delete
get_chat
Get information about a Telegram chat.
Parameters:
token(string, required) - Telegram bot tokenchatId(string|number, required) - Chat ID or username
Getting 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
Development
Project Structure
src/
├── index.ts # MCP server entry point
└── tools/ # Business tool modules
├── sendMessage.ts
├── sendPhoto.ts
├── sendDocument.ts
├── sendVideo.ts
├── getChat.ts
├── forwardMessage.ts
└── deleteMessage.tsAdding New Tools
- Create a new tool file in
src/tools/ - Follow the existing tool pattern with name, description, parameters, and run method
- Import and register the tool in
src/index.ts - Add the tool to both the ListToolsRequestSchema and CallToolRequestSchema handlers
Scripts
npm run build- Compile TypeScript to JavaScriptnpm run dev- Watch mode for developmentnpm start- Start the MCP server (stdio mode)npm run sse- Start SSE server on port 3100
License
Apache-2.0
Author
Xingyu Chen
- Email: [email protected]
- LinkedIn: Xingyu Chen
- GitHub: guangxiangdebizi
- NPM: xingyuchen
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Roadmap
See telegram-api-planning.md for the complete feature roadmap and implementation priorities.
