
muhammad18557/telegram-mcp
Developer toolsこのページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る
これにより、個人またはグループにメッセージを検索したり、連絡先を検索したり、メッセージを送信したりできます.
概要
これは、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の資格情報を取得
- [https://my.telegram.org/authに移動します
- ログインして「API開発ツール」に移動
- 新しいアプリケーションを作成する
- API ID と 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
-
Clone this repository
git clone https://github.com/Muhammad18557/telegram-mcp.git cd telegram-mcpCreate a Python virtual environment and activate it:
python3 -m venv myenv source myenv/bin/activateInstall dependencies:
pip install -r requirements.txtThis is the environment that can be used both for running the Telegram bridge and the MCP server.
-
Get your Telegram API credentials
- Go to https://my.telegram.org/auth
- Log in and go to “API development tools”
- Create a new application
- Note your API ID and API hash
-
Run the Telegram bridge
Navigate to the telegram-bridge directory:
cd telegram-bridgeSet up your API credentials as environment variables either by exporting them:
export TELEGRAM_API_ID=your_api_id export TELEGRAM_API_HASH=your_api_hashOr by creating a
.envfile based on the provided.env.example:cp .env.example .env nano .env # or use your preferred text editorThen update the values in the
.envfile:TELEGRAM_API_ID=your_api_id TELEGRAM_API_HASH=your_api_hashRun the Python application:
python main.pyThe first time you run it, you will be prompted to enter your phone number and the verification code sent to your Telegram account.
-
Connect to the MCP server
First, update the
run_telegram_server.shscript 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_DIRfrom above.{ "mcpServers": { "telegram": { "command": "/bin/bash", "args": [ "{{BASE_DIR}}/run_telegram_server.sh" ] } } }
インストール
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"
]
}
}
}