feat: MCP server — Telegram tools for Claude Code and AI agents (v0.4.0) - #6
Merged
Merged
Conversation
Adds tg_ringer/mcp.py — a stdio MCP server wrapping TgCaller: - tg_ring: ring a user (phone rings, no audio) - tg_message: send DM - tg_whoami: show userbot account - tg_status: @SpamBot anti-spam check - tg_ask: send question, block until Telegram reply, return reply to Claude Bump version to 0.4.0. Add [mcp] optional dep (mcp>=1.0). Console script: tg-ringer-mcp.
- lifespan: assign _caller after __aenter__ succeeds so __aexit__ is never skipped on connect failure (resource leak) - tg_ask: use min_id=sent.id instead of date comparison — fixes same-second miss and limit=10 silent truncation (raised to 50) - tg_whoami: handle username=None accounts (was formatting as '@None')
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tg_ringer/mcp.py— a stdio MCP server wrappingTgCallerwith 5 tools:tg_ring— ring a Telegram user (phone rings, no audio)tg_message— send a DMtg_whoami— show logged-in userbot accounttg_status— @SpamBot anti-spam checktg_ask— send question, block until Telegram reply, return reply to Claude (human-in-the-loop)tg-ringer-mcpconsole script and[mcp]optional dep (mcp>=1.0)Bugs fixed in review
_callernow assigned only after__aenter__succeeds — prevents skipped__aexit__on connect failuretg_asksilent miss: replaceddate > sent_date+limit=10withmin_id=sent.id+limit=50— fixes same-second miss and truncation in busy chats@Noneusername:tg_whoaminow handles accounts with no usernameTest plan
tg-ringer msgtested end-to-end (mini4-india → Telegram)tg-ringer calltested end-to-end (mini4-india → phone rang)