Telegram MCP Server
Enables sending and receiving Telegram messages through MCP clients like Claude Desktop and Gemini Spark.
README
Telegram MCP Server
Gemini Spark や Claude Desktop などの MCP(Model Context Protocol)クライアントから、Telegram メッセージの送受信を行えるようにするための MCP サーバーです。
前提条件
動作には Node.js が必要です。
-
Node.js のインストール:
- まだインストールされていない場合は、Node.js 公式サイト から LTS 版をダウンロードしてインストールしてください。
- インストール完了後、コマンドプロンプトや PowerShell を再起動し、
node -vおよびnpm -vが動作することを確認してください。
-
Telegram Bot の作成:
- Telegram アプリ内で @BotFather を検索し、
/newbotコマンドを使用して新しい Bot を作成します。 - 作成後に表示される HTTP API Token(例:
123456789:ABCdefGhIJKlmNoPQRsTUVwxyZ)を控えておきます。
- Telegram アプリ内で @BotFather を検索し、
セットアップ手順
-
リポジトリディレクトリに移動し、依存関係をインストールします:
npm install -
環境変数の設定:
- ディレクトリ内の
.env.exampleを.envにコピーします。
copy .env.example .env.envファイルを開き、控えておいたTELEGRAM_BOT_TOKENを設定します。
TELEGRAM_BOT_TOKEN=ここにBotのトークンを貼り付け TELEGRAM_DEFAULT_CHAT_ID=(任意)デフォルトの宛先チャットID※
TELEGRAM_DEFAULT_CHAT_IDを指定しておくと、ツール呼び出し時にチャットIDを省略した場合に自動的にそのチャットに送信されます。 - ディレクトリ内の
-
ビルドの実行: TypeScript を JavaScript にコンパイルします。
npm run build
サーバーの起動とMCPクライアントへの登録方法
1. サーバーの起動
ローカルで起動する場合は、依存関係をインストール、ビルドした後に以下のように起動します。
npm start
デフォルトではポート 3000 でサーバーが起動し、以下のエンドポイントが利用可能になります。
- SSEエンドポイント:
http://localhost:3000/sse
ポート番号を変更したい場合は、環境変数 PORT を指定して起動するか、.env ファイルに PORT=8080 のように追記してください。
2. MCP クライアントへの登録
Claude Desktop の場合
設定ファイル(例: AppData\Roaming\Claude\claude_desktop_config.json)に以下のように SSE サーバーを追加します。
{
"mcpServers": {
"telegram-mcp": {
"type": "sse",
"url": "http://localhost:3000/sse"
}
}
}
Gemini Spark 等のクライアントの場合
クライアントの設定画面で SSE トランスポートを選択し、URL に http://localhost:3000/sse を指定して登録します。
提供ツール
1. telegram_get_me
- 概要: Bot自身のアカウント情報を取得します。接続確認テストに便利です。
- パラメータ: なし
2. telegram_send_message
- 概要: 指定した
chat_idにメッセージを送信します。 - パラメータ:
text(string, 必須): 送信するメッセージ。chat_id(string, 任意): 送信先チャットIDまたはユーザー名(例:@my_channel)。指定しない場合は.envのデフォルトIDが使用されます。parse_mode(string, 任意): 書式設定モード(Markdown,HTML,MarkdownV2から選択)。
3. telegram_get_updates
- 概要: Bot宛ての最新メッセージ(アップデート)を取得します。
- パラメータ:
offset(number, 任意): 取得開始位置となるアップデートID。limit(number, 任意): 一度に取得する最大件数(1〜100、デフォルト100)。timeout(number, 任意): ロングポーリングのタイムアウト秒数。
Recommended Servers
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.
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.
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.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
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.
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.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
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.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.