Tsgram MCPのロゴ

Tsgram MCP

組織
areweai

TSGram - Telegram MCP Server for local Claude Code integration - debug and vibe code on the go!

公開者areweai
リポジトリtsgram-mcp
言語JavaScript
フォーク
20
スター
89
利用可能なツール
0
通信方式stdio
ライセンスMIT
リンク
  • ツールをAIワークフローに接続

    Tsgram MCPは、対応するAIクライアントやAIエージェントから利用できるMCP機能を提供します。

  • 0個の利用可能なツール

    呼び出し可能なアクションを以下で確認できます。サーバーから提供されている場合は、名前や説明も表示されます。

  • コピーして使える設定

    セットアップ用の設定例を使って、お好みのMCPクライアントにこのサーバーを設定できます。

  • オープンソースの注目度

    リンク先のリポジトリには89件のスターと20件のフォークがあります。

TSGram MCP 🚀

Get Claude Code in your local project talking to Telegram in 3 minutes!

TSGram MCP connects Claude Code sessions to Telegram using TS/Node/Docker/cli-utils, enabling AI-powered code assistance directly in your Telegram chats. Ask questions about your codebase, get AI insights, and even edit files - all from Telegram on your phone!

🔒 How It Works (All Local)

  • Local Docker container runs the Telegram webhook server
  • TSGram MCP server runs locally
  • Your Claude Code or Claude Desktop runs locally and adds MCP locally
  • Create and delete bots in-app through Telegram, access limited to your telegram user id
  • Modern local web dashboard to manage bots from localhost
  • Local means local! If your computer is offline, so are your bots.

Quick Start (3 Minutes)

🤖 AI Agent Enhanced Setup (Recommended!)

Let Claude handle the entire setup and ask you for the required values.

From your terminal: 0. Install Docker Desktop and Node.js 20+ (npm included)

  1. Clone the repository:

    bash
    git clone https://github.com/areweai/tsgram-mcp.git
    cd tsgram-mcp
  2. From the command line, start Claude:

    bash
    claude --model sonnet
  3. Initialize with /init

  4. Copy and paste this prompt:

    First, explain to the human how to register a new Telegram bot with @BotFather and get their bot token (TELEGRAM_BOT_TOKEN), and how to get their Telegram user ID from @userinfobot (for AUTHORIZED_CHAT_ID). They can work on getting these credentials while you set up the system. Then help the user set up tsgram-mcp for claude code. Do everything from installing node modules to creating and deploying the local docker containers. Finally, when everything is deployed, remind the user to configure their bot token and authorized chat ID along wither other required .env variables.

Make sure you replace the TELEGRAM_BOT_TOKEN and AUTHORIZED_CHAT_ID placeholders with the actual values.

In order to retrieve those values, you will have to message the following Telegram bots and follow their instructions:

The AI will then handle all the setup steps for you, including:

  • Installing dependencies
  • Configuring environment variables
  • Building Docker containers
  • Starting services
  • Guiding you through bot registration
  • Setting up the MCP server (and allow you to extend functionality locally)

CLI no-AI Alternative If Hitting LLM troubles: Setup Shell Script Run from your project root:

bash
# One-line install (macOS/Linux)
curl -sSL https://raw.githubusercontent.com/areweai/tsgram-mcp/main/setup.sh | bash

# Or if you prefer to review first:
curl -sSL https://raw.githubusercontent.com/areweai/tsgram-mcp/main/setup.sh > setup.sh
chmod +x setup.sh
./setup.sh

Adding TSGram to an Existing Project:

If you already have a project and want to add TSGram as an MCP server:

  1. From your existing project root:

    bash
    git clone https://github.com/areweai/tsgram-mcp.git .tsgram-mcp
    cd .tsgram-mcp
  2. Use Claude to set it up:

    bash
    claude model --sonnet
    /init
  3. Paste this prompt:

    "First, explain to the human how to register a new Telegram bot with @BotFather and get their bot token (TELEGRAM_BOT_TOKEN) from @UserBotInfoBot, and how to get their Telegram user ID from @userinfobot (for AUTHORIZED_CHAT_ID). They can work on getting these credentials while you set up the system. Then help me add TSGram MCP to my existing project in the parent directory. Set up the Docker containers and MCP configuration so I can use Telegram to interact with my project files. The project root is one level up from here."

This will configure TSGram to work with your existing project structure (and allow you to extend functionality locally).

Test Your Bot! 🎉

IMPORTANT: You will need to message your bot first before it can message you.

Send your bot a message and ask it something about your local project!

⚠️ Security Note: TSGram has basic safeguards to not list, preview, or serve .env files but it is still strongly recommended that you do not use TSGram for anything highly sensitive as third party servers are part of the transport layer.

📊 Web Dashboard

Monitor and manage your bots through the beautiful web dashboard at http://localhost:3000:

The dashboard provides:

  • Real-time bot status and activity monitoring
  • System health indicators (MCP server, AI model, API keys)
  • Bot management - create, test, and monitor Telegram bots
  • Activity logs - track messages, responses, and system events
  • Quick actions - send test messages and manage bot configurations
  • run from local - npm run dashboard to view (chrome recommended)

📋 You Will Need

  • Docker Desktop
  • Node.js 20+ (npm included)
  • Telegram on a phone
  • Claude Desktop or Claude Code (CLI)
  • An OpenRouter API key (We recommend creating a new API key with a $1.00 limit. Trust, but limit!)
  • Chrome (Optional but highly recommended for local management UI)

Manual Setup Steps

1. Get Your Bot Token & User ID

  1. Create Bot: Message @BotFather on Telegram
  2. Send /newbot and follow prompts
  3. Copy your bot token (keep this secret!)
  4. Get Your User ID (IMPORTANT): Message @userinfobot
    • This returns your numeric user ID (e.g., 123456789)
    • Use the user ID, NOT your username for security (usernames can be changed)

2. Configure Environment

Edit .env with your values:

env
TELEGRAM_BOT_TOKEN=your_bot_token_here
# CRITICAL: Use your numeric user ID from @userinfobot, not your username!
AUTHORIZED_CHAT_ID=123456789  # Your numeric user ID from step 1

# Choose ONE AI provider:
OPENROUTER_API_KEY=your_openrouter_key  # For Claude (recommended with $1 limit)
# OR
OPENAI_API_KEY=your_openai_key         # For GPT-4

Security Note: The bot now uses your numeric user ID instead of username for authorization. This is more secure because:

  • User IDs never change
  • Usernames can be changed by users
  • User IDs cannot be guessed or easily discovered

3. Start TSGram

bash
npm install
npm run docker:build
npm run docker:start

🎯 Key Features

  • "Stop" and "Start" commands in TSGram bot chat provide convenient output control
  • Select subset of unix commands supported (:h ls or :h cat $FILE)
  • Opt-in edit mode for vibe coding and debugging on the go (:dangerzone to enable)
  • AI-Powered Responses: Uses Claude 3.5 Sonnet or GPT-4
  • Code Understanding: Reads and analyzes your entire codebase
  • Web Dashboard: Monitor bots at http://localhost:3000

💬 Bot Commands

  • Regular messages: Get AI responses about your code
  • :h - Show help and available commands
  • :h ls [path] - List files in directory
  • :h cat filename - View file contents
  • :dangerzone - Enable file editing (careful!)
  • :safetyzone - Disable file editing
  • stop - Pause bot responses
  • start - Resume bot responses

🛠️ Common Commands

bash
# View logs
npm run docker:logs

# Check health
npm run docker:health

# Stop services
npm run docker:stop

# Rebuild after changes
npm run docker:rebuild

# Access dashboard (Chrome recommended)
npm run dashboard

📜 Useful Scripts

The project includes several helper scripts in the scripts/ directory:

Setup & Configuration

  • setup.sh - Automated install script (can be run via curl)
  • configure-mcp.sh - Configure MCP settings for Claude Desktop/Code
  • fix-permissions.sh - Fix file permissions if needed

Updates & Maintenance

  • update-system.sh - Update TSGram to latest version
  • update-ai-context.sh - Update AI context files

Testing & Debugging

  • test-api-keys.sh - Verify your API keys are working
  • test-docker-setup.sh - Test Docker configuration

Run any script with:

bash
./scripts/script-name.sh
# or
npm run script-name  # for npm-wrapped scripts

🔧 Advanced Setup

Using with Claude Code

Add to your Claude Code MCP settings:

json
{
  "tsgram": {
    "command": "docker",
    "args": ["exec", "-i", "tsgram-mcp-workspace", "npx", "tsx", "src/mcp-server.ts"],
    "env": {
      "TELEGRAM_BOT_TOKEN": "your_bot_token_here",
      "AUTHORIZED_CHAT_ID": "123456789"
    }
  }
}

Note: Replace 123456789 with your actual numeric user ID from @userinfobot

MCP Compatibility

TSGram uses the standard Model Context Protocol (MCP) format and should be compatible with any MCP-supporting IDE or tool. Tested with:

  • ✅ Claude Code CLI
  • ✅ Claude Desktop

Should work with (standard MCP format):

  • Cursor IDE
  • GitHub Copilot
  • Other MCP-compatible editors

Use the same Docker configuration pattern shown above, adapting the syntax for your specific MCP client.

CLI-to-Telegram Bridge

Forward Claude Code CLI responses to Telegram:

bash
# Setup global command (may prompt for sudo password to create npm global install /usr/local/bin/claude-tg)
npm run setup

# Use instead of 'claude'
claude-tg "analyze this codebase"

🚨 Troubleshooting

Bot not responding?

bash
# Check if services are running
npm run docker:health

# View logs for errors
npm run docker:logs

Can't connect to bot?

  1. Verify bot token is correct in .env
  2. Check your user ID: Make sure AUTHORIZED_CHAT_ID is your numeric user ID (not username)
  3. Make sure you messaged the bot first
  4. If you get "authorization not configured" error, set AUTHORIZED_CHAT_ID in your .env file

File edits not working?

  • Type :dangerzone to enable (one-time)
  • Check logs for permission errors
  • Ensure Docker has file access

📚 Project Structure

tsgram/
├── src/
│   ├── telegram-bot-ai-powered.ts    # Main bot logic
│   ├── telegram-mcp-webhook-server.ts # MCP integration
│   └── models/                        # AI providers
├── docker-compose.tsgram-workspace.yml # Main Docker config
├── .env.example                       # Environment template
└── data/                             # Persistent storage

🤝 Contributing

PRs welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Add tests if applicable
  4. Submit a pull request

📄 License

MIT - Feel free to use in your own projects!


Need help? Open an issue on GitHub or message your bot with questions!

Tsgram MCPのMCPを複数のAIモデルで活用

TypingMindはワークスペース単位でMCPツールに接続します。そのため、一度Tsgram MCPに接続すれば、モデルごとに個別に設定することなく、TypingMind内のさまざまなAIモデルで利用できます。 このMCPは、デバイス上のTypingMind MCPコネクタを通じてローカルで動作します。

ローカルコネクタのセットアップガイド

MCPサーバーが、お使いのコンピューター上のローカルファイル、アプリ、非公開リソースにアクセスする必要がある場合は、この方法を使います。

1

MCP設定を開く

TypingMindで「設定」、「詳細設定」、「MCP」の順に進み、「コネクタを設定」を選択してください。

  1. ブラウザでTypingMindを開いてください。
  2. 設定アイコンをクリックしてください。
  3. 「詳細設定」に移動してください。
  4. 「MCP」セクションを開いてください。
  5. 「コネクタを設定」をクリックし、「このデバイス」を選択してください。
「このデバイス」が選択されたTypingMindのMCPコネクタ設定画面
2

コネクタのコマンドを実行

「このデバイス」を選択し、TypingMindからコマンドをコピーしてターミナルで実行してください。MCPの使用中は、プロセスを実行したままにしてください。

  1. TypingMindに表示されるセットアップコマンドをコピーしてください。
  2. macOSではターミナルを、WindowsではWindows Terminalを開いてください。
  3. コマンドを貼り付けて実行してください。
  4. ターミナルで続行の確認を求められた場合は、パッケージのインストールを承認してください。
  5. MCPツールの使用中は、ターミナルウィンドウを開いたまま、プロセスの実行を継続してください。
3

Tsgram MCPをサーバーとして追加

コネクタのステータスが「準備完了」になったら、「サーバーを編集」をクリックし、MCPサーバーの設定を貼り付けてください。

  1. コネクタのステータスが「準備完了」になるまでお待ちください。
  2. 「サーバーを編集」をクリックしてください。
  3. Tsgram MCPのMCPサーバー設定を貼り付けてください。
  4. サーバー一覧を保存してください。
  5. コネクタが引き続き使用可能か確認するには、更新してください。
稼働中のサーバーと「サーバーを編集」ボタンが表示されたTypingMindのMCP設定画面
{
  "mcpServers": {
    "tsgram-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

複数のモデルで同じ接続を使用

サーバー一覧を保存し、「プラグイン」を開いてTsgram MCPのMCPツールを有効にしてください。その後、TypingMindで対応するAIモデルを選択し、チャットでツールを使うか、AIエージェントに割り当ててください。

  1. TypingMindの「プラグイン」ページを開いてください。
  2. Tsgram MCPのMCPツールを有効にしてください。
  3. チャットを開始し、使用するAIモデルを選択してください。
  4. MCPツールをチャットで使うか、AIエージェントに割り当ててください。
  5. MCPに再接続することなく、必要に応じて別のAIモデルに切り替えられます。
選択したAIモデルと有効なMCPツールを使用したTypingMindのチャット
Tsgram MCPを使ってこのタスクを手伝ってもらえますか?
Tsgram MCP
はい、読みました。
Tsgram MCPで調べた結果をお伝えします。

よくある質問

Tsgram MCP MCPサーバーは何に使いますか?

Tsgram MCPは、対応するAIクライアントを外部ツールやコンテキストに接続するためのMCPサーバーです。TypingMindでは、このMCPサーバーを一度追加するだけで、AIワークスペース内でそのツールを利用できるようになります。

TypingMindでTsgram MCP MCPを複数のAIモデルと併用できますか?

はい。TypingMindはワークスペース単位でMCPツールに接続するため、モデルごとにMCPサーバーを設定する必要はありません。Claude、ChatGPT、Geminiや、TypingMindで設定したその他のAIモデルでTsgram MCPを利用できます。

TypingMindでTsgram MCP MCPを使うメリットは何ですか?

TypingMindは、複数のAIモデル、プロンプト、プラグイン、AIエージェント、APIキー、MCPツールを1つのワークスペースにまとめられる、LLMチャット向けの優れたフロントエンドです。Tsgram MCPを接続すると、TypingMindでチャットのワークフローを整理しながら、お好みのモデルでそのMCPツールを利用できます。

Tsgram MCP MCPをTypingMindに接続するにはどうすればよいですか?

Tsgram MCPはTypingMindのローカルMCPコネクタ経由で動作します。MCPサーバーがコンピューター上のローカルファイル、デスクトップアプリ、コマンドラインツール、プライベートリソースにアクセスする必要がある場合に最適です。

TypingMindでTsgram MCP MCPのどのようなツールを利用できますか?

Tsgram MCPはMCP機能を提供しています。TypingMindのプラグインページで有効にすると、チャットで使用したり、AIエージェントに割り当てたりできます。

Tsgram MCP MCPを使うには、APIキーをTypingMindと共有する必要がありますか?

いいえ。TypingMindはローカルファーストの設計で、モデルプロバイダー、APIキー、プロンプト、MCP設定をご自身で管理できます。Tsgram MCPで認証が必要な場合は、接続の作成時に、そのMCPサーバーに必要なヘッダー、OAuth設定、またはローカル設定を追加してください。

関連するMCPサーバー

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇