https://github.com/chigwell/telegram-mcp
https://github.com/chigwell/telegram-mcp
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/chigwell/telegram-mcp
- Owner: chigwell
- License: apache-2.0
- Created: 2025-03-20T14:06:35.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2025-03-20T15:49:32.000Z (about 2 months ago)
- Last Synced: 2025-03-20T16:41:55.029Z (about 2 months ago)
- Language: Python
- Size: 6.84 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-mcp-zh - Telegram
- awesome-mcp-servers - Telegram - A Python-based server enabling interaction with Telegram chats via the Model Context Protocol (Table of Contents / Communication)
README

[](https://opensource.org/licenses/Apache-2.0)
[](https://www.linkedin.com/in/eugene-evstafev-716669181/)# Telegram MCP Server
A Telegram MCP (Model Context Protocol) server built using Python, Telethon, and MCP Python SDK. This MCP server provides simple tools for interacting with Telegram chats directly through MCP-compatible hosts, such as Claude for Desktop.
## Tools Provided
- **`get_chats`**: Retrieve a paginated list of your Telegram chats.
- **`get_messages`**: Retrieve paginated messages from a specific chat.
- **`send_message`**: Send a message to a specific chat.## Requirements
- Python 3.10 or higher
- [Telethon](https://docs.telethon.dev/) package
- [MCP Python SDK](https://modelcontextprotocol.io/docs/)
- [UV](https://astral.sh/uv/) (optional but recommended)## Installation and Setup
### Clone the Repository
```bash
git clone https://github.com/chigwell/telegram-mcp
cd telegram-mcp
```### Create Environment File
Copy and rename `.env.example` to `.env` and fill it with your Telegram credentials obtained from [https://my.telegram.org/apps](https://my.telegram.org/apps):
```bash
cp .env.example .env
```Your `.env` file should look like:
```env
TELEGRAM_API_ID=your_api_id_here
TELEGRAM_API_HASH=your_api_hash_here
TELEGRAM_SESSION_NAME=your_session_name
```### Setup Python Environment
Use `uv` to set up the Python environment and install dependencies:
```bash
uv venv
source .venv/bin/activate
uv add "mcp[cli]" telethon python-dotenv nest_asyncio
```### Run the Server (First-time Auth)
The first time you run the server, Telethon will prompt you to enter a Telegram authentication code:
```bash
uv run main.py
```Authenticate by entering the code sent to your Telegram client. This step is only required once.
## Integrating with Claude for Desktop
### macOS/Linux
Edit your Claude Desktop configuration:
```bash
nano ~/Library/Application\ Support/Claude/claude_desktop_config.json
```Add this MCP server configuration:
```json
{
"mcpServers": {
"telegram-mcp": {
"command": "uv",
"args": [
"--directory",
"/ABSOLUTE_PATH/telegram-mcp",
"run",
"main.py"
]
}
}
}
```Ensure you replace `/ABSOLUTE_PATH/telegram-mcp` with your project's absolute path.
### Windows
Edit your Claude Desktop configuration:
```powershell
nano $env:AppData\Claude\claude_desktop_config.json
```Add this MCP server configuration:
```json
{
"mcpServers": {
"telegram-mcp": {
"command": "uv",
"args": [
"--directory",
"C:\\ABSOLUTE_PATH\\telegram-mcp",
"run",
"main.py"
]
}
}
}
```Ensure you replace `C:\ABSOLUTE_PATH\telegram-mcp` with your project's absolute path.
## Usage
Once integrated, your Telegram tools (`get_chats`, `get_messages`, and `send_message`) will become available within the Claude for Desktop UI or any other MCP-compatible client.
## License
This project is licensed under the [Apache 2.0 License](https://opensource.org/licenses/Apache-2.0).