telegram-mcp-server

telegram-mcp-server

0

The Telegram MCP Server is a robust integration server for managing Telegram contacts, messages, and channels using the Multi-Client Protocol (MCP). It supports contact management, messaging, and channel operations with features such as chat history retrieval and message sending. Secure handling of credentials and error management are integral to the server's operations.

Telegram MCP Server

A powerful Telegram integration server that provides various tools for managing contacts, sending messages, and retrieving channel information through MCP (Multi-Client Protocol).

Features

  • Contact Management
    • Get list of contacts
    • Search contacts
    • Get last interactions
  • Messaging
    • Send messages to contacts by name or phone number
    • Get chat history with date range filtering
    • View last interactions
  • Channel Features
    • Get posts from channels
    • Search channels
    • View channel information
    • Filter posts by date range

Prerequisites

  • Python 3.8 or higher
  • Node.js 14 or higher
  • Telegram API credentials
  • A Telegram account

Installation

  1. Clone the repository
  2. Install required dependencies
  3. Get Telegram API ID and API Hash
  4. Create a .env file with Telegram credentials
  5. Authenticate Telegram

Tool Documentation

  • get_contacts()
  • send_message_by_identifier(identifier, message)
  • get_last_interaction(identifier)
  • get_chat_history(identifier, start_date=None, end_date=None, limit=20)
  • get_channel_posts(channel_name, start_date=None, end_date=None, limit=20)

Error Handling

Comprehensive error handling for invalid credentials, network issues, rate limiting, invalid parameters, and permission errors.

Security Considerations

Store API credentials securely, use environment variables, implement rate limiting, monitor usage, and logging.

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit changes
  4. Push to the branch
  5. Create a Pull Request

License

Licensed under MIT.