Skip to main content
Glama
tgsearch-mcp

tgsearch-mcp

by schebotar

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
TG_API_IDNoTelegram app credentials (api_id).
TG_API_HASHNoTelegram app credentials (api_hash).
TGSEARCH_HOMENoFixed directory for both config and index.
XDG_DATA_HOMENoData base directory (…/tgsearch-mcp/index.sqlite3).~/.local/share
TGSEARCH_INDEXNoLocal index path.$XDG_DATA_HOME/tgsearch-mcp/index.sqlite3
XDG_CONFIG_HOMENoConfig base directory (…/tgsearch-mcp/config.json).~/.config
TGSEARCH_TIMEOUTNoPer-request timeout, in seconds.60
TG_SESSION_STRINGNoSession string (overrides config.json).
TGSEARCH_DIALOG_TTLNoDialog cache TTL, in seconds.300
TGSEARCH_DIALOG_LIMITNoMaximum dialogs fetched per listing.1000
TGSEARCH_INCLUDE_ARCHIVEDNoInclude archived dialogs.true
TGSEARCH_INDEX_TEXT_LIMITNoMaximum characters stored per message in the local index.10000

Instructions

Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.

Read-only Telegram search over your own user account. Workflow: tg_find_chats -> tg_search_messages -> tg_get_messages(around_id=...) for context. Use tg_search_global for cross-chat search, and tg_index_chat + tg_search_index for fast local search over big histories. The server never sends, edits, joins or deletes anything.

Capabilities

Features and capabilities supported by this server

Protocol revision2025-11-25

CapabilityDetails
tools
{
  "listChanged": false
}
prompts
{
  "listChanged": false
}
resources
{
  "subscribe": false,
  "listChanged": false
}

Tools

Functions exposed to the LLM to take actions

NameDescription
tg_statusA

Check Telegram configuration, login state, account and local index.

Call this first. Never raises: when configuration or the session is missing it returns {ok:true, logged_in:false, hint}.

tg_find_chatsA

Find chats and return the exact ref to use in other tools.

Searches your dialogs by title/username/id and, for a non-empty query, the public Telegram directory. Public results include chats you have not joined; nothing is joined automatically.

tg_get_chatA

Get one chat's details: about, member count, pinned message, forum flag, public link and access restrictions.

tg_list_topicsA

List forum topics of a supergroup; use the returned topic_id as topic_id in tg_search_messages / tg_get_messages.

tg_search_messagesA

Server-side full-text search inside one chat - the fast path for "find X in this channel". Results are newest first, with snippet, link and a next_offset_id cursor. For context around a hit use tg_get_messages with around_id.

tg_search_globalA

Search across all chats your account has access to.

Public channels you have not joined are NOT included: open such a channel with tg_search_messages instead.

tg_get_messagesA

Read history or fetch specific messages.

Use ids for exact messages, around_id for context around a search hit, before_id/after_id for pagination, and no cursor for the latest messages. Results are oldest first and include next cursors.

tg_index_chatA

Build or update the local SQLite FTS5 index for one chat.

Incremental by default: only messages newer than the indexed maximum are fetched. Use it for large histories you query repeatedly, then search it instantly with tg_search_index. On FloodWait the response carries stopped.retry_after; re-run later to continue.

tg_search_indexA

Search the local FTS5 index built by tg_index_chat.

Works without network when chat is a numeric id or a known username. Returns highlighted snippets and links. This is a cache, not a substitute for server-side search over unindexed chats.

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

TDQS

A4/5.0

Scored across 9 tools

Disambiguation4/5

The three search tools (tg_search_messages, tg_search_global, tg_search_index) could initially look interchangeable, but the descriptions clearly scope each: one chat server-side, account-wide server-side, and local FTS5 cache. tg_get_messages vs tg_search_messages and tg_find_chats vs tg_get_chat are also cleanly differentiated by intent (discover vs read).

Naming Consistency5/5

Every tool shares the tg_ prefix followed by a predictable verb_noun pattern (get_chat, find_chats, list_topics, search_messages, get_messages, index_chat, search_index). tg_status is the single noun-only exception but is idiomatic for a health/config probe.

Tool Count5/5

Nine tools is well-scoped for a search/read-focused Telegram server, with each tool covering a distinct capability (status, lookup, topic listing, three search modes, history read, indexing). No obvious filler tools.

Completeness4/5

The search-and-read lifecycle is well covered: discover chats, inspect them, list topics, search per-chat/global/local-index, and paginate history. Minor gaps exist for write/side-effect actions (join a discovered public channel, send/reply, download media, list all dialogs without a query), but the stated search purpose is largely served.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues