Skip to main content

Telegram Dev

Tests PyPI Docs monitor License: MIT

Current official Telegram and TON documentation for Claude Code, Codex and Cursor.

Telegram Dev is an MCP server plus an agent skill. The server fetches, indexes and searches the official docs and keeps them fresh: Bot API, Mini Apps, MTProto, TDLib, and on the TON side docs.ton.org (TON Connect, Tolk, TVM, APIs), the TEP standards and the changelogs. The skill teaches the agent to pick the right API, follow Telegram's rules, check library support, and cite what it read.

Русская версия

Why

Telegram ships a new Bot API version every month or two. A model's knowledge of it stops at its training cutoff, so agents confidently write code against fields that changed or never existed. They also mix up the Bot API, MTProto and TDLib, which have very different capabilities.

TON moves just as fast. The current TON docs call the coin Gram, describe Telegram Money, the wallet built into Telegram, and treat Tolk as the main contract language with FunC as legacy. On top of that, Telegram has its own rules: blockchain features in Mini Apps must use TON and TON Connect, and digital goods are sold for Stars.

With Telegram Dev the agent reads the current page before it writes code. A real Codex CLI run in a fresh project after uvx telegram-dev install --agent codex (tool calls trimmed):

> Use the telegram-dev skill. In a python-telegram-bot project, I want the inline
  'Delete' button to be red and show a custom emoji. Which Bot API fields do this,
  what are the requirements, and what does the request JSON look like?

  telegram_corpus_status {}
  search_telegram_docs {"query": "style icon_custom_emoji_id", "area": "releases"}
  search_telegram_docs {"query": "InlineKeyboardButton icon_custom_emoji_id style", "area": "bot-api"}
  get_telegram_document {"url": "https://core.telegram.org/bots/api", "offset": 167594, "length": 10500}
  get_telegram_document {"url": "https://core.telegram.org/bots/api-changelog", "offset": 39089, "length": 6000}

Use these InlineKeyboardButton fields:
- style: "danger" makes the button red.
- icon_custom_emoji_id is a custom emoji ID shown before "Delete".
- callback_data is your action identifier, 1-64 bytes.

The custom emoji requires either a bot that bought additional usernames on Fragment,
or a Premium bot owner with the message sent by the bot to a private chat, group or
supergroup. PTB 22.7+ supports both fields. Older Telegram clients show the button
unstyled. Source: https://core.telegram.org/bots/api#inlinekeyboardbutton

{"chat_id": 123456789, "text": "Choose an action:",
 "reply_markup": {"inline_keyboard": [[{"text": "Delete", "callback_data": "delete:42",
   "style": "danger", "icon_custom_emoji_id": "YOUR_CUSTOM_EMOJI_ID"}]]}}

The skill also knows when not to reach for a blockchain. Another real Codex run:

> Use the telegram-dev skill. Our Telegram Mini App sells a premium in-game skin
  for 2 TON. I want a Buy button that connects the user's wallet and charges them.

  get_telegram_document {"url": "https://core.telegram.org/bots/payments-stars", "refresh": true}
  search_telegram_docs {"query": "createInvoiceLink answerPreCheckoutQuery successful_payment XTR", "area": "bot-api"}
  get_telegram_document {"url": "https://docs.ton.org/applications/ton-connect/overview", "refresh": true}
  get_telegram_document {"url": "https://core.telegram.org/bots/webapps", "offset": 40310}

Use Telegram Stars (XTR) through the Bot API. The skin is a digital good, so
Telegram requires Stars and prohibits cryptocurrency payment for this purchase.
For permitted wallet features, use the TON Connect SDK.
1. Validate initData on the backend and bind the order to the user.
2. createInvoiceLink with currency "XTR", open it with Telegram.WebApp.openInvoice.
3. Answer pre_checkout_query, grant the skin once on successful_payment,
   store telegram_payment_charge_id for refunds.

Install

You need uv. No bot token, Telegram account or API key is needed: the server only reads public documentation.

MCP server and skill, one command

Run this in your project directory:

uvx telegram-dev install --agent claude    # or: codex, cursor
--agent MCP server is added to Skill is copied to
claude .mcp.json .claude/skills/telegram-dev
codex .codex/config.toml .agents/skills/telegram-dev
cursor .cursor/mcp.json .cursor/skills/telegram-dev

The installer keeps your other settings, backs up the files it changes and never overwrites an existing Telegram Dev setup. The server is pinned to the installed version, so nothing has to stay on disk besides the uv cache. Open a new agent session afterwards and approve the project MCP server when asked. Codex loads project settings only after you trust the project directory.

To upgrade later: uvx telegram-dev@latest install --agent claude --update.

Claude Code plugin

/plugin marketplace add Kay0k1/telegram-dev
/plugin install telegram-dev@telegram-dev-tools

This adds the skill and the MCP server for all your projects. Use either the plugin or the installer, not both.

MCP server only

claude mcp add --scope user telegram-knowledge -- uvx telegram-dev serve
codex mcp add telegram-knowledge -- uvx telegram-dev serve

Cursor: Add to Cursor

Any other MCP client:

{
  "mcpServers": {
    "telegram-knowledge": { "command": "uvx", "args": ["telegram-dev", "serve"] }
  }
}

The tools work without the skill, but the skill is what makes an agent use them consistently.

Tools

Tool What it does
search_telegram_docs Full-text search over indexed sections, optionally limited to one area: bot-api, mini-apps, telegram-api, tdlib, ton, releases, ton-releases and others
get_telegram_document Reads an official page in pages of up to 40,000 characters; fetches it if it is missing or older than 6 hours
telegram_corpus_status What is indexed, how fresh it is and which sources failed
telegram_document_history Revisions of a page captured by this installation
telegram_sources The 57 official entry points, grouped by API area

The cache starts empty. Pages are fetched the first time the agent reads them and indexed right away. To pre-fetch everything reachable from the configured sources:

uvx telegram-dev sync --max-pages 0
uvx telegram-dev search "sendVideoNote"
uvx telegram-dev status

What the skill covers

Area What the agent checks
Bot API Messages, keyboards, updates, webhooks, files, permissions
Formatting and emoji Entities, UTF-16 offsets, custom emoji and who may use them
Media and stickers Voice messages, video notes, sticker sets, file limits
Mini Apps JS bridge, launch parameters, themes, server-side initData validation
MTProto and TDLib User vs bot authorization, schema and layers, TDLib versions
Business and payments Business connections, Stars, subscriptions, gifts, paid media
Groups and channels Admin rights, forums and topics, moderation
TON Telegram's blockchain rules for Mini Apps, Stars vs crypto, TON Connect and ton_proof, payment processing, jettons and NFTs (TEPs), Tolk contracts, testnet first, key safety
Releases Bot API changelog, API layers, TDLib changelog, TON node and Tolk changelogs, official announcements

The skill lives in skills/telegram-dev, with one reference file per area.

How fresh the docs are

  • Reading a page older than 6 hours re-fetches it. Search re-fetches up to six stale matching pages.
  • While the server runs, a background cycle checks up to 120 pages every 6 hours: entry points, newly found links, oldest pages.
  • If Telegram's site is unreachable, the cached text is kept and marked stale with the error, so the agent knows it is reading an old copy.
  • A daily GitHub Action checks all 57 official sources and publishes hashes and errors on the docs-status branch.

Settings such as the cache path (TELEGRAM_KNOWLEDGE_DB) and refresh intervals are in docs/runtime.md.

Self-hosting

The server also runs over Streamable HTTP, so a team can share one cache. A Dockerfile and a Caddy setup with HTTPS are included: docs/deployment.md.

uvx telegram-dev serve --transport streamable-http --port 8000

Limits

  • Search is local full-text search (SQLite FTS5), not semantic search. Exact method names and English terms work best. A small set of Russian aliases is built in.
  • Coverage is what can be reached from the 57 official entry points. TON pages come from the llms.txt index that docs.ton.org publishes for agents, so new TON pages are picked up automatically. Page history starts when your installation first fetched the page.
  • The server does not log in to Telegram, send messages, touch chats or hold wallet keys. It only reads public pages.
  • The skill improves how agents work. It does not guarantee a correct answer: check the code against Telegram before shipping.

Development

git clone https://github.com/Kay0k1/telegram-dev && cd telegram-dev
uv sync --frozen
uv run --frozen python -m unittest discover -s tests -v
uv run --frozen telegram-dev install --agent claude --project /path/to/test-project

CI runs the tests on Linux, macOS and Windows and checks the Docker image. docs/validation.md lists what has been verified by hand and what has not. Issues and pull requests are welcome; tests/behavioral-cases.json has agent scenarios that still need runs in each client.

License

MIT for the code and the skill. Fetched Telegram and TON documentation remains with its owners; the package does not bundle it (NOTICE). This is an independent project, not affiliated with Telegram or the TON Foundation.

Metadata

Release files for telegram-dev 0.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for telegram-dev 0.5.1
File Size Uploaded Provenance Actions
telegram_dev-0.5.1.tar.gz 161.6 kB With provenance Details for telegram_dev-0.5.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for telegram-dev 0.5.1
File Interpreter ABI Platform Actions
telegram_dev-0.5.1-py3-none-any.whl Python 3 none any Details for telegram_dev-0.5.1-py3-none-any.whl

Total release size: 211.4 kB

Release files / telegram_dev-0.5.1.tar.gz

Download URL telegram_dev-0.5.1.tar.gz
Size 161.6 kB
Tags Source
SHA-256 checksum
How to use checksums
0196c9a7f6853c7d0c46410081da48149dd6bc54f5f4ed920bfabcdef8490b76
BLAKE2b-256 checksum
How to use checksums
d750cd4c3711a97daf467483c529e1d10d62767a9bb9900a1343b0e14fdc42c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

Release files / telegram_dev-0.5.1-py3-none-any.whl

Download URL telegram_dev-0.5.1-py3-none-any.whl
Size 49.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
558c86edc03851ea9196132741f312d9725b198be67534f4e4da26bde8aaabc9
BLAKE2b-256 checksum
How to use checksums
7460601ab94d60c0d4db895382f5c357921ef898d2adaf2097de9a129ba15494
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

Security for telegram-dev 0.5.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for telegram_dev-0.5.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page