Skip to content

feat: MCP server — Telegram tools for Claude Code and AI agents (v0.4.0) - #6

Merged
jdp5949 merged 4 commits into
mainfrom
feat/mcp-server
Jun 7, 2026
Merged

jdp5949 merged 4 commits into
mainfrom
feat/mcp-server

Conversation

@jdp5949

@jdp5949 jdp5949 commented Jun 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds tg_ringer/mcp.py — a stdio MCP server wrapping TgCaller with 5 tools:
    • tg_ring — ring a Telegram user (phone rings, no audio)
    • tg_message — send a DM
    • tg_whoami — show logged-in userbot account
    • tg_status — @SpamBot anti-spam check
    • tg_ask — send question, block until Telegram reply, return reply to Claude (human-in-the-loop)
  • Adds tg-ringer-mcp console script and [mcp] optional dep (mcp>=1.0)
  • Recommended setup: SSH stdio transport (no open ports, SSH key = auth)
  • Docs updated in README and GitHub Pages with full MCP section, Claude Code config, Claude desktop app, Cursor/Windsurf setup
  • Bumps version to 0.4.0

Bugs fixed in review

  • Resource leak: _caller now assigned only after __aenter__ succeeds — prevents skipped __aexit__ on connect failure
  • tg_ask silent miss: replaced date > sent_date + limit=10 with min_id=sent.id + limit=50 — fixes same-second miss and truncation in busy chats
  • @None username: tg_whoami now handles accounts with no username

Test plan

  • CI green (lint + tests on 3.9/3.10/3.11/3.12)
  • tg-ringer msg tested end-to-end (mini4-india → Telegram)
  • tg-ringer call tested end-to-end (mini4-india → phone rang)
  • MCP handshake verified over restricted SSH key
  • All 5 tools listed by MCP server

jdp5949 added 4 commits June 7, 2026 11:31
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')
@jdp5949
jdp5949 merged commit e0183f4 into main Jun 7, 2026
11 checks passed
@jdp5949
jdp5949 deleted the feat/mcp-server branch June 7, 2026 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant