About Tg MCP
Tg MCP is an MCP server published by ogk-code in the Communication category: mCP server that connects AI assistants to Telegram via MTProto API. Let AI read your messages, send replies, manage chats — all through natural language.
The repository has 1 stars and 0 forks, with the last commit 10 months ago. Six months or more without a commit doesn't mean the server is broken, but check the open issues before depending on it in production.
Install
git clone https://github.com/ogk-code/tg-mcpThis server has no ConduID identity, so agent calls to it are not receipted. Pin the version you install and review the source before granting it credentials.
Tools (10)
auth_logoutLogout and clear session
Parameters not published.
auth_send_codeSend login code to phone
Parameters not published.
auth_statusCheck authorization status
Parameters not published.
auth_submit_codeSubmit code (with optional 2FA password)
Parameters not published.
delete_chatDelete a chat/dialog
Parameters not published.
get_chats_overviewGet all chats with recent messages in one request
Parameters not published.
get_messagesGet messages from a specific chat
Parameters not published.
leave_channelLeave a channel or group
Parameters not published.
list_chatsGet list of dialogs with unread counts
Parameters not published.
send_messageSend a message to a chat
Parameters not published.
Ask AI
Ask AI about Tg MCP
Powered by Claude · Grounded in docs
Security checks
Static checks derived from the repository 15 hours ago. Heuristics on the source, not an audit.
- ✓README presentThe repository ships documentation.
- ✓License declaredUsable under a stated license.
- !Tests presentNo tests found. Behaviour changes may go unnoticed between versions.
- ✓Dependencies pinnedA lockfile pins dependency versions.
- ✓No dynamic code executionSource scan found no eval, dynamic Function, or shell execution.
- !Scoped permissionsDoesn't declare a permission scope. Assume it can do anything its process can.
README
tg-mcp
MCP server that connects AI assistants to Telegram via MTProto API.
Built with gotd/td and go-sdk.
Features
- Authentication: Login with phone number and 2FA support
- Messages: Send and read messages
- Chats: List dialogs, get chat overview with recent messages
- Management: Leave channels/groups, delete chats
Available Tools
| Tool | Description |
|---|---|
auth_status |
Check authorization status |
auth_send_code |
Send login code to phone |
auth_submit_code |
Submit code (with optional 2FA password) |
auth_logout |
Logout and clear session |
list_chats |
Get list of dialogs with unread counts |
get_chats_overview |
Get all chats with recent messages in one request |
get_messages |
Get messages from a specific chat |
send_message |
Send a message to a chat |
leave_channel |
Leave a channel or group |
delete_chat |
Delete a chat/dialog |
Installation
Prerequisites
- Go 1.21+
- Telegram API credentials from https://my.telegram.org/apps
Build
git clone https://github.com/yourusername/tg-mcp.git
cd tg-mcp
go build -o tg-mcp .
Cross-compile for Windows:
GOOS=windows GOARCH=amd64 go build -o tg-mcp.exe .
Configuration
Claude Desktop
Add to claude_desktop_config.json:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"telegram": {
"command": "/path/to/tg-mcp",
"args": [],
"env": {
"TG_APP_ID": "your_app_id",
"TG_APP_HASH": "your_app_hash"
}
}
}
}
Windows example:
{
"mcpServers": {
"telegram": {
"command": "C:\\Users\\YourName\\tg-mcp.exe",
"args": [],
"env": {
"TG_APP_ID": "your_app_id",
"TG_APP_HASH": "your_app_hash"
}
}
}
}
Claude Code
Add to ~/.claude.json:
{
"mcpServers": {
"telegram": {
"type": "stdio",
"command": "/path/to/tg-mcp",
"env": {
"TG_APP_ID": "your_app_id",
"TG_APP_HASH": "your_app_hash"
}
}
}
}
Open WebUI (via mcpo)
Use mcpo to expose as OpenAPI:
pip install mcpo
TG_APP_ID=your_id TG_APP_HASH=your_hash mcpo --port 8000 -- /path/to/tg-mcp
Then add http://localhost:8000 as OpenAPI server in Open WebUI.
Environment Variables
| Variable | Required | Description |
|---|---|---|
TG_APP_ID |
Yes | Telegram API ID |
TG_APP_HASH |
Yes | Telegram API Hash |
TG_SESSION_FILE |
No | Custom session file path (default: ~/.tg-mcp-session.json) |
Usage
After configuring, restart your MCP client (Claude Desktop, Claude Code, etc.).
First-time Authorization
- Use
auth_send_codewith your phone number - You'll receive a code in Telegram
- Use
auth_submit_codewith the code (and password if 2FA is enabled) - Done! Session is saved for future use
Example Prompts
- "Show me my recent Telegram chats"
- "Send a message to @username saying hello"
- "What are my unread messages?"
- "Leave the channel @spamchannel"
Security
- Session file (
~/.tg-mcp-session.json) contains your auth key — keep it private! - APP_ID/APP_HASH are not sensitive — they identify the app, not your account
- Uses MTProto (user API), not Bot API — full account access
License
MIT
README fetched from the repository 15 hours ago. The original is authoritative.