Skip to main content
Glama
mshykhov

Telegram MCP Readonly

by mshykhov

Telegram MCP Readonly

Search and analyze your Telegram account with AI agents without exposing Telegram mutation tools.

Tests Lint Docker License

Use your full Telegram account as a searchable knowledge source for Codex, Claude, and other Model Context Protocol clients. Find chats by title or username, search message text across the account, read history, inspect contacts and topics, and download media into one private local directory.

IMPORTANT

Runsetup_codex_readonly.py before connecting an agent. It enables the explicit strict-read-only allowlist. The codebase retains upstream write-capable tools for compatibility, but strict mode does not register them.

Why this fork

  • Explicit audited allowlist, independent of MCP annotation accuracy

  • Search by text, username, phone, or chat title - IDs are optional for discovery

  • One loopback service shared by multiple agent clients

  • Local file session and credentials with owner-only permissions

  • Multi-account support and sanitized Telegram output

  • No session string copied into agent configuration

Related MCP server: tdl-mcp

Read-only boundary

Available in strict mode

Not exposed in strict mode

Accounts, chats, folders, topics, contacts

Send, reply, edit, delete, or forward messages

Message history and account-wide search

Reactions, read receipts, drafts, or pins that mutate Telegram

Participants, admins, links, and metadata

Join, leave, invite, ban, or change members

Passive waits for incoming messages

Change profiles, privacy, folders, or chat settings

Media download to one configured local directory

Arbitrary local paths or agent-selected filenames

download_media_readonly is the only deliberate local write. It creates generated filenames below TELEGRAM_READONLY_DOWNLOAD_DIR with owner-only permissions and never calls a mutating Telegram RPC.

WARNING

Strict mode limits the MCP tool surface, not the authority of the underlying Telegram session. A stolen session file can compromise the account. Keep the checkout,.env, .local/, and the host itself private and trusted.

Quick start

Requirements: Python 3.10+, uv, a Telegram account, and API credentials from my.telegram.org/apps.

git clone https://github.com/mshykhov/telegram-mcp-readonly.git
cd telegram-mcp-readonly
uv sync --frozen
uv run python setup_codex_readonly.py

The setup opens Telegram QR authorization and creates these ignored local files:

  • .env with TELEGRAM_EXPOSED_TOOLS=strict-read-only

  • .local/telegram-readonly.session

  • downloads/ for path-confined media downloads

Do not install telegram-mcp from PyPI or run it with uvx: that package name belongs to a different project. Clone this repository and run it from the checkout.

Shared service on macOS

A single local service avoids Telethon SQLite lock conflicts when Codex, Claude, or several sessions connect at once.

uv run telegram-mcp-shared-service check
uv run telegram-mcp-shared-service prepare
uv run telegram-mcp-shared-service activate
uv run telegram-mcp-shared-service status

Connect clients to the loopback-only endpoint:

{
  "mcpServers": {
    "telegram-readonly": {
      "type": "http",
      "url": "http://127.0.0.1:8765/mcp"
    }
  }
}

The endpoint is unauthenticated and must stay bound to 127.0.0.1.

Example prompts

  • "Find the chat named Product Team and summarize its last 100 messages."

  • "Search all Telegram messages for incident review from the last month."

  • "Find messages containing this URL and show their chat names and dates."

  • "List unread chats, then summarize them without marking anything as read."

  • "Download the media from this message into the private download directory."

Configuration

The safe setup script writes the required values. See .env.example for optional proxy, multi-account, output, and event-feed settings.

For a manual launch, set at minimum:

TELEGRAM_API_ID=your_api_id
TELEGRAM_API_HASH=your_api_hash
TELEGRAM_SESSION_NAME=/private/path/telegram-readonly
TELEGRAM_EXPOSED_TOOLS=strict-read-only
TELEGRAM_READONLY_DOWNLOAD_DIR=/private/path/downloads

Documentation

Development

uv sync --frozen
uv run pytest --cov --cov-report=term-missing --cov-report=xml
uv run flake8 . --exclude=.venv --count --select=E9,F63,F7,F82 --show-source --statistics
uv run black --check .
npm ci
npm run rulesync:verify

Attribution

Based on chigwell/telegram-mcp. The strict read-only boundary, local setup, shared service, and security hardening are maintained in this repository.

Licensed under the Apache License 2.0.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

No tool schema history has been recorded yet.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables AI agents to read, send, and organize Telegram messages and chats. Supports tools for listing chats, fetching messages, sending/reply, archiving, muting, and folder management.
    1
    MIT
  • A
    license
    A
    quality
    D
    maintenance
    Read-only Telegram access for Claude and other MCP hosts. Provides tools to list chats, read recent messages, and download media from your own Telegram account without needing an api_id/api_hash.
    5
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables AI agents to interact with a user's Telegram account: list chats, read history, search, and send messages through Telegram's MTProto API.
    1
    MIT
  • A
    license
    B
    quality
    B
    maintenance
    Provides read-only access to a user's Telegram account via MTProto, enabling chat listing, message retrieval, search, and context fetching.
    5
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mshykhov/telegram-mcp-readonly'

If you have feedback or need assistance with the MCP directory API, please join our Discord server