Skip to main content
Glama
Telegram MCP Server

Telegram MCP Server

Telegram MCP Server

A Model Context Protocol (MCP) server that exposes Telegram Bot API operations as tools for AI assistants like Claude. Send messages, files, photos, read chat history, and pin messages — all through a standardized MCP interface.

Features

Tool

Description

send_telegram_message

Send text messages with Markdown formatting and optional silent mode

send_telegram_file

Send a local file as a document

send_telegram_file_direct

Send a file from in-memory content (UTF-8 or Base64) without writing to disk

send_telegram_photo

Send a local image as a photo

send_telegram_photo_direct

Send a photo from Base64-encoded content without writing to disk

get_telegram_messages

Retrieve the latest messages from the configured chat

pin_telegram_message

Pin a message to the top of the chat

Related MCP server: Telegram MCP Server

Architecture

┌──────────────────────┐
│     Claude / AI      │
└──────────┬───────────┘
           │  stdio (MCP)
┌──────────▼───────────┐
│   MCP Server         │
│   (index.ts)         │
│                      │
│  7 tool handlers     │
└──────────┬───────────┘
           │  HTTPS
┌──────────▼───────────┐
│  Telegram Bot API    │
└──────────────────────┘

The server communicates with the MCP client (e.g. Claude) over stdio and makes HTTPS calls to the Telegram Bot API. It is a single-file, stateless TypeScript application executed on-the-fly with tsx.

Prerequisites

  • Node.js >= 18

  • npm

  • A Telegram Bot Token (create one via @BotFather)

  • The Chat ID of the conversation the bot should interact with

Setup

1. Clone the repository

git clone https://github.com/GeorgBreithaupt/ChlodwigTelegramMCP.git
cd ChlodwigTelegramMCP

2. Install dependencies

npm install

3. Configure environment variables

Create a .env file in the project root:

TELEGRAM_BOT_TOKEN=your-bot-token-here
TELEGRAM_CHAT_ID=your-chat-id-here

Variable

Required

Description

TELEGRAM_BOT_TOKEN

Yes

Bot API token from @BotFather (format: 123456:ABC-DEF...)

TELEGRAM_CHAT_ID

Yes

Numeric ID of the target chat / user

Tip: To find your Chat ID, send a message to your bot and visit https://api.telegram.org/bot<YOUR_TOKEN>/getUpdates — the chat.id field contains the value you need.

4. Run the server (standalone)

npx tsx index.ts

The server starts listening on stdio for MCP requests. In practice it is launched automatically by the MCP client.

MCP Client Configuration

Add the following to your MCP client config to register this server.

Claude Code (.mcp.json)

{
  "mcpServers": {
    "telegram": {
      "command": "npx",
      "args": ["--quiet", "tsx", "/absolute/path/to/ChlodwigTelegramMCP/index.ts"]
    }
  }
}

Claude Desktop (claude_desktop_config.json)

{
  "mcpServers": {
    "telegram": {
      "command": "npx",
      "args": ["--quiet", "tsx", "/absolute/path/to/ChlodwigTelegramMCP/index.ts"]
    }
  }
}

Config file location:

  • Windows: %APPDATA%\Claude\claude_desktop_config.json

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

Tool Reference

send_telegram_message

Send a text message with optional Markdown formatting.

Parameter

Type

Required

Description

text

string

Yes

Message text (supports Markdown)

silent

boolean

No

Send without notification sound

send_telegram_file

Send a file from the local filesystem as a document.

Parameter

Type

Required

Description

filePath

string

Yes

Absolute path to the file

caption

string

No

Caption for the document

send_telegram_file_direct

Send a file from in-memory content — no disk write required.

Parameter

Type

Required

Description

fileName

string

Yes

Name for the file (e.g. report.csv)

fileContent

string

Yes

File content as a string

encoding

string

No

utf-8 (default) or base64

caption

string

No

Caption for the document

send_telegram_photo

Send a local image file as a photo.

Parameter

Type

Required

Description

filePath

string

Yes

Absolute path to the image

caption

string

No

Caption for the photo

send_telegram_photo_direct

Send a photo from Base64-encoded content — no disk write required.

Parameter

Type

Required

Description

photoContent

string

Yes

Base64-encoded image data

fileName

string

Yes

File name (e.g. chart.png)

caption

string

No

Caption for the photo

get_telegram_messages

Retrieve the most recent messages from the configured chat.

Parameter

Type

Required

Description

limit

number

No

Number of messages to return (default: 10)

pin_telegram_message

Pin a message to the top of the chat.

Parameter

Type

Required

Description

messageId

number

Yes

ID of the message to pin

Tech Stack

Component

Technology

Language

TypeScript

Runtime

Node.js (via tsx)

MCP SDK

@modelcontextprotocol/sdk

Transport

stdio

Env management

dotenv

HTTP client

Native fetch API

License

ISC

Tool Schema Changelog

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

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers