@teletele/tg-mcp
Exposes tools for driving a local Telegram userbot account: listing accounts and groups, reading group messages and direct messages, searching messages, sending group messages, replying to DMs, saving drafts, and reacting with emoji.
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.
Why Teletele MCP?
Most Telegram agent integrations ask you to upload raw .session files to a hosted proxy or paste credentials directly into an LLM process. Teletele MCP separates untrusted AI clients from your Telegram identity with a strict local loopback boundary:
Zero-dependency stdio MCP server (
@teletele/tg-mcp) — Pure Node.js (>= 22) implementing MCP JSON-RPC 2.0 (2024-11-05) with 9 allowlisted Telegram tools and zero third-party runtime dependencies.Local AES-256-GCM encrypted sidecar (
tg-gateway-oss) — Single-account FastAPI + Telethon gateway bound to127.0.0.1:18421that encrypts both your TelegramStringSessionandapi_hashat rest with0600key permissions.Human-in-the-loop draft staging —
tg_save_draftwrites pending replies to~/.teletele-oss/drafts.jsoninstead of auto-sending, so agents can triage conversations safely without sending unreviewed outbound messages.Rich media awareness —
tg_read_messagesandtg_read_dmclassify photos, voice notes, videos, GIFs, stickers, polls, contacts, locations, and files into structured fallback text so LLMs never lose context on non-text threads.Typed Plugin SDK (
@teletele/plugin-sdk) — Author and validate hot-swappable full-stack Feature Plugins (teletele-feature-v1) and Business Rule Packs (teletele-plugin-v1) for Teletele Bot Desktop Studio.
Related MCP server: Telegram MCP Server
Packages Included
Package / Directory | Name | Runtime | Responsibility |
| Node.js | Zero-dependency stdio JSON-RPC 2.0 MCP server ( | |
| TypeScript / ESM | Strongly typed manifest builders ( | |
| Python | Single-account FastAPI + Telethon gateway with |
5-Minute Quickstart
Pre-Built Release Download (Zero Build)
Prefer not to install pnpm or Python build tooling? Download the pre-compiled release artifacts directly from GitHub Releases (latest):
Pre-compiled Quickstart Bundle:
teletele-mcp-v0.1.0-quickstart.tar.gz(macOS / Linux) orteletele-mcp-v0.1.0-quickstart.zip(Windows) — includes builtpackages/tg-mcp-server/dist/index.jsready to register in Claude Desktop / Cursor.Standalone Encrypted Sidecar Binaries (zero Python install required):
tg-gateway-oss-macos-arm64.tar.gz(macOS Apple Silicon)tg-gateway-oss-linux-x64.tar.gz(Linux x86_64)tg-gateway-oss-windows-x64.zip(Windows x64.exe)
Offline npm Tarballs & Checksums:
teletele-tg-mcp-0.1.0.tgz,teletele-plugin-sdk-0.1.0.tgz, andSHA256SUMS.txt.
# Example (macOS Apple Silicon): run the standalone gateway binary without Python
tar -xzf tg-gateway-oss-macos-arm64.tar.gz
export TELETELE_GATEWAY_TOKEN="$(openssl rand -hex 32)"
./tg-gateway-oss-macos-arm64 # binds to 127.0.0.1:18421Build from Source — Prerequisites
Node.js
>= 22andpnpm(pnpm@10.x)Python
>= 3.11anduv(orpip+venv)A Telegram account (and optional Telegram API credentials from my.telegram.org)
Step 1 — Clone & Build TypeScript Packages
git clone https://github.com/PunkSlerf/teletele-mcp.git
cd teletele-mcp
pnpm install && pnpm buildThis compiles both @teletele/tg-mcp (packages/tg-mcp-server/dist/index.js) and @teletele/plugin-sdk (packages/plugin-sdk/dist/index.js).
Step 2 — Start the Local Encrypted Sidecar (tg-gateway-oss)
Generate a high-entropy local gateway token and bind the sidecar strictly to loopback (127.0.0.1):
cd sidecar/tg-gateway-oss
uv venv && uv sync
export TELETELE_GATEWAY_TOKEN="$(openssl rand -hex 32)"
echo "Save this token for your MCP client: $TELETELE_GATEWAY_TOKEN"
uv run uvicorn tg_gateway_oss.server:app --host 127.0.0.1 --port 18421You can optionally setTELETELE_OSS_DATA_DIR (defaults to ~/.teletele-oss) and TELETELE_VAULT_KEY (32-byte URL-safe base64 key; otherwise auto-generated into ~/.teletele-oss/vault/.vault.key with 0600 permissions).
Step 3 — Onboard Your Local Telegram Session (QR / Login Code)
Generate a Telethon StringSession locally (one-time interactive login) and import it directly into the AES-256-GCM encrypted vault:
# 1) Generate a Telethon StringSession locally (supports phone code or QR)
uv run python -c '
import asyncio, os
from telethon import TelegramClient
from telethon.sessions import StringSession
async def main():
api_id = int(os.getenv("TG_API_ID", "2040"))
api_hash = os.getenv("TG_API_HASH", "b18441a1ff607e10a989891a5462e627")
async with TelegramClient(StringSession(), api_id, api_hash) as client:
print("\nSESSION_STRING=" + client.session.save())
asyncio.run(main())
'Import the generated SESSION_STRING into tg-gateway-oss (it is immediately encrypted with AES-256-GCM before touching disk):
curl -sS -X POST http://127.0.0.1:18421/admin/v1/import-session \
-H "Content-Type: application/json" \
-H "X-Agent-Token: $TELETELE_GATEWAY_TOKEN" \
-d '{
"account_id": "primary",
"phone": "+15550100000",
"session_string": "<paste-telethon-string-session>"
}'Verify the gateway is healthy and your local account is sealed in the vault:
curl -sS http://127.0.0.1:18421/health
# {"ok":true,"edition":"oss","max_accounts":1,"account_configured":true}Step 4 — Connect Your AI Client
Replace /path/to/teletele-mcp with your local clone path and paste the TELETELE_GATEWAY_TOKEN from Step 2.
{
"mcpServers": {
"teletele-tg": {
"command": "node",
"args": ["/path/to/teletele-mcp/packages/tg-mcp-server/dist/index.js"],
"env": {
"TELETELE_SIDECAR_URL": "http://127.0.0.1:18421",
"TELETELE_GATEWAY_TOKEN": "<your-local-gateway-token>"
}
}
}
}{
"mcpServers": {
"teletele-tg": {
"command": "node",
"args": ["/path/to/teletele-mcp/packages/tg-mcp-server/dist/index.js"],
"env": {
"TELETELE_SIDECAR_URL": "http://127.0.0.1:18421",
"TELETELE_GATEWAY_TOKEN": "<your-local-gateway-token>"
}
}
}
}[mcp_servers.teletele-tg]
command = "node"
args = ["/path/to/teletele-mcp/packages/tg-mcp-server/dist/index.js"]
[mcp_servers.teletele-tg.env]
TELETELE_SIDECAR_URL = "http://127.0.0.1:18421"
TELETELE_GATEWAY_TOKEN = "<your-local-gateway-token>"9 MCP Tools Reference
@teletele/tg-mcp exposes 9 strongly-typed tools over MCP JSON-RPC 2.0 (protocolVersion: "2024-11-05"). Every call is mapped to POST /agent/v1/tools/<gateway_tool> on tg-gateway-oss.
MCP Tool Name | Gateway Route | Parameters ( | Mode & Safety Notes |
|
| (none) | Read-only. Returns the configured local Telegram account metadata ( |
|
|
| Read-only. Lists recent Telegram dialogs (groups, supergroups, channels, and DMs) with |
|
|
| Read-only. Reads recent messages from a group or channel. Automatically replaces non-text media (photos, voice notes, polls, files) with structured fallback labels. |
|
|
| Read-only. Reads recent direct messages exchanged with a Telegram user or peer ID. |
|
|
| Read-only. Searches Telegram messages globally (when |
|
|
| Safe Draft (Recommended). Appends a |
|
|
| Live Write. Immediately sends a message to a Telegram group or channel (supports threading via |
|
|
| Live Write. Immediately sends a direct message reply to a Telegram user. |
|
|
| Live Reaction. Sends a Telegram emoji reaction ( |
Looking fortg_join_group, tg_delete_messages, tg_download_media, multi-account auto-rotation, anti-ban jitter/cooldown guardrails, or mobile-synced Draft Approval Inbox? Those ship inside Teletele Bot Desktop (Pro / Studio).
@teletele/plugin-sdk Developer Guide
@teletele/plugin-sdk provides the open-source TypeScript schema and builder utilities for extending Teletele Bot Desktop Studio with hot-swappable full-stack Feature Plugins (teletele-feature-v1) and Business Rule Packs (teletele-plugin-v1).
When you define a table_crud plugin using defineFeaturePlugin, the SDK automatically declares both the AI agent tools and REST CRUD routes:
Auto-contributed Agent Tools:
feature_<id>_list_records,feature_<id>_upsert_record,feature_<id>_delete_recordAuto-contributed Runtime Routes:
GET /api/feature-plugins/<id>/records,POST /api/feature-plugins/<id>/records,DELETE /api/feature-plugins/<id>/records/:idSupported
uiKindmodes:"table_crud"(auto-generated SQLite CRUD view),"custom_html"(sandboxed interactive panel),"builtin_view", and"right_pane".
Example: Partner License Inventory Feature Plugin
import {
defineFeaturePlugin,
validateFeaturePluginManifest,
type FeaturePluginManifest,
} from "@teletele/plugin-sdk";
export const partnerLicensesPlugin: FeaturePluginManifest = defineFeaturePlugin({
id: "partner-licenses",
name: "Partner License Vault",
version: "1.0.0",
category: "Operations",
iconEmoji: "🔑",
accentColor: "#38bdf8",
description:
"Track partner activation keys, seat counts, and fulfillment status directly inside Teletele Bot Studio.",
uiKind: "table_crud",
navSlot: {
section: "operations",
label: "License Vault",
iconName: "Package",
order: 20,
},
statusColumnKey: "status",
tableColumns: [
{ key: "partner", label: "Partner", type: "text", required: true, placeholder: "Acme Cloud" },
{ key: "seats", label: "Seats", type: "number", required: true, placeholder: "10" },
{
key: "status",
label: "Status",
type: "select",
options: ["available", "reserved", "issued", "revoked"],
required: true,
},
{ key: "license_key", label: "Activation Key", type: "secret", required: true },
],
agentPromptGuide:
"Before issuing a key to a Telegram VIP contact, query feature_partner-licenses_list_records for an 'available' row and stage the delivery message with tg_save_draft.",
});
const check = validateFeaturePluginManifest(partnerLicensesPlugin);
if (!check.valid) {
throw new Error(`Invalid plugin manifest: ${check.errors.join("; ")}`);
}
// Ready to export as JSON and hot-install in Teletele Bot Desktop Studio
console.log(JSON.stringify(partnerLicensesPlugin, null, 2));Zero-Trust Local Security Architecture
Security Guarantees
Zero LLM Credential Exposure — The AI client (Claude, Cursor, Codex, or your agent) only communicates with
@teletele/tg-mcpoverstdin/stdout. It never receives the filesystem path to your vault,.vault.key,StringSession, orapi_hash.Loopback-Only Transport & Constant-Time Token Verification —
tg-gateway-osslistens exclusively on127.0.0.1:18421and validatesX-Agent-Token,X-Teletele-Admin-Token, orAuthorization: Bearer <token>using Python's constant-timehmac.compare_digest.Authenticated AES-256-GCM Storage —
SessionVaultencrypts bothsession_stringandapi_hashbefore writing~/.teletele-oss/account.jsonusingcryptography'sAESGCMwith a 256-bit key and a fresh 12-byte CSPRNG nonce (os.urandom(12)) per secret. The vault directory is locked to0700and.vault.keyis locked to0600(or injected viaTELETELE_VAULT_KEY/ ElectronsafeStorage).Human-in-the-Loop Draft Staging —
tg_save_draftpersists outbound candidates locally in~/.teletele-oss/drafts.json(status: "pending") without touching Telegram's send API.
Environment Variables
Variable | Component | Default | Purpose |
|
|
| Loopback base URL of |
| Both | (empty) | Shared secret required on |
|
| Falls back to | Optional dedicated admin token for session import. |
|
|
| Directory holding |
|
| Auto-generated | Optional 32-byte URL-safe base64 master key (or passphrase hashed via SHA-256). |
|
| Built-in defaults | Optional custom Telegram API credentials from |
Open-Source vs Teletele Bot Desktop
The open-source core in this repository (PunkSlerf/teletele-mcp, MIT) is designed for solo developers integrating 1 local Telegram account into MCP clients. When you need a turnkey visual workstation for multi-account growth, team CRM, anti-ban guardrails, and mobile draft sign-off, upgrade seamlessly to Teletele Bot Desktop.
Capability | Open-Source ( | Desktop Free Trial | Desktop Pro | Desktop Studio |
License / Pricing | Free (MIT) | Free Local Trial | ||
Telegram Accounts | 1 local account | 1 local account | Up to 5 accounts | Up to 30+ accounts |
Stdio MCP Server (9 Tools) & Plugin SDK | ✅ | ✅ | ✅ | ✅ |
AES-256-GCM Local Session Vault | ✅ ( | ✅ (+ OS | ✅ (+ OS | ✅ (+ OS |
AI Digital Employees & Visual Workstation | Headless MCP only | 1 AI employee | Up to 3 AI employees | Unlimited ( |
Draft Approval Inbox (Mobile TG Draft Sync) | Local | ✅ | ✅ | ✅ |
5-Stage CRM Sales Funnel & Task Kanban | — | — | ✅ | ✅ |
Multi-Account Auto-Rotation & Anti-Ban Guardrails | — | — | ✅ | ✅ |
Auto Routines, Risk Radar & Built-in Browser | — | — | ✅ | ✅ |
Official Teletele Cloud Compute Credits | BYO MCP Host | — | 500 credits included | 2,000 credits included |
BYOK Providers & Hot-Swappable Custom Plugins | SDK Authoring | — | — | ✅ |
Multi-Bot Channels & Mobile / LAN Co-Pilot | — | — | — | ✅ |
Development & Verification
# Install workspace dependencies
pnpm install
# Build @teletele/tg-mcp and @teletele/plugin-sdk
pnpm build
# Run strict TypeScript typechecking across all packages
pnpm typecheckQuick Smoke Test (Stdio JSON-RPC 2.0)
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | node ./packages/tg-mcp-server/dist/index.jsLicense
Released under the MIT License. Built with ❤️ by the Teletele team — bot.teletele.lol.
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
Hosted Telegram MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Telegram bridge for your MCP-compatible agent. Bidirectional, no LLM in our stack.
Multi-tenant Telegram gateway for AI agents — HTTP+stdio, 8 tools, MTProto User API
Zero-setup MCP gateway securely connecting AI to your tools with authentication and workflows
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to interact with Telegram accounts through MCP, supporting messaging, contacts, groups, media, and admin functions.4Apache 2.0
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with Telegram accounts, chats, messages, media, and more via MCP, using Telethon.Apache 2.0
- AlicenseAqualityBmaintenanceEnables MCP-compatible clients to securely access and manage Telegram accounts, chats, messages, media, and contacts, with tiered permissions, write controls, and local caching.22Apache 2.0
- AlicenseBqualityDmaintenanceEnables MCP clients to operate a Telegram account as a userbot, providing tools for reading and sending messages, searching chats and contacts, managing media, and performing other account actions via MTProto with a locally encrypted session.28MIT