Commit graph

175 commits

Author SHA1 Message Date
Eugene Evstafev
3502aa9ec6
docs: add Contributors section to README 2026-03-27 17:00:36 +00:00
Eugene Evstafev
71cdefa55c
Merge pull request #77 from nathanschram/fix/entity-resolution-stringsession
fix: resolve entity cache miss for StringSession users
2026-03-18 08:49:18 +00:00
Nathan Schram
2e87007da2 fix: restore parse_mode and safe-path handling
Address review feedback from @chigwell and @l1v0n1:

- Restore parse_mode=parse_mode in send_message and reply_to_message
- Restore _resolve_readable_file_path() in send_file, send_voice,
  send_sticker, and edit_chat_photo
- Use str(safe_path) instead of raw file_path in upload_file calls

The entity cache fix (resolve_entity/resolve_input_entity) is preserved
in all affected functions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 14:36:27 +11:00
Eugene Evstafev
dad686a2d5
Merge branch 'main' into fix/entity-resolution-stringsession 2026-03-17 09:33:58 +00:00
Eugene Evstafev
a39a7c99ae
Merge pull request #74 from mxl/feat/global-message-search
Add global message search
2026-03-17 09:29:45 +00:00
Eugene Evstafev
418cc8bbd1
Merge pull request #75 from mxl/feat/search-public-chats-pagination
Add limit parameter to public chat search
2026-03-17 09:28:46 +00:00
Nathan Schram
a5da0d6b6b fix: resolve entity cache miss for StringSession users
StringSession has no persistent entity cache. After each MCP server
restart, client.get_entity(positive_int) fails for basic group chats
because Telethon interprets positive integers as PeerUser IDs when
they're not in the cache.

Fix:
- Add resolve_entity() / resolve_input_entity() helpers that retry
  after warming cache via get_dialogs() on ValueError
- Warm entity cache on startup in _main()
- Replace all ~72 client.get_entity() / client.get_input_entity()
  call sites with the new helpers

Tested: 60/60 pass across 6 basic group chats (send_message,
get_history, reply, edit, draft, reactions, search, mark_as_read,
delete) with cold cache -> warm cache transition verified.

Fixes chigwell/telegram-mcp#76
2026-03-17 14:10:47 +11:00
mxl
8273ade003 Add pagination to global message search 2026-03-16 19:17:10 -07:00
mxl
0840b76a67 Update README for public chat search limit 2026-03-16 19:00:50 -07:00
mxl
e7421759bd Add limit parameter to public chat search 2026-03-16 18:34:12 -07:00
Eugene Evstafev
49c912d6eb
Merge pull request #73 from mxl/fix/search-public-chats-include-chats
fix: include chats and channels in search_public_chats results
2026-03-16 08:28:02 +00:00
Eugene Evstafev
14d1235bc2
Merge pull request #72 from mxl/fix/shared-folders-chatlist-support
fix: add support for shared folders (DialogFilterChatlist) in folder operations
2026-03-16 08:27:46 +00:00
mxl
51b71f1dce fix: include chats and channels in search_public_chats results
contacts.SearchRequest returns both result.users and result.chats,
but only users were returned. Chats (channels, groups) are now
included, making search work by channel/group title as intended.
2026-03-16 09:48:42 +03:00
mxl
b0b568bf82 fix: add support for shared folders (DialogFilterChatlist) in folder operations
Shared folders in Telegram use DialogFilterChatlist type instead of
DialogFilter. Previously, all folder operations (list, get, create,
add/remove chat) silently ignored shared folders. This fix ensures
they are recognized and handled correctly alongside regular folders.
2026-03-16 06:50:02 +03:00
Eugene Evstafev
26b1287a5b
Merge pull request #69 from oplexz/main
Implement login via QR-code in session_string_generator; bump Telethon to 1.42.0
2026-03-05 08:15:15 +00:00
Daniil Isakov
03f3321942 style: format session_string_generator.py with black 2026-03-05 02:55:57 +03:00
Daniil Isakov
c39cde69f7 Merge remote-tracking branch 'upstream/main' 2026-03-05 02:55:07 +03:00
Eugene Evstafev
dbb0a47808
Merge pull request #70 from onsails/fix/stderr-startup-messages
fix: redirect all print() to stderr to keep stdout clean for MCP stdio
2026-03-04 19:47:43 +00:00
Andrey Kuznetsov
a53d807146
fix: redirect all print() to stderr to keep stdout clean for MCP stdio
MCP clients (e.g. ZeroClaw) communicate via JSON-RPC over stdin/stdout.
Startup messages and warnings written to stdout corrupt the protocol
stream, causing parse failures. Redirect all print() calls to stderr.
2026-03-04 23:16:23 +04:00
Daniil Isakov
6d5e548937 chore(dependencies): update uv.lock 2026-02-28 04:14:38 +03:00
Daniil Isakov
fa11aaaf88 feat(session_string_generator): implement QR code and phone number login methods for Telegram session generation 2026-02-28 04:14:22 +03:00
Daniil Isakov
021298dae5 chore(dependencies): update telethon to 1.42.0 and add qrcode dependency 2026-02-28 04:14:15 +03:00
Daniil Isakov
876506e038 chore(dependencies): update telethon to version 1.42.0 and add qrcode dependency 2026-02-28 04:14:08 +03:00
Eugene Evstafev
61924fb2a1
Merge pull request #67 from bunkerskyi/fix/delete-profile-photo
fix(delete_profile_photo): pass Photo object instead of int to DeletePhotosRequest
2026-02-26 09:18:40 +00:00
Eugene Evstafev
c13982b173
Merge pull request #68 from bunkerskyi/feat/parse-mode-in-send-message
feat(tools): expose parse_mode in send_message and reply_to_message
2026-02-26 08:54:04 +00:00
Ivan Kolodrivskyi
fb620cd670 feat(tools): expose parse_mode in send_message and reply_to_message 2026-02-26 08:52:28 +02:00
Ivan Kolodrivskyi
2e1bfc3d94 fix(delete_profile_photo): pass Photo object instead of int to DeletePhotosRequest
Telethon's DeletePhotosRequest requires InputPhoto objects, which it derives
from Photo objects via get_input_photo(). Passing photo.id (an int) causes:
  AttributeError: 'int' object has no attribute 'SUBCLASS_OF_ID'
  TypeError: Cannot cast int to any kind of InputPhoto.

Fix: pass the Photo object directly (photos.photos[0]) so Telethon can
convert it to InputPhoto internally.
2026-02-26 08:42:05 +02:00
Eugene Evstafev
8c4b671c12
Merge pull request #64 from iqdoctor/feat/issue-39-filepath-roots
feat: secure file-path tools with allowlisted roots (issue #39)
2026-02-25 08:05:45 +00:00
vp
6ec5c95c91 fix: harden roots unsupported fallback and deny-all messaging 2026-02-24 23:02:38 +03:00
vp
172fedaf7a fix: treat empty MCP roots as explicit deny-all 2026-02-24 22:52:23 +03:00
vp
3b82062070 style: format main.py with black 2026-02-24 22:40:30 +03:00
vp
a7df9da9f5 fix: harden roots fallback semantics and docs 2026-02-24 22:35:30 +03:00
vp
e7b92cd89b docs: restore GIF tools removal note in README 2026-02-24 22:21:08 +03:00
vp
fd9c90e53c feat: secure file-path tools with allowlisted roots
- implement server-side allowlist via CLI positional roots (fallback)\n- implement client MCP Roots override semantics (replace server roots when available)\n- add realpath + in-root validation, traversal/glob rejection, extension and size checks\n- make write path default to <first_root>/downloads when file_path is omitted\n- reintroduce upload_file tool with the same path security model\n- update README with security model and usage\n- add tests for root resolution, replacement semantics, traversal checks, and default write path\n- add pytest and pytest-asyncio to dev dependencies
2026-02-24 22:12:56 +03:00
Eugene Evstafev
594e27e53a
Merge pull request #62 from yarreg/fix/issue-61-supergroup-type
Fix supergroup type in get_folder and unify chat type mapping
2026-02-12 13:19:55 +00:00
yarreg
ad78563377 Fix supergroup type in get_folder and unify chat type mapping 2026-02-12 16:12:36 +03:00
Eugene Evstafev
95a0313b5c
Merge pull request #57 from artgas1/feature/add-contact-username-support
feat: Add support for adding contacts by username without phone number
2026-02-12 12:23:04 +00:00
artgas1
359b86315e style: Apply black formatting to add_contact function
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 15:21:25 +03:00
Eugene Evstafev
73ea210cb3
Merge pull request #60 from artgas1/fix/archive-unarchive
fix: use correct Telegram API for archive/unarchive chat
2026-02-09 10:09:23 +00:00
gvidonind-commits
382246d89e fix: use correct Telegram API for archive/unarchive chat
archive_chat and unarchive_chat were using ToggleDialogPinRequest which
pins/unpins dialogs instead of archiving them. Replace with
folders.EditPeerFoldersRequest using folder_id=1 (Archive) and
folder_id=0 (Main) which is the correct API for moving chats to/from
the Archive folder.
2026-02-09 06:36:27 +03:00
gvidonind-commits
afb02be510 refactor: Add separate username parameter to add_contact function
- Changed phone parameter to Optional[str] = None
- Added separate username parameter (Optional[str] = None)
- Improved function signature clarity - username is now explicit parameter
- Updated validation logic to check for either phone or username
- Maintains backward compatibility with phone-based contacts
- Better API design - no longer need to pass username via phone parameter
2026-02-09 06:34:21 +03:00
gvidonind-commits
4693719798 feat: Add support for adding contacts by username without phone number
- Modified add_contact function to support username-based contact addition
- If phone parameter is empty or starts with @, function resolves username first
- Uses contacts.AddContactRequest API for username-based contacts
- Maintains backward compatibility with phone-based contact addition
- Allows adding contacts as done in Telegram UI when searching by username
2026-02-09 06:34:21 +03:00
Eugene Evstafev
36522e5ebc
Merge pull request #53 from smixs/feat/folder-support
feat(folders): add 7 tools for Telegram folder management
2026-01-27 10:06:21 +00:00
smixs
1206cf81d6 style: format code with black 2026-01-27 14:59:35 +05:00
smixs
b733d32467 feat(folders): add 7 tools for Telegram folder management
Add new MCP tools to manage Telegram dialog folders (filters):
- list_folders: get all folders with IDs, names, emoji
- get_folder: get folder details including all included chats
- create_folder: create new folder with filters and chat list
- add_chat_to_folder: add chat to existing folder (idempotent)
- remove_chat_from_folder: remove chat from folder (idempotent)
- delete_folder: delete folder (chats preserved)
- reorder_folders: change folder order

Handles Telegram API specifics:
- TextWithEntities for folder titles
- Max 10 folders limit
- System folder protection (ID < 2)
- title_noanimate and color attributes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 13:55:55 +05:00
Eugene Evstafev
d65fb8b74c
Merge pull request #48 from BayramAnnakov/feat/message-engagement-metrics
feat: add engagement metrics to message output
2026-01-11 20:02:05 +00:00
Kamil
6be9bc2cf5
Merge pull request #49 from chigwell/chigwell-patch-2 2025-12-29 17:08:03 +03:00
Eugene Evstafev
0b66911b54
docs: update README.md
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-29 14:02:31 +00:00
Eugene Evstafev
86595353f7
docs: add header image to README 2025-12-29 13:57:40 +00:00
Eugene Evstafev
ff8d19b59c
Merge pull request #46 from BayramAnnakov/fix/unread-mark-detection
fix: detect manually marked unread chats in list_chats
2025-12-26 22:51:54 +00:00