telegram-dev
A documentation and Bot API validation server for Telegram/TON development, usable by AI agents.
Search official Telegram, TON, and bot-library documentation by query and area.
Read official documentation pages in paginated windows, with cache freshness and revisions.
Inspect cache coverage, source entry points, cached pages, and observed page changes.
Look up structured Bot API method/type definitions, including parameters, fields, allowed values, limits, and related changelog entries.
Validate individual Bot API calls for unknown, missing, wrong, retired, or out-of-range parameters and values.
List Bot API changelog entries by version or by method/type/field name.
Check an entire local Python Telegram bot project for Bot API issues in one run, without executing the code.
Provides AI agents with Telegram API documentation and development guidance, covering Bot API, Telegram API/MTProto, TDLib, Mini Apps, buttons, custom emoji, and media features.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@telegram-dev Check the Bot API docs and implement a red inline button with custom emoji."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Telegram Dev
Keep Telegram bots and AI coding agents on the current Bot API.
Telegram changes the Bot API every month or two, and both code and models fall behind. Telegram Dev has three parts:
telegram-dev checkreads a Python bot (aiogram, python-telegram-bot, pyTelegramBotAPI or raw HTTP calls) and lists Bot API calls with retired parameters or invalid values. It runs in a terminal, in CI as a GitHub Action, or as an agent tool.Bot API tools for agents: method and type definitions, a request checker and the changelog by version, built from the official pages.
A documentation server and skill for Claude Code, Codex and Cursor: search over the official Telegram and TON docs (Bot API, Mini Apps, MTProto, TDLib, bot libraries, TON Connect, Tolk), refreshed automatically.
No Telegram account, bot token or API key is needed: everything reads public documentation.
Check a bot project
telegram-dev check checks every Bot API call in a Python bot — aiogram, python-telegram-bot, pyTelegramBotAPI or raw HTTP requests to api.telegram.org — in one run, and prints only the findings:
uvx telegram-dev check ./my-bot$ uvx telegram-dev check ./tutorial # a popular open-source aiogram 3 tutorial
code/03_buttons/bot.py:79: warning: types.KeyboardButton: `request_user` was retired in Bot API 7.0: Renamed the field request_user in the class KeyboardButton to request_users. The old name will still work for backward compatibility. ...
code/08_inline_mode/handlers/inline_mode.py:48: warning: inline_query.answer: `switch_pm_text` was retired in Bot API 6.7: ... replacing the parameters switch_pm_text and switch_pm_parameter of the method answerInlineQuery with the parameter button of type InlineQueryResultsButton. ...
Bot API 10.4; 95 files with bot code; libraries: aiogram ==3.14.0 ==3.7.0 >=3.24.0 ...; 0 errors, 5 warningsA wrong value is an error, for example InlineKeyboardButton(text="Delete", style="red") gives style: must be one of danger, success, primary.
Errors are values outside the documented list and unknown methods or parameters in raw API requests. Warnings are parameters Telegram retired (with the version and the changelog entry that replaced them), keyword arguments that are neither Bot API parameters nor known library options, and bot methods with no Bot API counterpart. It reads code without running it, so it does not follow variables or check required parameters. Options: --json, --exclude 'tests/*', --strict (fail on warnings), --format github. In an agent session the same check is the check_telegram_project tool (local stdio server only, since it reads files).
On a GitHub repository, run it on every pull request; findings appear as annotations on the changed lines:
# .github/workflows/telegram.yml
on: [pull_request]
jobs:
bot-api:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Kay0k1/telegram-dev@v0.9.0
with:
path: .
exclude: "tests/*"Related MCP server: telegram-bot-mcp
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
| MCP server is added to | Skill is copied to |
|
|
|
|
|
|
|
|
|
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-toolsThis 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 servecodex mcp add telegram-knowledge -- uvx telegram-dev serveCursor:
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.
Current docs for agents
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?
get_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.Tools
Tool | What it does |
| Full-text search over indexed sections, optionally limited to one area: |
| Reads an official page in pages of up to 40,000 characters; fetches it if it is missing or older than 6 hours |
| What is indexed, how fresh it is and which sources failed |
| Revisions of a page captured by this installation |
| The 61 official entry points, grouped by API area |
| Pages already stored in the local cache, by area, with freshness |
| One Bot API method or type as structured data: parameters or fields, types, required flags, allowed values, length limits, and the changelog entries that mention it |
| Checks a request your code sends against the current Bot API schema: unknown methods and parameters (with suggestions), missing required ones, wrong types, values outside the documented list, retired parameters with the version that replaced them |
| Official Bot API changelog as structured releases, filtered by version ( |
| Checks every Bot API call in a local Python bot project in one run (see Check a bot project); local stdio server only |
Checking Bot API calls
The Bot API tools are built from the official API page and changelog in the cache, so they follow Telegram's current version (Bot API 10.4 at the time of writing) without a hand-written schema. For example, check_bot_api_call on
{"method": "sendMessage", "params": {"chat_id": 1, "text": "Delete?", "reply_to_message_id": 42,
"reply_markup": {"inline_keyboard": [[{"text": "Delete", "callback_data": "del", "style": "red"}]]}}}returns an error for reply_markup.inline_keyboard[0][0].style (must be one of danger, success, primary) and a warning that reply_to_message_id was replaced by reply_parameters in Bot API 7.0. It does not call Telegram, so permissions, chat state and file contents still need a real test.
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 statusWhat 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 |
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 |
Bot libraries | aiogram, python-telegram-bot and grammY: the library docs that match the installed version, compared with the Bot API page; says when the indexed docs describe another version |
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 61 official sources and publishes hashes and errors on the
docs-statusbranch.
Settings such as the cache path (TELEGRAM_KNOWLEDGE_DB) and refresh intervals are in docs/runtime.md.
How much it helps
Measured with Codex CLI on 11 questions and 10 code-writing tasks (evals):
With Codex's own web access, answers were equally correct with and without Telegram Dev: the agent found the same official pages itself.
Without web access, answers stayed current with Telegram Dev (45/47 rubric facts against 38/47, 26/26 code checks against 23/26); plain Codex did not know the newest Bot API features or TON's current names.
So the documentation server matters most where the agent cannot browse. The project check works on your code rather than on a question, so it is useful either way. Run on open-source bots from GitHub, it mostly finds disable_web_page_preview and reply_to_message_id, retired in Bot API 7.0, which Telegram and the libraries still accept for compatibility. Details, including the review for false positives: docs/validation.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 8000Limits
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 61 official entry points. TON pages come from the
llms.txtindex that docs.ton.org publishes for agents, so new TON pages are picked up automatically.Bot libraries: guides and bot-facing references of aiogram (
latest, built from its main branch), python-telegram-bot (stabledocs and the official wiki) and grammY (English guides and plugins), about 250 pages. Generated per-type pages that mirror the Bot API, grammY's/ref/and translations are not indexed; released aiogram and PTB versions (/en/vX.Y.Z/) can be read on demand. Telegraf, Telethon and Pyrogram are not indexed. 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-projectCI 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.
Available Tools
10 toolscheck_bot_api_callCheck a Bot API callARead-onlyIdempotent
Check a Bot API request against the current official schema before running or shipping code.
Reports errors (unknown method or parameter with suggestions, missing required parameters, wrong types, values outside the documented list, a wrong type in union objects such as InputMedia) and warnings (lengths outside documented limits, parameters retired in an older Bot API version with the changelog entry that replaced them, numbers or booleans sent as strings). It does not call Telegram and cannot check permissions, chat state or file contents. Returns valid (true when there are no errors), errors and warnings as lists of {path, message} where path points into params (for example reply_markup.inline_keyboard[0][0].style), plus url, bot_api_version and freshness. An unknown method returns valid: false with suggestions. Use get_bot_api_definition to read the definitions it checks against.
Inputs: method (required), params (required).
check_telegram_projectCheck a bot projectARead-onlyIdempotent
Check every Bot API call in a Python bot project (aiogram, python-telegram-bot, pyTelegramBotAPI, raw HTTP requests) against the current official schema in one run.
Use it after changing an existing bot, before an upgrade, or when asked to review a bot: it reads the whole project locally and returns only findings, so the documentation does not have to enter the context. Errors: values outside the documented list (for example style="red"), unknown methods or parameters in raw API requests. Warnings: parameters Telegram retired, with the Bot API version and changelog entry that replaced them; keyword arguments that are neither Bot API parameters nor known library options; bot methods with no Bot API counterpart. It does not run code, follow variables or check required parameters. Returns findings ({file, line, severity, call, message}), errors, warnings, files_scanned, declared libraries with versions and bot_api_version. To check one request instead use check_bot_api_call. The same check runs in a shell or CI as telegram-dev check PATH.
Inputs: path (required), exclude, max_findings.
get_bot_api_definitionBot API method or type definitionARead-onlyIdempotent
Return the current definition of one Bot API method or type as structured data.
Use it instead of reading the whole Bot API page when you need a method's parameters or a type's fields: each entry has its type, whether it is required, the description and any allowed values or length limits stated by Telegram, plus the changelog entries that mention it. For behaviour explained in prose elsewhere (formatting, payments, limits pages) use search_telegram_docs and get_telegram_document. Returns kind (method or type), name, url, description, then params (methods; with returns) or fields (types; or one_of for union types), plus changes, bot_api_version, source, checked_at and freshness. An unknown name returns kind: null with close-match suggestions. Built from the cached official page, refreshed when stale.
Inputs: name (required).
get_telegram_corpus_statusCache coverage and freshnessARead-onlyIdempotent
Report how complete and how current the local documentation cache is, as totals.
Use it at the start of a task or when search results look incomplete. Returns pages, per-area counts (families), crawl queue state (frontier), stale_pages, last and oldest successful checks, refresh_policy and up to 15 recent source errors. For the configured entry points use list_telegram_sources; for the individual cached pages use list_telegram_cached_pages; to answer a question use search_telegram_docs. Refreshing is automatic (on read, on search and in a background cycle), so there is no refresh command. Returns page counts per area, crawl queue state, stale page count, last and oldest successful checks, refresh policy and the latest source errors. Indexed pages are not all of Telegram's knowledge: absence from the cache is not evidence that a feature does not exist.
Inputs: no named parameters.
get_telegram_documentRead an official documentation pageARead-onlyIdempotent
Read the text of an official Telegram, TON or bot-library documentation page, one window at a time.
Use it to read requirements, parameters and limits in full after search_telegram_docs found the page, or to load an entry page from list_telegram_sources into an empty cache. Do not use it to find which page answers a question: search first. Pages missing from the cache or older than the freshness limit (6 hours by default) are fetched first. Returns title, URL, Markdown body for the requested window, next_offset (null at the end), total_characters, content hash and freshness. If the live source fails, the cached text is returned with freshness.stale and refresh_error set. The observation date is when this installation read the page, not when Telegram changed it.
Inputs: url (required), length, offset, refresh.
list_bot_api_changesBot API changes by versionARead-onlyIdempotent
List official Bot API changelog entries as structured releases: version, date, link and the individual changes.
Use it when upgrading a bot or a library ("what changed since 9.0?"), when a field seems new or missing, or to find when a method or field was added, replaced or removed. Returns current_version and releases, newest first: each has version, date, url and changes ({text, topic, refs: linked methods and types, terms: field and parameter names}). A name that no change mentions returns an empty list. For the full current definition use get_bot_api_definition; for TON or library changelogs use search_telegram_docs with area ton-releases or the library area.
Inputs: name, limit, since_version.
list_telegram_cached_pagesList cached documentation pagesARead-onlyIdempotent
List the documentation pages already stored in the local cache, sorted by URL.
Use it to see which pages of an area are available offline or to pick a page to open with get_telegram_document. Filter with area, page through results with offset and limit. Returns pages (url, title, area, checked_at, freshness), total matching pages and next_offset to pass back for the next page (null at the end). It lists stored pages only; to find content by topic use search_telegram_docs, and for totals and errors use get_telegram_corpus_status.
Inputs: area, limit, offset.
list_telegram_document_revisionsObserved revisions of a pageARead-onlyIdempotent
List the revisions of one documentation page that this installation has observed, newest first.
Use it to see whether a page changed since an earlier read. To read the current text use get_telegram_document. Returns revisions: a list of {sha, captured_at, characters}, newest first. A page that this installation has never fetched returns an empty list; a URL outside the official sources is rejected with an error. It does not reconstruct history before the page was first fetched here; for Telegram release history use list_bot_api_changes or the changelogs (area releases or ton-releases).
Inputs: url (required).
list_telegram_sourcesOfficial documentation entry pointsARead-onlyIdempotent
List the official entry points this server crawls, each with its documentation area.
Use it to find where to start reading for an unfamiliar area (for example the Bot API index, docs.ton.org/llms.txt or a library's docs) and pass the URL to get_telegram_document. If you already know the feature or API name, use search_telegram_docs instead. Returns sources: a list of {url, area} in the configured order (Telegram core docs, then TON, then bot libraries), and a short scope note. This is the source configuration, not the cache: list_telegram_cached_pages shows what is already stored.
Inputs: no named parameters.
search_telegram_docsSearch Telegram and TON docsARead-onlyIdempotent
Find the official documentation sections that answer a Telegram or TON development question.
Use it before writing or reviewing code that calls the Bot API, Mini Apps JS, Telegram API/MTProto, TDLib, TON Connect, Tolk contracts or the aiogram, python-telegram-bot and grammY libraries. Returns up to limit sections with page URL, heading, excerpt, document_offset and freshness. Excerpts are partial: open the page with get_telegram_document at document_offset before relying on details. Stale matching pages are re-fetched first. An empty result is not proof that a feature does not exist; if the cache is empty, the response suggests pages to fetch.
Inputs: query (required), area, limit.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 10 tools
Each tool targets a distinct action+resource: single-call validation vs whole-project validation, fetching a method definition, searching docs, reading a page window, listing changes, and cache introspection are all separate. The descriptions explicitly cross-reference the lookalikes (check_bot_api_call vs check_telegram_project, list_telegram_sources vs list_telegram_cached_pages vs get_telegram_corpus_status), making the boundaries unambiguous.
All ten tools follow the same snake_case verb_noun pattern with a stable domain prefix (telegram / bot_api). Verb choice is used consistently: check_* for validation, get_* for single-resource retrieval, list_* for enumerations, search_* for discovery.
Ten tools is well within the sweet spot and each earns its place: two validation entry points, three retrieval tools, four listing/status tools, and one search. Nothing appears redundant enough to trim, and no obvious operation is missing that would require folding tools together.
The doc-lookup lifecycle (sources -> cached pages -> search -> read -> revisions -> changelog -> schema definitions) and the validation surface (single call and whole project) are covered end to end, with cache health reporting. Minor gaps: no explicit way to force a refresh or configure sources, and revision history only extends back to what this installation has fetched.
Maintenance
Related MCP Connectors
Access and search Branch's official API documentation directly within any AI agent or client.
Tailor Platform for AI assistants: search, list and read the platform documentation.
Telegram for AI agents, no login: keyword search, channel posts, comments, username lookup.
Telegram automation for AI: read and search channel summaries, get digests, manage auto-publishing.
Related MCP Servers
- AlicenseAqualityBmaintenanceA Model Context Protocol server that fetches up-to-date, version-specific documentation and code examples from libraries directly into LLM prompts, helping developers get accurate answers without outdated or hallucinated information.265,338MIT
- AlicenseBqualityDmaintenanceFull-featured Telegram Bot API server for MCP (Model Context Protocol). 174 tools covering the entire Bot API — messages, chats, stickers, payments, forums, stories, and more.1007MIT
- AlicenseAqualityDmaintenanceEnables AI agents to send and receive messages, media, and files on Telegram, and manage chats via a bot token.1755 PyPIMIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with the Telegram Bot API, allowing them to send messages, forward messages, get bot information, and receive updates.3MIT