MT

muhammad18557/telegram-mcp

Developer tools

Эта страница переведена автоматически. Технические детали смотрите в оригинале. Открыть оригинал

27 stars 9 forks Качество 58 Тренд 11

С помощью этого вы можете искать свои личные сообщения в Telegram, искать свои контакты и отправлять сообщения отдельным лицам или группам.

Обзор

Это сервер Model Context Protocol (MCP) для Telegram. С помощью этого вы можете искать свои личные сообщения в Telegram, искать свои контакты и отправлять сообщения отдельным лицам или группам. Он подключается к вам напрямую через API Telegram (с помощью библиотеки Telethon). Все ваши сообщения хранятся локально в базе данных SQLite и отправляются только в LLM (например, Claude), когда агент обращается к ним через инструменты (которые вы контролируете). Python 3.6+ - приложение Anthropic Claude Desktop (или Cursor) Создайте виртуальную среду Python и активируйте ее: Установите зависимости Это среда, которая может использоваться как для работы, так и для работы. Зайдите в https://my.telegram.org/auth - Войдите и перейдите в «Инструменты разработки API» - Создайте новое приложение - Заметьте свой идентификатор API и хэш API Перейдите в каталог телеграм-моста:

Обзор (машинный перевод)

Это сервер Model Context Protocol (MCP) для Telegram.

С помощью этого вы можете искать свои личные сообщения в Telegram, искать свои контакты и отправлять сообщения отдельным лицам или группам.

Он подключается к вашему личному аккаунту Telegram напрямую через API Telegram (с помощью библиотеки Telethon). Все ваши сообщения хранятся локально в базе данных SQLite и отправляются только в LLM (например, Claude), когда агент обращается к ним через инструменты (которые вы контролируете).

##Установка

Предпосылки

Python 3.6+ Приложение Anthropic Claude Desktop (или Cursor)

Шаги

1.Клонировать это хранилище

Создайте виртуальную среду Python и активируйте ее:

Установите зависимости:

Это среда, которая может использоваться как для запуска Telegram Bridge, так и для MCP-сервера.

  1. ** Получите учетные данные API Telegram**

Перейти к https://my.telegram.org/auth Войдите и перейдите в «Инструменты разработки API»

  • Создать новое приложение Обратите внимание на свой API ID и хеш API
  1. Беги по мосту Telegram

Перейдите в каталог телеграм-моста:

Настройте свои учетные данные API в качестве переменных среды, экспортируя их:

Или путем создания ".

Эта страница переведена автоматически. Технические детали смотрите в оригинале.

README

Показан фрагмент оригинального README. Открыть оригинал.

Telegram MCP Server

This is a Model Context Protocol (MCP) server for Telegram.

With this you can search your personal Telegram messages, search your contacts, and send messages to either individuals or groups.

It connects to your personal Telegram account directly via the Telegram API (using the Telethon library). All your messages are stored locally in a SQLite database and only sent to an LLM (such as Claude) when the agent accesses them through tools (which you control).

Installation

Prerequisites

  • Python 3.6+
  • Anthropic Claude Desktop app (or Cursor)

Steps

  1. Clone this repository

    git clone https://github.com/Muhammad18557/telegram-mcp.git
    cd telegram-mcp
    

    Create a Python virtual environment and activate it:

    python3 -m venv myenv
    source myenv/bin/activate
    

    Install dependencies:

    pip install -r requirements.txt
    

    This is the environment that can be used both for running the Telegram bridge and the MCP server.

  2. Get your Telegram API credentials

  3. Run the Telegram bridge

    Navigate to the telegram-bridge directory:

    cd telegram-bridge
    

    Set up your API credentials as environment variables either by exporting them:

    export TELEGRAM_API_ID=your_api_id
    export TELEGRAM_API_HASH=your_api_hash
    

    Or by creating a .env file based on the provided .env.example:

    cp .env.example .env
    nano .env  # or use your preferred text editor
    

    Then update the values in the .env file:

    TELEGRAM_API_ID=your_api_id
    TELEGRAM_API_HASH=your_api_hash
    

    Run the Python application:

    python main.py
    

    The first time you run it, you will be prompted to enter your phone number and the verification code sent to your Telegram account.

  4. Connect to the MCP server

    First, update the run_telegram_server.sh script with your absolute repository path:

    # Open the script in your preferred editor
    nano run_telegram_server.sh
    
    # Update line 4 with your absolute path to the repository
    # Change this:
    BASE_DIR="/Users/muhammadabdullah/Desktop/mcp/telegram-mcp"
    # To your actual BASE_DIR path (get it by running `pwd` in the telegram-mcp directory)
    

    Then, configure the MCP server by creating a JSON configuration file with the following format. Use the BASE_DIR from above.

    {
      "mcpServers": {
        "telegram": {
          "command": "/bin/bash",
          "args": [
            "{{BASE_DIR}}/run_telegram_server.sh"
          ]
        }
      }
    }
    
Открыть полный README на GitHub

Установка

This server does not publish a one-line install command.

Open the repository installation guide Новичок в MCP? Начните с руководства на mcpskill.org →

Конфигурация

{ "mcpServers": { "telegram": { "command": "/bin/bash", "args": [ "{{BASE_DIR}}/run_telegram_server.sh" ] } } }