kurigram-mcp

kurigram-mcp

MCP server to debug Telegram bots by controlling your Telegram user session over MTProto. It enables sending messages, reading chats, handling updates, and invoking raw Telegram API methods.

Category
Visit Server

README

<div align="center">

๐Ÿค– kurigram-mcp

Debug Telegram bots with AI โ€” a local MCP server that drives your Telegram user session over MTProto.

PyPI Version Python Versions License

English ยท ็ฎ€ไฝ“ไธญๆ–‡

</div>


โœจ Features

๐Ÿ”Œ Standard MCP Streamable HTTP transport, 2026-07-28 protocol, backward-compatible with 2025-11-25 clients (Claude Code, Codex, DSH)
๐Ÿงช Bot debugging Send /start, measure reply latency, wait for events, drain update streams
๐Ÿ› ๏ธ Deep debugging raw_invoke any MTProto function, with built-in API discovery
๐Ÿ”’ Chat whitelist Per-client control via request header, fail-closed by default
โšก Stateless Server restarts don't break connected clients
๐Ÿš€ Zero config uv tool install, interactive setup wizard, one-command login

๐Ÿš€ Quick Start

# 1. Install (provides `kurigram-mcp` and the `km` alias)
uv tool install kurigram-mcp

# 2. One-time setup: API_ID / API_HASH / whitelist / proxy / port
#    AUTH_TOKEN is auto-generated if left blank (Bearer auth on by default)
km setup

# 3. Log in (skip if you chose to during setup): phone โ†’ code โ†’ 2FA
km auth

# 4. Start the server
km run     # default: http://127.0.0.1:8765/mcp

Get API_ID / API_HASH from my.telegram.org/apps. Login must be performed by you โ€” credentials never leave your machine.

๐Ÿงฐ Tools (22)

Group Tools
๐Ÿงพ Session whoami, mcp_get_server_info
๐Ÿ“ค Send send_message, send_photo, send_document, edit_message, delete_message, send_chat_action, start_bot, click_inline_button, send_reaction
๐Ÿ“ฅ Read get_chat, get_chat_history, get_messages, get_dialogs, search_messages, download_media
โฑ๏ธ Events wait_for_update, drain_updates
๐Ÿ”ฌ Deep raw_invoke, list_raw_methods, get_raw_method_info

Errors follow a stable [CODE] message format: NOT_WHITELISTED ยท FLOOD_WAIT {seconds} ยท SESSION_INVALID ยท RPC ยท NETWORK ยท INTERNAL.

๐Ÿ”Œ Client Setup

# Claude Code
claude mcp add --transport http kurigram-mcp http://127.0.0.1:8765/mcp \
  --header "Authorization: Bearer <AUTH_TOKEN>" \
  --header "X-Kurigram-Allowed-Chats: 6540476263"   # optional per-client whitelist
# Codex (~/.codex/config.toml)
[mcp_servers.kurigram-mcp]
url = "http://127.0.0.1:8765/mcp"
http_headers = { "Authorization" = "Bearer <AUTH_TOKEN>", "X-Kurigram-Allowed-Chats" = "6540476263" }
# DSH โ€” cordis.yml plugin row (@deepseek-ai/dsh-mcp-client)
- id: mcp-kurigram
  name: '@deepseek-ai/dsh-mcp-client'
  config:
    serverName: kurigram
    transport: streamable-http
    url: http://127.0.0.1:8765/mcp
    headers:
      Authorization: !!js '`Bearer ${process.env.KURIGRAM_TOKEN}`'
      X-Kurigram-Allowed-Chats: '6540476263'

๐Ÿ” Chat Whitelist

  1. Request header X-Kurigram-Allowed-Chats โ€” per-client declaration (comma-separated: numeric chat ids, @username, me).
  2. Config allowed_chat_ids โ€” fallback when the header is absent.

Fail-closed: chats outside the whitelist are rejected with [NOT_WHITELISTED]; get_dialogs only returns whitelisted chats.

โš™๏ธ Configuration

All configuration lives in one file: ~/.kurigram-mcp/config.yaml.

api_id: 123456
api_hash: your_hash
allowed_chat_ids: "123456789,me"   # fallback whitelist
host: 127.0.0.1
port: 8765
auth_token: auto_generated_or_yours # Bearer auth
proxy: ""                           # optional, e.g. socks5://127.0.0.1:1080

๐Ÿ“ Data & Files

~/.kurigram-mcp/
โ”œโ”€โ”€ config.yaml         # setup-generated config (chmod 600)
โ”œโ”€โ”€ u_{API_ID}.session  # Telegram session (bound to API_ID, persists)
โ””โ”€โ”€ downloads/          # download_media output

๐Ÿง‘โ€๐Ÿ’ป Development

uv sync
uv run pytest
uv run ruff check src tests scripts

# Configure like a regular user (shared ~/.kurigram-mcp):
uv run kurigram-mcp setup
# Or isolate a dev environment (never touches your real config):
# KURIGRAM_MCP_HOME=$PWD/.dev-home uv run kurigram-mcp setup
# KURIGRAM_MCP_HOME=$PWD/.dev-home uv run kurigram-mcp run

๐Ÿ“„ License

MIT

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
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
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
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