tg-mcp-tools

tg-mcp-tools

A local MCP server for Cursor and Claude Desktop that reads Telegram subscriptions over MTProto and exposes channel posts for digests and natural-language queries.

Category
Visit Server

README

tg-mcp-tools

npm version

A local MCP server for Cursor and Claude Desktop. It reads your Telegram subscriptions over MTProto (personal account, not a bot) and exposes channel posts to the agent for digests and natural-language questions like “what’s new in my Travel folder this week?”

Install

npm install -g tg-mcp-tools

Or run without installing (recommended for MCP):

npx tg-mcp-tools-auth   # one-time login
npx tg-mcp-tools        # MCP server (stdio)

Features

  • 13 MCP tools: channels (create/rename), folders (create/edit), dialogs, messages, digests, send message, archive/unarchive
  • Post links — every message includes a url field (https://t.me/...)
  • Archived channels — included when listing subscriptions
  • QR login — scan from the terminal, no SMS or in-app codes

Requirements

Quick start

Create a project directory, add credentials, authorize, then connect MCP.

mkdir my-telegram-mcp && cd my-telegram-mcp
cp path/to/node_modules/tg-mcp-tools/.env.example .env
# or from a git clone: cp .env.example .env

Fill in .env:

TELEGRAM_API_ID=12345678
TELEGRAM_API_HASH=your_api_hash

Authorize (scan QR in terminal; session is saved to .env in the current directory):

npx tg-mcp-tools-auth
# or, from a git clone: npm run auth

Verify the MCP server starts:

npx tg-mcp-tools
# or, from a git clone: npm run mcp

Cursor setup

Add to .cursor/mcp.json in your project (where .env lives):

{
  "mcpServers": {
    "telegram": {
      "command": "npx",
      "args": ["-y", "tg-mcp-tools"]
    }
  }
}

The server loads .env from the current working directory (your project root). You don't need to duplicate env vars in mcp.json if .env is present.

For local development from a git clone, use:

{
  "mcpServers": {
    "telegram": {
      "command": "npm",
      "args": ["run", "mcp"]
    }
  }
}

After changing the config, reload Cursor (Developer: Reload Window).

MCP Inspector

Use the MCP Inspector to call tg_* tools in the browser and inspect JSON-RPC traffic before wiring Cursor.

From the project root (where .env lives):

npm run inspect

This builds the server, starts it via npm run mcp over stdio, and opens the Inspector UI (usually http://localhost:6274). Use the full URL printed in the terminal if an auth token is required.

Links

CLI mode (no browser):

npx -y @modelcontextprotocol/inspector --cli npm run mcp

MCP tools

Tool Purpose
tg_create_channel Create a new broadcast channel (title and optional description)
tg_set_channel_title Rename a channel or group (requires admin rights)
tg_get_folders Telegram chat folders (tabs) with id and name
tg_create_folder Create a folder with channels and filter rules
tg_edit_folder Update an existing folder: replace included chats or rename it
tg_get_dialogs List channels, groups, and chats; optional folder filter
tg_get_messages Posts from one channel (@username or numeric id)
tg_get_recent_from_channels Digest from multiple channels, sorted by date
tg_get_recent_from_folder Digest from all channels/groups in a folder
tg_send_message Send formatted text to a user (@username), chat id, or "me" (Markdown/HTML)
tg_archive_chats Move chats/channels to Archive
tg_unarchive_chats Restore chats/channels from Archive

Example prompts in Cursor:

What’s new in my Travel folder this week?

Authorization

  1. Run npx tg-mcp-tools-auth from the directory where .env should live
  2. On your phone: Telegram → Settings → Devices → Link Desktop Device
  3. Scan the QR code in the terminal
  4. Enter your 2FA password if prompted
  5. TELEGRAM_SESSION is written to .env automatically

Scripts

Command Description
npx tg-mcp-tools-auth One-time login; saves TELEGRAM_SESSION to .env in cwd
npx tg-mcp-tools Start the MCP server (stdio)
npm run auth / npm run mcp Start auth or MCP server (npm run build first when developing from a git clone)
npm run inspect Build and launch MCP Inspector for this server
npm run build Compile TypeScript → dist/

Security

  • Do not commit .env — it contains your Telegram session (full account access)
  • Never share TELEGRAM_SESSION in logs, issues, or chats
  • Revoke API credentials or sessions at my.telegram.org

Project layout

src/
├── config.ts           # load .env from repo root
├── env-file.ts         # update .env values after auth
├── telegram-client.ts  # mtcute: dialogs, history, post URLs
├── index.ts            # MCP server and tool registration
└── auth.ts             # CLI auth (QR)

Stack

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured