
muhammad18557/telegram-mcp
Developer toolsЭта страница переведена автоматически. Технические детали смотрите в оригинале. Открыть оригинал
С помощью этого вы можете искать свои личные сообщения в 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-сервера.
- ** Получите учетные данные API Telegram**
Перейти к https://my.telegram.org/auth Войдите и перейдите в «Инструменты разработки API»
- Создать новое приложение Обратите внимание на свой API ID и хеш API
- Беги по мосту 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
-
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"
]
}
}
}