Telegram Contacts MCP Server
Allows connecting to a Telegram account to load contacts, view chat history, search contacts, categorize contacts, and export categorized contacts to Excel.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Telegram Contacts MCP Server
A Model Context Protocol (MCP) server that allows AI assistants like Claude to manage and categorize your Telegram contacts. Built specifically for crypto/DeFi professionals to organize their network.
Features
Connect to Telegram: Authenticate and access your Telegram account
Load Contacts: Batch-load contacts with progress tracking
View Chat History: Read recent messages with any contact
Categorize Contacts: Assign professional categories (Founder, Developer, Investor, etc.)
Bulk Operations: Categorize multiple contacts at once
Export to Excel: Generate organized spreadsheets of categorized contacts
Search: Find contacts by name, username, or bio
Related MCP server: telegram-mcp-server
Prerequisites
Python 3.11 or higher
A Telegram account
Telegram API credentials (API ID and API Hash)
Installation
1. Clone the Repository
git clone https://github.com/yourusername/telegram-contacts-mcp.git
cd telegram-contacts-mcp2. Create a Virtual Environment (Recommended)
python -m venv venv
# Windows
venv\Scripts\activate
# macOS/Linux
source venv/bin/activate3. Install Dependencies
pip install -r requirements.txt4. Get Telegram API Credentials
Log in with your phone number
Create a new application (if you don't have one)
Copy your API ID and API Hash
5. Configure Environment Variables
Copy the example environment file and add your credentials:
cp .env.example .envEdit .env with your credentials:
TELEGRAM_API_ID=your_api_id_here
TELEGRAM_API_HASH=your_api_hash_here6. First-Time Authentication
Run the server once to authenticate with Telegram:
python telegram_mcp_server.pyYou'll be prompted to:
Enter your phone number
Enter the verification code sent to your Telegram
This creates a session file (telegram_session.session) that stores your authentication.
Usage with Claude Code
Configure Claude Code
Add this MCP server to your Claude Code configuration. Edit your Claude Code settings to include:
{
"mcpServers": {
"telegram-contacts": {
"command": "python",
"args": ["path/to/telegram_mcp_server.py"]
}
}
}Or if using uv:
{
"mcpServers": {
"telegram-contacts": {
"command": "uv",
"args": ["run", "path/to/telegram_mcp_server.py"]
}
}
}Available Tools
Once configured, Claude can use these tools:
Tool | Description |
| Connect to Telegram |
| Disconnect from Telegram |
| Count total contacts |
| Load contacts in batches |
| List all cached contacts |
| View chat history with a contact |
| Search contacts by name/username/bio |
| Assign category to a contact |
| Categorize multiple contacts at once |
| Export categorized contacts to Excel |
| List contacts without categories |
| View full details of a contact |
| List all valid categories |
Example Workflow
Connect: "Connect to my Telegram account"
Count: "How many contacts do I have?"
Load: "Load the first 30 contacts"
Categorize: "Categorize John Doe as a Founder at Acme Protocol"
Export: "Export all categorized contacts to Excel"
Contact Categories
The following categories are available for organizing contacts:
Founder/Co-founder - Project founders
Developer - Developers, CTOs, tech leads
Investor/VC - VCs, angel investors, family offices
Business Development - BD, partnerships, sales
Auditor/Security - Security researchers, auditors
Marketing/Growth - Marketing, growth, PR
Exchange/CEX/DEX - Exchange employees
Community Manager - Community managers, moderators
Infrastructure/Node Operator - Validators, node operators
Market Maker - Market makers, liquidity providers
Media/KOL/Influencer - Crypto journalists, influencers
Researcher/Analyst - Researchers, analysts
Trader - Professional traders
Designer/Product - UI/UX designers, product managers
Legal/Compliance - Lawyers, compliance officers
Running Tests
Install test dependencies:
pip install -r test/requirements-test.txtRun the test suite:
pytestRun with coverage:
pytest --cov=telegram_mcp_server --cov-report=htmlProject Structure
telegram-contacts-mcp/
├── telegram_mcp_server.py # Main MCP server
├── requirements.txt # Production dependencies
├── .env.example # Environment template
├── .gitignore # Git ignore rules
├── pytest.ini # Pytest configuration
├── .coveragerc # Coverage configuration
├── README.md # This file
└── test/ # Test suite
├── conftest.py # Test fixtures
├── requirements-test.txt
└── test_*.py # Test modulesSecurity Notes
Never commit your
.envfile - It contains your API credentialsNever commit
telegram_session.session- It contains your authenticationNever commit exported Excel files - They contain your personal contacts
All these files are already in .gitignore.
Troubleshooting
"Session not authorized" Error
Run the server directly to re-authenticate:
python telegram_mcp_server.py"API_ID or API_HASH not found" Error
Make sure your .env file exists and contains valid credentials.
Connection Issues
Telegram may rate-limit requests. The server includes delays between API calls, but if you're loading many contacts, consider using smaller batch sizes.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT License - see LICENSE file for details.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Your Telegram, WhatsApp, Instagram, mail and calendar in Claude or ChatGPT. Never sends messages.
Your own WhatsApp in Claude and ChatGPT: read chats, draft replies, send messages you approve.
Your own WhatsApp in Claude, ChatGPT and other AI apps. Not affiliated with WhatsApp or Meta.
LinkedIn, WhatsApp, Telegram and Instagram inboxes, profiles and outreach for your AI assistant.
Related MCP Servers
- FlicenseNot gradedqualityFmaintenanceEnables Claude to interact with your Telegram account, including reading messages, searching conversations, and sending messages.-
- FlicenseNot gradedqualityDmaintenanceEnables Claude to interact with Telegram, including listing chats, reading messages, sending messages, searching, and managing contacts.1-
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants like Claude to read, search, and send messages through your personal Telegram account via MCP tools.MIT
- FlicenseNot gradedqualityBmaintenanceEnables AI assistants to read Telegram conversations, search messages, retrieve chat context, resolve recipients, and send messages with delivery status.1-