Skip to main content
Glama
telegram-archive-mcp

telegram-archive-mcp

by GeiserX

Features

  • Speaks MCP 2026-07-28 and every earlier revision down to 2024-11-05 on stdio and Streamable HTTP. Clients that still use the initialize handshake work unchanged.

  • Search one chat or every chat at once, read a chat page by page, one calendar day in your timezone, or the conversation around one message.

  • Forum topics, pinned messages, folders and per-chat statistics.

  • The photo attached to a message, returned as an image the model can look at and scaled to 1568 pixels when larger (get_media).

  • Every tool is read-only except refresh_stats; READ_ONLY=1 hides that one too.

  • Signs in to Telegram-Archive through /api/login with TELEGRAM_ARCHIVE_USER and TELEGRAM_ARCHIVE_PASS.

  • HTTP listens on loopback by default, checks Origin, caps request bodies, and requires MCP_AUTH_TOKEN on any other address.

  • Ships as an npm package, a Docker image and multi-arch Go binaries.

Related MCP server: telegram-user-mcp

Install

Every client below runs the server over stdio. Set the URL, user and password of your Telegram-Archive viewer.

Claude Code

claude mcp add --env TELEGRAM_ARCHIVE_URL=http://localhost:8000 \
  --env TELEGRAM_ARCHIVE_USER=admin --env TELEGRAM_ARCHIVE_PASS=your-viewer-password \
  --transport stdio telegram-archive -- npx -y telegram-archive-mcp

Claude Desktop (claude_desktop_config.json) and Cursor (~/.cursor/mcp.json)

{
  "mcpServers": {
    "telegram-archive": {
      "command": "npx",
      "args": ["-y", "telegram-archive-mcp"],
      "env": {
        "TELEGRAM_ARCHIVE_URL": "http://localhost:8000",
        "TELEGRAM_ARCHIVE_USER": "admin",
        "TELEGRAM_ARCHIVE_PASS": "your-viewer-password"
      }
    }
  }
}

VS Code (.vscode/mcp.json, asks for the password once)

{
  "inputs": [
    { "type": "promptString", "id": "tg-pass", "description": "Telegram-Archive viewer password", "password": true }
  ],
  "servers": {
    "telegram-archive": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "telegram-archive-mcp"],
      "env": {
        "TELEGRAM_ARCHIVE_URL": "http://localhost:8000",
        "TELEGRAM_ARCHIVE_USER": "admin",
        "TELEGRAM_ARCHIVE_PASS": "${input:tg-pass}"
      }
    }
  }
}

Codex (~/.codex/config.toml)

[mcp_servers.telegram-archive]
command = "npx"
args = ["-y", "telegram-archive-mcp"]
env = { TELEGRAM_ARCHIVE_URL = "http://localhost:8000", TELEGRAM_ARCHIVE_USER = "admin", TELEGRAM_ARCHIVE_PASS = "your-viewer-password" }

Docker, for any client above: use docker as the command with these arguments, and a release tag from the releases page, never latest:

docker run -i --rm -e TELEGRAM_ARCHIVE_URL -e TELEGRAM_ARCHIVE_USER -e TELEGRAM_ARCHIVE_PASS drumsergio/telegram-archive-mcp:vX.Y.Z

The npm package downloads the release binary on first start and checks it against the checksums published with the package, so it also works with npm 12, which skips install scripts. A long-running HTTP server (Docker Compose) and local builds are in Getting started.

Tools

Tool

What it does

list_chats

Lists chats, most recent first; filter by search (name), archived or folder_id. Each chat's ref is the chat_id the other tools take.

list_folders

Lists your Telegram folders and their ids.

search_all_chats

Searches message text in every chat at once.

search_messages

Searches one chat, optionally one forum topic.

get_messages

Reads a chat newest first, by offset or keyset cursor, optionally one forum topic.

get_message_context

Returns one message with the messages before and after it.

get_messages_by_date

Returns every message of one calendar day in a timezone.

get_pinned_messages

Returns a chat's pinned messages.

get_topics

Lists a forum group's topics; their ids feed topic_id.

get_chat_stats

Message and media counts and size of one chat.

get_media

The photo attached to a message, as an image, or the file's details.

refresh_stats

Makes the viewer recalculate archive-wide statistics. Hidden with READ_ONLY=1.

Every tool returns structured content with an output schema, alongside the same JSON as text. Arguments and defaults are on Usage.

Documentation

The full documentation is at geiserx.github.io/telegram-archive-mcp.

  • Getting started: npm, Docker Compose, local build

  • Configuration: environment variables and client configuration

  • Usage: the 4 resources and 12 tools, paging, reading one day at a time

  • Development: testing, contributing, credits

  • Related projects: Telegram Archive, other MCP servers, where this one is listed

License

GPL-3.0-or-later

Available Tools

12 tools
get_chat_statsChat statisticsA
Read-onlyIdempotent

Get the archive's statistics for one chat: how many messages and media files it holds, their total size, and the dates of its first and last message. Use telegram-archive://stats for the totals of the whole archive.

Inputs: chat_id (required). Returns: object

get_mediaLook at a message's photoA
Read-onlyIdempotent

Get the photo or file attached to one message. A JPEG, PNG, WebP or GIF image comes back as an image you can look at, scaled to at most 1568 pixels on its longest side, after a JSON text block with the message's message_id, date, sender, text (the caption) and reply_to_msg_id, and the file's media_key, kind, file_name, mime_type, size_bytes, image_returned, width, height and scaled. Any other file returns only that JSON text block, with a note saying why the file is not included.

Inputs: chat_id (required), message_id (required). Returns: date, kind, note, text, +11 more

get_message_contextRead around a messageA
Read-onlyIdempotent

Read the conversation around one message: the message itself with up to before older and after newer messages of the same chat, oldest first. Use it after search_messages or search_all_chats finds a hit, or to see what a reply_to_msg_id points at.

Inputs: chat_id (required), message_id (required), after, before. Returns: after, before, messages, message_id

get_messagesRead a chat's messagesA
Read-onlyIdempotent

Get messages from a Telegram chat, newest first. Page with offset, or with the keyset cursor: pass the date and id of the last message you received as before_date and before_id to get the older ones (constant time on huge chats). after_id returns the messages right after an id. Dates are naive UTC. Each message carries reply_to_msg_id and, when it has a file, media (pass its id to get_media).

Inputs: chat_id (required), limit, offset, after_id, +3 more. Returns: messages

get_messages_by_dateRead one day of a chatA
Read-onlyIdempotent

Get every message of a Telegram chat sent on one calendar day, oldest first. The day is taken in the given timezone (default UTC); the archive stores dates in UTC. Walks the chat with the keyset cursor, so it is cheap even on chats with hundreds of thousands of messages. Use it to answer "what was said on "; use get_messages to page through a chat instead.

Inputs: date (required), chat_id (required), limit, timezone, +1 more. Returns: date, count, messages, timezone, +2 more

get_pinned_messagesRead pinned messagesA
Read-onlyIdempotent

Get every pinned message of a Telegram chat, newest first, with the same fields as get_messages. Pinned messages often hold a group's rules, addresses or key links.

Inputs: chat_id (required). Returns: messages

get_topicsList forum topicsA
Read-onlyIdempotent

List the forum topics (threads) of a forum supergroup, with message counts. Pass a topic's id as topic_id to get_messages, search_messages or get_messages_by_date to read only that thread. A chat that is not a forum has no topics.

Inputs: chat_id (required). Returns: topics

list_chatsList archived chatsA
Read-onlyIdempotent

List archived Telegram chats, most recent first. Use this first: each chat's ref is the chat_id the other tools take. Each row also carries id (the numeric Telegram chat id), type, accounts (the archive account ids holding the chat), and its title or name. Narrow it with search (by name), archived or folder_id (from list_folders). The answer is {chats, total, limit, offset, has_more}; page with offset while has_more is true.

Inputs: limit, offset, search, archived, +1 more. Returns: chats, limit, total, offset, +1 more

list_foldersList chat foldersA
Read-onlyIdempotent

List the Telegram chat folders (Telegram's dialog filters, such as Work or Family) with their ids. Pass a folder's id to list_chats as folder_id to see the chats inside it.

Inputs: no named parameters. Returns: folders

refresh_statsRecalculate archive statisticsA
Idempotent

Make the viewer recalculate the archive-wide statistics now and return them (chat, message and media counts, total size). It scans the whole archive, so it can take a while and load the viewer's database; it changes no message. Needs the viewer's master login. The cached totals in telegram-archive://stats are usually enough. Hidden when the server runs with READ_ONLY=1.

Inputs: no named parameters. Returns: object

search_all_chatsSearch every chatA
Read-onlyIdempotent

Search message text across every chat this archive login may see, newest first. Matching is by word prefix on the viewer's full-text index. Each hit names its chat, and chat.ref is the chat_id for get_message_context or get_messages. Use search_messages instead to search one known chat. Needs a Telegram Archive viewer with cross-chat search; an older viewer answers 404.

Inputs: query (required), limit, offset. Returns: limit, query, offset, indexed, +2 more

search_messagesSearch one chatA
Read-onlyIdempotent

Search the messages of one chat for a keyword, newest first, and return the matching messages with the same fields as get_messages. Use search_all_chats when you do not know the chat. To read the conversation around a hit, pass its id to get_message_context.

Inputs: query (required), chat_id (required), limit, topic_id. Returns: messages

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.4/5.0

    Scored across 12 tools

    Disambiguation5/5

    Every tool has a clearly distinct scope: get_messages (paging), get_messages_by_date (single day), get_message_context (window around a hit), get_pinned_messages, and get_topics each target different access patterns, and the descriptions explicitly cross-reference when to use one over another. The search pair (search_messages vs search_all_chats) and stats pair (get_chat_stats vs refresh_stats) are likewise cleanly separated by scope and caching behaviour.

    Naming Consistency5/5

    All 12 tools follow a consistent snake_case verb_noun pattern (get_*, list_*, search_*, refresh_*). No camelCase or stylistic outliers, and noun choice is predictable (chats, folders, messages, topics, media, stats).

    Tool Count5/5

    12 tools sit comfortably in the well-scoped range and each earns its place by covering a distinct retrieval need of an archive browser. Nothing feels redundant or padded.

    Completeness4/5

    The read-only archive domain is well covered: discovery (list_chats, list_folders, get_topics), retrieval (paging, by-date, pinned, context), search at both chat and cross-chat levels, media, and stats. Minor gaps remain, such as no way to enumerate archive accounts or fetch a single message by id directly, though these are workable via existing tools.

    Maintenance

    ActivityActive
    ResponsivenessLimited data

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      An 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.
      -
    • A
      license
      Not graded
      quality
      C
      maintenance
      An 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.
      19 npm
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      An MCP server that gives AI agents full access to a personal Telegram account via MTProto, enabling chat reading, history search, messaging, media handling, and automations.
      79
      MIT
    • F
      license
      Not graded
      quality
      C
      maintenance
      Read-only MCP server that exposes retrieval tools over a Telegram chat archive, including archive overview, full-text search with Russian morphology, aggregates, message retrieval, and local context. It lets LLM agents answer questions from chat history without syncing Telegram, downloading files, or modifying the index.
      -