Telegram Digest MCP
Reads dialogs and text messages from the user's own Telegram account, lists available chats, fetches messages for selected periods, and generates structured summaries and digests with checkpointed incremental modes.
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 Digest MCP
Local CLI and MCP server for reading Telegram chats your account already has access to and generating structured LLM summaries.
It does not join chats, impersonate another person, or bypass Telegram access controls. You authenticate explicitly with your own account and work only with dialogs already available to that account.
Why This Exists
Telegram groups and channels can be noisy, high-volume, and hard to review after the fact.
This project turns chats you already have access to into:
concise summaries
structured JSON for automation
readable HTML reports
MCP tools that other AI clients can call
Related MCP server: Telegram MCP
Highlights
local Telegram session, no Telegram bot required
CLI and MCP server on top of the same core logic
multilingual summaries
incremental mode with checkpoints
markdown, JSON, and HTML outputs
practical sections like decisions, useful info, useful links, deadlines, and action items
Quick Start
Install dependencies:
npm ciCopy
.env.exampleto.envand fill in your values:
TELEGRAM_API_ID=
TELEGRAM_API_HASH=
TELEGRAM_PROXY_PROTOCOL=
TELEGRAM_PROXY_HOST=
TELEGRAM_PROXY_PORT=
TELEGRAM_PROXY_SOCKS_TYPE=5
TELEGRAM_PROXY_USERNAME=
TELEGRAM_PROXY_PASSWORD=
LLM_PROXY_HOST=
LLM_PROXY_PORT=
LLM_PROXY_PROTOCOL=socks5
LLM_PROXY_USERNAME=
LLM_PROXY_PASSWORD=
LLM_PROVIDER=opencode-go-openai
LLM_MODEL=glm-5
SUMMARY_LANGUAGE=en
GO_API_KEY=
RUN_MODE=full
MESSAGE_LIMIT=300
LLM_MAX_OUTPUT_TOKENS=8000
SUMMARY_CONCURRENCY=3
MERGE_WINDOW_MINUTES=10Get Telegram API credentials at my.telegram.org.
Run the interactive CLI once to create a local Telegram session:
npm startAfter the first successful login, you can either:
npm startor:
npm run mcpWhat It Does
logs into Telegram with your own account
lists dialogs already available to that account
fetches text messages for a selected period
cleans and merges messages before summarization
summarizes in chunks and produces a final report
saves all output formats by default, or only selected ones
supports incremental summaries via checkpoints
exposes the same logic through MCP tools
Typical Use Cases
summarize noisy Telegram groups once a day or week
extract decisions, action items, and useful links from project chats
create structured chat digests for knowledge capture
let MCP-compatible clients query your Telegram history through tools
Installation Notes
If Telegram access must go through a local SOCKS proxy, set:
TELEGRAM_PROXY_PROTOCOL=socks5
TELEGRAM_PROXY_HOST=127.0.0.1
TELEGRAM_PROXY_PORT=8080
TELEGRAM_PROXY_SOCKS_TYPE=5If Telegram access must go through a plain HTTP proxy such as opera-proxy, set:
TELEGRAM_PROXY_PROTOCOL=http
TELEGRAM_PROXY_HOST=127.0.0.1
TELEGRAM_PROXY_PORT=8080LLM proxy settings are separate from Telegram and do not fall back to TELEGRAM_PROXY_*.
If LLM traffic must go through a plain HTTP proxy, set:
LLM_PROXY_HOST=127.0.0.1
LLM_PROXY_PORT=8080
LLM_PROXY_PROTOCOL=http
LLM_PROXY_USERNAME=
LLM_PROXY_PASSWORD=If LLM traffic must go through a SOCKS proxy, set:
LLM_PROXY_HOST=127.0.0.1
LLM_PROXY_PORT=1080
LLM_PROXY_PROTOCOL=socks5
LLM_PROXY_USERNAME=
LLM_PROXY_PASSWORD=CLI Usage
Interactive mode:
npm startDirect run with arguments:
node src/index.js --chat "My Group" --limit 500 --period weekOptional flags:
--chatdialog number, title fragment, or dialog id--limitnumber of latest messages to read--dialogshow many dialogs to show in the picker--dialog-periodone ofday,week,month,allfor filtering the dialog list by recent activity--provideroverrideLLM_PROVIDER--modeloverrideLLM_MODEL--languageoverrideSUMMARY_LANGUAGE--modeone offull,incremental,changes--periodone ofday,week,month,all--output-formatone format or a comma-separated list:messages,markdown,structured,html,all--include-profile-linksfetch sender profiles, cache them, and add a separate report section for links found in profile text
Examples:
node src/index.js --chat "My Group" --period week --output-format html
node src/index.js --chat "My Group" --period week --output-format markdown,html
node src/index.js --chat "My Group" --period week --include-profile-links --output-format htmlRuntime settings:
SUMMARY_CONCURRENCYcontrols how many chunks are summarized in parallelLLM_MAX_OUTPUT_TOKENScontrols the maximum size of each LLM responsePROFILE_CACHE_TTL_DAYScontrols how long cached Telegram profiles are reused, default14PROFILE_LINK_AUTHOR_MESSAGE_LIMITcontrols how many recent messages per author are used for profile-link analysis, default25PROFILE_LINK_AUTHOR_CHAR_LIMITcontrols the maximum message sample size per author, default6000
Run Modes
fullsummarize the selected period from scratchincrementalsummarize only new messages since the last successful summary for the same dialog and periodchangessame asincremental, but framed as what changed since the previous summary
LLM Providers
Configure providers and model lists in config/llm-providers.json. Use each provider's apiKeyEnv field to name the variable holding its key in .env. The included OpenCode Go configurations read GO_API_KEY. The loopback examples read NINE_ROUTER_API_KEY and DOCKER_GORDON_API_KEY.
Hosted providers receive the chat text selected for summarization. Choose a locally hosted model endpoint when the text needs to stay on your machine.
The selected working pair is:
LLM_PROVIDERLLM_MODEL
You can override both for one run:
node src/index.js --provider opencode-go-openai --model glm-5 --language enSummary Languages
Supported summary languages:
enEnglish, defaultruRussianesSpanishdeGermanfrFrenchzh-cnSimplified Chinese
Language-specific headings and report strings are configured in config/summary-languages.js.
Output Files
Files are written to output/:
*.messages.jsonraw normalized messages*.summary.mdmarkdown summary with stats, table of contents, short version and full version*.summary.jsonstructured summary payload with extracted sections and parsed bullet arrays*.summary.htmlreadable HTML report
By default the app writes all four files. You can limit this in CLI with --output-format or in MCP with outputFormats.
The app also stores:
.telegram-session.txtlocal Telegram session.cache/summary-chunks/cached chunk summaries.state/checkpoints.jsonper-dialog summary checkpoints
MCP Server
The project includes a local MCP server over stdio:
npm run mcpBefore using MCP, run npm start once and complete Telegram login.
Available MCP Tools
list_dialogsget_dialog_messagessummarize_dialoglist_llm_providerslist_summary_languagesget_last_summary
MCP Tool Examples
list_dialogs
{
"activityPeriod": "week"
}get_dialog_messages
{
"dialogRef": "My Group",
"period": "week",
"limit": 200,
"preprocess": true
}summarize_dialog
{
"dialogRef": "My Group",
"period": "month",
"mode": "incremental",
"provider": "opencode-go-openai",
"model": "glm-5",
"language": "en",
"saveOutputs": true,
"outputFormats": ["markdown", "html"]
}get_last_summary
{
"dialogRef": "My Group",
"period": "month",
"includeMarkdown": true,
"includeStructured": true
}MCP Client Config Examples
Example idea for an MCP client that launches a local stdio server:
{
"mcpServers": {
"telegram-summary": {
"command": "node",
"args": ["C:\\Projects\\telegram-chat-digest-mcp\\src\\mcp-server.js"],
"cwd": "C:\\Projects\\telegram-chat-digest-mcp"
}
}
}If your client supports environment injection, you can also point it at the same project folder and .env.
Data Privacy
This project can handle sensitive chat content.
Review and protect:
.env.telegram-session.txt.state/checkpoints.json.cache/summary-chunks/output/
Also remember:
message content may be sent to external LLM providers
generated summaries can contain sensitive internal details
cached chunk summaries may preserve partial chat content locally
Legal and Safe Use
This tool is intended for:
your own account
chats you already have legitimate access to
summarization and analysis workflows you are authorized to perform
It is not intended for:
impersonation
hidden data collection from third parties
bypassing Telegram permissions or access controls
Troubleshooting
If MCP says there is no Telegram session:
run
npm startonce and complete login
If Telegram hangs on connect:
check proxy settings
if you use a plain local HTTP proxy, set
TELEGRAM_PROXY_PROTOCOL=httpif you use SOCKS, set
TELEGRAM_PROXY_PROTOCOL=socks5(orsocks4)
If summaries are truncated:
increase
LLM_MAX_OUTPUT_TOKENS
If LLM requests need a proxy:
for a plain local HTTP proxy, set
LLM_PROXY_PROTOCOL=httpfor SOCKS, set
LLM_PROXY_PROTOCOL=socks5(orsocks4)
If provider/model resolution fails:
verify
LLM_PROVIDERandLLM_MODELverify
config/llm-providers.json
If a summary is empty in incremental mode:
check
.state/checkpoints.jsonthe tool may already have advanced past those messages
Development
Run checks:
npm test
npm run checkProject structure:
src/index.jsCLI entrypoint and public exportssrc/mcp-server.jsMCP stdio serversrc/lib/config.jsconfig and persistence helperssrc/lib/telegram.jsTelegram client and message normalizationsrc/lib/summarizer.jsLLM calls and chunk summarizationsrc/lib/reports.jsreport generationconfig/runtime configurationtest/automated tests
See also:
CHANGELOG.mdCONTRIBUTING.mdSECURITY.mdLICENSE
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
Telegram automation for AI: read and search channel summaries, get digests, manage auto-publishing.
Your personal Telegram account for AI: read, search and sum up chats. QR login, no API key.
Let AI assistants post to your Telegram chats, groups and channels. Not affiliated with Telegram.
WhatsApp and Telegram for AI agents, behind a policy gateway. OAuth or access key.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to interact with a user's Telegram account: list chats, read history, search, and send messages through Telegram's MTProto API.2MIT
- AlicenseBqualityDmaintenanceProvides read-only access to Telegram chats, allowing AI agents to list chats, read messages, and search within chats via local MCP.14MIT
- AlicenseBqualityNot gradedmaintenanceEnables AI assistants to manage Telegram files, messages, and dialogs directly via MTProto, supporting upload, download, search, forwarding, and storage overview operations.19MIT
- FlicenseNot gradedqualityBmaintenanceEnables AI assistants to read Telegram conversations, search messages, retrieve chat context, resolve recipients, and send messages with delivery status.1-