telegram-notes-mcp
Enables semantic search over Telegram messages using embeddings generated by a local or self-hosted Ollama server, allowing meaning-based queries.
Provides tools for searching, syncing, and managing your own Telegram chats via full-text and semantic search, including listing whitelisted chats and retrieving message context.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@telegram-notes-mcp find the link about the new design system in my chats"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
telegram-notes-mcp
A local MCP server that gives Claude Code (or any MCP client) full-text and semantic search over your own Telegram chats — via your personal MTProto (Telethon) login. Everything runs on your machine: your own Telegram session, your own SQLite database, your own (optional) Ollama server for embeddings. Nothing is sent to a third-party cloud unless you point it at one yourself.
Ask Claude things like "what did we decide about the deploy last Tuesday?" or "find that link someone shared about X" and get an answer grounded in your actual chat history — not a hallucination.
What's in here
Piece | What it does |
MCP server ( | Exposes search tools to Claude Code / any MCP client |
Web control panel ( | Local browser UI: status, sync, search, ask-Ollama, chat whitelist editor |
Topic analytics ( | Clusters conversation into "bursts", extracts links, labels topics via LLM |
Voice transcription ( | Transcribes voice/video messages via Telegram's built-in transcription (needs Premium) |
Cross-device sharing ( | Export/import the derived analytics layer between your own machines |
Only the MCP server needs to be registered with Claude Code — the rest are optional local tools you run yourself.
Related MCP server: telegram-mcp
MCP tools
Tool | Description |
| Full-text search (SQLite FTS5) |
| Search by meaning via embeddings, with rerank if a whitening index is trained |
| Whitelisted chats with message counts and last activity |
| Messages surrounding a specific message — useful to read the thread around a hit |
| Force an incremental re-sync of all whitelisted chats |
| Index one batch of messages without embeddings (call repeatedly while |
| Transcribe pending voice/video messages (requires Telegram Premium) |
Quick start — mini-app (Windows)
A standalone local app: control-panel window (no browser chrome) + a system tray icon, with Start Menu / Desktop shortcuts. After cloning:
powershell -ExecutionPolicy Bypass -File setup.ps1This creates a venv, installs dependencies (.[app,analytics]), makes a
.env from the template, and creates shortcuts. Then:
Fill in
.env— your ownTG_API_ID/TG_API_HASH(from my.telegram.org) andTG_CHAT_WHITELIST.Log in to your own Telegram:
.venv\Scripts\python.exe scripts\login.py(creates your local session + database — your chats only).Launch the telegram-notes shortcut → a window opens and a tray icon appears.
Panel without the tray (plain browser): .venv\Scripts\python.exe webui\panel.py.
More detail: webui/README.md.
Quick start — manual / macOS / Linux
Windows only: if your only Python is the Microsoft Store version (
where pythonpoints intoWindowsApps\...), install a regular Python from python.org (orwinget install Python.Python.3.13) and use that one below — the Store build has a known bug where the interactive login prompt can crash withEOFErroron a repeated code entry.Create a virtualenv and install the package:
Windows:
python -m venv .venv && .venv\Scripts\activatemacOS/Linux:
python3 -m venv .venv && source .venv/bin/activateThen:
pip install -e ".[dev]"
Create your own
api_id/api_hashat my.telegram.org → "API development tools" — pick any app name, it's free and instant. Don't reuse someone else'sapi_id/api_hash— see docs/prd/001-login-code-never-arrives.md for why that silently breaks login codes.Copy
.env.exampleto.envand fill inTG_API_ID/TG_API_HASHandTG_CHAT_WHITELIST(comma-separated usernames like@someoneand/or numeric chat ids like-1001234567890;me= your own Saved Messages).Run the one-time interactive login:
python scripts/login.py(asks for your phone number + the code Telegram sends you — check the Telegram app itself first, not just SMS; creates the.sessionfile atTG_SESSION_PATH).Register the server with Claude Code (see below).
Each machine (Windows, macOS, ...) does its own login and keeps its own
local .session file and SQLite database — nothing syncs between machines
unless you explicitly use the share.py export/import feature.
Configuration
All configuration lives in .env (see .env.example for the full list with
comments). Required: TG_API_ID, TG_API_HASH, TG_CHAT_WHITELIST.
Everything else — semantic search (TG_OLLAMA_URL / TG_EMBED_MODEL /
TG_OLLAMA_AUTH), analytics noise-filter (TG_OWN_BOT_USERNAME), and the
bot-message editor (TG_BOT_TOKEN) — is optional.
Registering with Claude Code
Preferred: use the CLI so it lands in whichever config file your Claude
Code version actually reads (this has moved between versions — don't
hand-edit ~/.claude/.mcp.json, it's not necessarily the file claude mcp list uses; check with claude mcp list after adding):
claude mcp add telegram-notes -- /absolute/path/to/telegram-notes-mcp/.venv/bin/python -m telegram_notes_mcp.serverOn Windows use the .venv\Scripts\python.exe path. A newly added
user-scope server may need a one-time approval — run claude mcp list and,
if it shows "Pending approval", approve it via claude mcp get telegram-notes or /mcp inside an interactive session.
Don't add a cwd field/flag — Claude Code silently ignores it and always
launches the server from wherever Claude Code itself was started, not this
directory. That's fine: config.py locates .env and resolves any
relative TG_SESSION_PATH/TG_DB_PATH by the project's own directory
(derived from this package's install location), not the process's current
working directory, so the server works correctly regardless of where the
MCP client actually launches it from.
Known issues and their fixes
If something doesn't work, check whether it's already documented:
docs/prd/001-login-code-never-arrives.md — login code never shows up
docs/prd/002-numeric-chat-id-not-resolving.md — a group/channel whitelisted by numeric id fails to sync
docs/prd/003-claude-code-mcp-registration.md — server doesn't show up in Claude Code after registering it
Running tests
pytest
Privacy
Your Telegram session (
.session), database (messages.db), and.envnever leave your machine and are git-ignored by default.Semantic search and Q&A require an Ollama server — point
TG_OLLAMA_URLat your own (local or self-hosted); no data goes to a third-party LLM API unless you configure one yourself.Only chats you explicitly list in
TG_CHAT_WHITELISTare ever synced.
License
MIT — see LICENSE.
Available Tools
7 toolsembed_indexA
Проиндексировать (сгенерировать эмбеддинги) одну пачку сообщений без вектора. Вызывать повторно, пока has_more=true. Для полной переиндексации удобнее scripts/embed_backfill.py.
Inputs: batch.
get_chat_contextB
Return messages surrounding a specific message in a chat.
Inputs: chat_name (required), around_message_id (required), window. Returns: result
list_chatsA
List whitelisted chats with message counts and last activity date.
Inputs: no named parameters. Returns: result
search_messagesC
Full-text search over indexed Telegram messages.
Inputs: query (required), limit, to_date, chat_name, +1 more. Returns: result
semantic_searchA
Поиск сообщений по СМЫСЛУ (эмбеддинги), а не по точным словам. Требует предварительной индексации (embed_index / scripts/embed_backfill.py). Если обучен whitening-индекс (scripts/build_white_index.py) — использует retrieve-more + bge-rerank; иначе честный fallback на сырой nomic.
Inputs: query (required), limit, chat_name. Returns: result
sync_nowA
Force an incremental re-sync of all whitelisted chats.
Inputs: no named parameters. Returns: object
transcribe_voicesA
Transcribe pending voice/video-note messages via Telegram's built-in transcription (requires the logged-in account to have Premium). Transcripts are written into messages.text so they flow into search, embeddings, bursts and topics. Returns {total, transcribed, failed}.
Inputs: limit. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 7 tools
Each tool has a distinct function: indexing, context retrieval, listing chats, full-text search, semantic search, syncing, and transcription. No two tools overlap in purpose.
Naming is a mix of English and Russian, and patterns vary: verb_noun (list_chats), verb_adverb (sync_now), adjective_noun (semantic_search). All use snake_case, but the inconsistency reduces predictability.
Seven tools is appropriate for the server's purpose of searching and analyzing Telegram messages. Each tool provides necessary functionality without excess.
Core workflows (indexing, searching, syncing, transcription) are covered. Missing explicit get/export message operations, but the set is largely complete for its intended use.
Maintenance
Related MCP Connectors
Search your AI chat history (ChatGPT, Claude, Codex) from any MCP client. Remote, private, read-only
Self-hosted AI workspace: semantic RAG document search, long-term memory, and AI chat via MCP.
Hosted Telegram MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Related MCP Servers
- AlicenseAqualityBmaintenanceMCP server that exposes any Telegram-Archive instance to LLMs, enabling message search, chat browsing, and access to archived Telegram history.12838 npm13GPL 3.0
- FlicenseNot gradedqualityCmaintenanceAn MCP server that connects to a Telegram group chat, persists messages to a local SQLite database, and exposes tools to search, retrieve, and send messages via SSE.-
- AlicenseNot gradedqualityCmaintenanceAn MCP server that connects to Telegram as your real user account and exposes read-only tools to read and search messages, list chats and folders, inspect group info, and download media.16 npmMIT
- AlicenseAqualityCmaintenanceMCP server that acts as a gateway to Telegram, providing AI-optimized tools for messaging, search, and chat management via MTProto. Supports multi-user authentication with QR login and HTTP/stdio transports.82MIT