Skip to main content
Glama
kamalbuilds

Telegram MCP Server

by kamalbuilds

Telegram MCP Server for Claude Code

Read and search Telegram channel/group/DM messages directly from Claude Code.

Uses MTProto (user account API) via GramJS, so it can read full message history, not just new messages like Bot API.

Setup

1. Get Telegram API credentials

  1. Go to https://my.telegram.org/apps

  2. Log in with your phone number

  3. Create an application

  4. Note down your API ID and API Hash

2. Install and authenticate

cd telegram-mcp-server
npm install
npm run build

# Generate session (interactive, one-time)
TELEGRAM_API_ID=12345 TELEGRAM_API_HASH=abc123def456 npm run auth

This will ask for your phone number, send you a code on Telegram, and output a session string. Save it.

3. Add to Claude Code

claude mcp add telegram-mcp \
  -e TELEGRAM_API_ID=12345 \
  -e TELEGRAM_API_HASH=abc123def456 \
  -e TELEGRAM_SESSION=your_session_string_here \
  -- node /Users/kamal/Desktop/telegram-mcp-server/build/index.js

Or add manually to ~/.claude.json:

{
  "mcpServers": {
    "telegram-mcp": {
      "type": "stdio",
      "command": "node",
      "args": ["/Users/kamal/Desktop/telegram-mcp-server/build/index.js"],
      "env": {
        "TELEGRAM_API_ID": "12345",
        "TELEGRAM_API_HASH": "abc123def456",
        "TELEGRAM_SESSION": "your_session_string_here"
      }
    }
  }
}

Related MCP server: telegram-mcp-server

Tools

Tool

Description

list_chats

List your chats, channels, groups with IDs and unread counts

read_messages

Read messages from a specific chat/channel/group

search_messages

Search messages globally or within a specific chat

get_chat_info

Get detailed info about a chat/channel/group

send_message

Send a message to any chat

Usage in Claude Code

Once configured, just ask Claude:

  • "List my Telegram channels"

  • "Read the last 50 messages from @channelname"

  • "Search for 'meeting notes' across all my Telegram chats"

  • "What are the recent messages in the dev group?"

Environment Variables

Variable

Required

Description

TELEGRAM_API_ID

Yes

From my.telegram.org

TELEGRAM_API_HASH

Yes

From my.telegram.org

TELEGRAM_SESSION

Yes

Generated via npm run auth

Available Tools

5 tools
get_chat_infoC

Get detailed information about a Telegram chat, channel, or group.

ParametersJSON Schema
NameRequiredDescriptionDefault
chatYesChat ID (numeric) or @username

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It only states it gets information but does not clarify the nature of the operation (e.g., read-only vs. potentially heavy), authentication needs, error behaviors, or what 'detailed information' includes. The description lacks sufficient behavioral context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence that directly states the purpose. It is concise and front-loaded, with no wasted words. However, it could benefit from a minor structural addition (e.g., a second sentence about typical use) without losing conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool has only one parameter with good schema coverage, but lacks an output schema and annotations. The description does not elaborate on what 'detailed information' includes or how to interpret the output. While adequate for a simple read tool, it leaves room for ambiguity about the response format or potential limitations.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents the single parameter 'chat' as accepting a numeric ID or @username. The description does not add extra meaning beyond what the schema states, returning to baseline of 3. No value added.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Get' and the resource 'detailed information about a Telegram chat, channel, or group', which distinguishes it from sibling tools like 'list_chats' (listing) or 'send_message' (sending). The scope is specific and unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description does not provide any guidance on when to use this tool versus the listed sibling tools. No context is given about usage scenarios, prerequisites (e.g., needing the chat ID), or when alternatives would be more appropriate.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_chatsA

List your Telegram chats, channels, and groups. Returns chat name, ID, type, and unread count.

ParametersJSON Schema
NameRequiredDescriptionDefault
limitNoMax number of chats to return (default 30)
filterNoFilter by chat typeall

TDQS

A3.9/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. The description implies a read-only list operation via 'list' and 'returns', which is sufficient for transparency. It does not disclose potential rate limits or pagination behavior, but for a simple listing tool this is acceptable. The return fields are clearly stated, adding confidence in what the tool does.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences long, front-loaded with the action ('List your Telegram chats...'), and contains no extraneous information. Every word adds value, making it easy for an agent to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Despite no output schema, the description explicitly lists the fields returned (name, ID, type, unread count), which is complete for a list tool. The input schema (with default values) covers the parameters. The tool is simple, and the description provides all necessary context for an agent to invoke it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3. The description does not add any additional meaning beyond the schema; it merely states the return fields. The parameters (limit, filter) are adequately documented in the schema, so the description does not need to expand on them. A score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'list' and the resource 'your Telegram chats, channels, and groups', making the tool's purpose unambiguous. It also specifies the return fields (name, ID, type, unread count), which distinguishes it from sibling tools like get_chat_info (single chat) or read_messages (messages within chats).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It does not mention the filter parameter's role in selecting between chat types, nor does it advise against use when a specific chat's info is needed (for which get_chat_info would be more appropriate). The lack of explicit context or exclusions leaves the agent to infer usage from the name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

read_messagesB

Read messages from a Telegram chat, channel, or group. Use a chat ID (from list_chats) or @username.

ParametersJSON Schema
NameRequiredDescriptionDefault
chatYesChat ID (numeric) or @username of the channel/group
limitNoNumber of messages to fetch (default 20, max 100)
searchNoSearch query to filter messages
offset_idNoFetch messages before this message ID (for pagination)

TDQS

B3.4/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must disclose behavioral traits like idempotency, rate limits, or authentication needs. The description only states the basic operation (read messages) and does not mention if the tool is read-only, what happens on invalid chat IDs, or if pagination behavior (offset_id) has any side effects.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences long, concise and front-loaded with the core purpose. It avoids fluff but could combine the sentence about chat source into the first sentence for even tighter prose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no output schema, the description does not need to detail return fields. The parameter set is fully covered in schema. However, with no annotations, the description lacks behavioral context (e.g., is this a safe read operation?). Completeness is adequate for a simple read tool but not thorough.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has 100% description coverage, so parameters chat, limit, search, and offset_id are already documented with types, defaults, and descriptions. The description adds minimal value beyond restating that chat can be an ID or @username. With full schema coverage, baseline is 3.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description precisely states that the tool reads messages from a Telegram chat, channel, or group, specifying the source as a chat ID or @username. This clearly distinguishes it from sibling tools like send_message (write) and get_chat_info (metadata), and aligns with list_chats as a prerequisite.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description hints at usage by mentioning chat ID from list_chats, implying that one should first use list_chats to get the ID. However, it does not explicitly state when to use this over search_messages (which searches across chats) or how to handle channels vs. groups. No exclusions or alternatives are given.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

search_messagesB

Search for messages across all Telegram chats or within a specific chat.

ParametersJSON Schema
NameRequiredDescriptionDefault
chatNoOptional: limit search to this chat ID or @username
limitNoMax results (default 20)
queryYesSearch query

TDQS

B3.4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description must carry the behavioral burden. The description states the search scope (all chats or specific) and implies it is a read operation (search), but does not disclose details like whether it returns only text messages, if media is excluded, whether deleted chats are included, or rate limits. It is adequate but lacks depth for a search tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single concise sentence that states the tool's purpose and scope. It is front-loaded and efficiently uses words, but could be slightly more precise (e.g., specifying that search is by text content). No wasted words, but the brevity leaves some ambiguity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has 3 parameters (all with schema descriptions), no output schema, and no annotations, the description provides the core purpose but fails to guide on expected output, pagination behavior, or edge cases (e.g., empty results). It is complete enough for a basic search tool but leaves gaps for an agent to infer.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the baseline is 3. The description does not add any parameter semantics beyond what the schema already provides (e.g., no clarification on query syntax, whether chat is case-sensitive, or how limit interacts with pagination). It meets the baseline but does not exceed it.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool searches for messages across all Telegram chats or within a specific chat. The verb 'Search' and resource 'messages' are specific, and the scope (all chats vs. specific chat) is mentioned, which helps differentiate from siblings like read_messages which likely retrieves messages by other criteria. However, it does not explicitly contrast with sibling tools, so a perfect 5 is not warranted.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies when to use this tool (to search messages) but provides no explicit guidance on when not to use it or alternatives. Given sibling tools like read_messages and list_chats, there is no mention of how search_messages differs (e.g., keyword matching vs. retrieving recent messages). The usage context is implied but not elaborated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

send_messageB

Send a message to a Telegram chat, channel, or group.

ParametersJSON Schema
NameRequiredDescriptionDefault
chatYesChat ID (numeric) or @username
textYesMessage text to send
reply_toNoOptional: message ID to reply to

TDQS

B3.2/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It describes the action (send) and target types, which implies a write operation, but does not disclose any behavioral traits such as whether the message will be delivered immediately, rate limits, or if sending to a channel requires special permissions. A score of 3 is reasonable as it conveys basic behavior without harmful omissions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single short sentence that is front-loaded and to the point. It could be considered slightly under-specified, but it earns its place with no wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (3 parameters, no output schema, no nested objects), the description provides basic coverage. However, it lacks any mention of return values or response format (e.g., success/error), and with no output schema, the description should ideally hint at what the agent can expect back. This is a minor gap, resulting in a score of 3.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents the purpose of 'chat', 'text', and 'reply_to'. The description adds no additional meaning or nuance beyond the schema, so a baseline of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'send' and the resource 'message', and specifies the target types (chat, channel, group). However, it does not distinguish itself from siblings like 'read_messages' or 'list_chats', which have very different purposes.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is given on when to use this tool versus alternatives. For example, there is no mention that this should be used for sending new messages, while 'reply_to' parameter implies replying, but no comparison to other tools like 'search_messages' or 'get_chat_info'.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

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

  1. 5 tool updatesv1.0.0
    • First observedget_chat_info
    • First observedlist_chats
    • First observedread_messages
    • First observedsearch_messages
    • First observedsend_message

TDQS

A3.6/5.0

Scored across 5 tools

Disambiguation5/5

Each tool has a clear, non-overlapping purpose: listing chats, reading messages, searching, getting chat info, and sending messages. No ambiguity in tool selection.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern (e.g., list_chats, read_messages, send_message), making them predictable and easy to understand.

Tool Count5/5

With five tools, the server covers the core messaging actions without being too sparse or too heavy. Each tool serves a distinct and necessary function.

Completeness3/5

The tool set supports basic reading, searching, and sending text messages, but lacks critical operations like sending media, editing or deleting messages, and managing chats. This is a notable gap for a full-featured messaging server.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers