MT

muhammad18557/telegram-mcp

Developer tools

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る

27 stars 9 forks 品質 58 トレンド 11

これにより、個人またはグループにメッセージを検索したり、連絡先を検索したり、メッセージを送信したりできます.

概要

これは、Telegram用のモデルコンテキストプロトコル(MCP)サーバーです。 これにより、個人またはグループにメッセージを検索したり、連絡先を検索したり、メッセージを送信したりできます。 Telegram API経由で直接接続します(Telethonライブラリを使用)。 すべてのメッセージは、SQLiteデータベースにローカルに保存され、エージェントがツール(コントロール)を介してそれらにアクセスしたときにLLM(Claudeなど)にのみ送信されます。 - Python 3.6 + - Anthropic Claudeデスクトップアプリ(またはCursor) Python 仮想環境を作成し、それをアクティブにします: 依存関係をインストールします。 これは、実行と実行の両方に使用できる環境です。 - [https://my.telegram.org/authに移動 - ログインして「API開発ツール」に移動 - 新しいアプリケーションを作成する - API IDとAPIハッシュに注意 Telegram-bridgeディレクトリに移動します

概要(AI 翻訳)

これは、Telegram用のモデルコンテキストプロトコル(MCP)サーバーです。

これにより、個人またはグループにメッセージを検索したり、連絡先を検索したり、メッセージを送信したりできます。

直接テレグラム API 経由で個人テレグラムアカウントに接続します(Telethon ライブラリを使用)。 すべてのメッセージは、SQLiteデータベースにローカルに保存され、エージェントがツール(コントロール)を介してそれらにアクセスしたときにLLM(Claudeなど)にのみ送信されます。

インストール

前提条件

  • Python 3.6 +
  • Anthropic Claudeデスクトップアプリ(またはCursor)

ステップ

1.このリポジトリのクローン

Python 仮想環境を作成し、それをアクティブにします。

依存関係をインストール:

これは、Telegram bridgeとMCPサーバーの実行に使用できる環境です。

2。Telegram APIの資格情報を取得

3。 電報橋を実行

Telegram-bridgeディレクトリに移動します。

それらをエクスポートすることにより、環境変数として API の資格情報を設定します。

または `` を作成することによって.

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。

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"
          ]
        }
      }
    }
    
GitHub で README 全文を見る

インストール

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" ] } } }