Commit graph

192 commits

Author SHA1 Message Date
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
Bayram Annakov
6a05d7a661 feat: add engagement metrics (views, forwards, reactions) to message output
Adds views, forwards, and reaction counts to message output for channel posts.
These metrics are available in Telegram's API for channel content.

Changes:
- get_messages: Include engagement info in output
- list_messages: Include engagement info in output

Example output: 'views:1234, forwards:56, reactions:78'

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 14:09:48 -08:00
Bayram Annakov
11bfca7083 style: apply black formatting to match project standards 2025-12-26 13:51:20 -08:00
Bayram Annakov
aabe9d8bc0 fix: correct syntax error from suggestion application
The individual line suggestions created invalid Python when applied
separately. Combined the ternary expression properly.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 13:48:36 -08:00
Bayram Annakov
182e3684dd
Update main.py
Co-authored-by: Eugene Evstafev <36392751+chigwell@users.noreply.github.com>
2025-12-26 13:47:11 -08:00
Bayram Annakov
d504e5fa45
Update main.py
Co-authored-by: Eugene Evstafev <36392751+chigwell@users.noreply.github.com>
2025-12-26 13:47:05 -08:00
Bayram Annakov
700c01b2d3
Update main.py
Co-authored-by: Eugene Evstafev <36392751+chigwell@users.noreply.github.com>
2025-12-26 13:46:59 -08:00
Bayram Annakov
fe8dcb3797
Update main.py
Co-authored-by: Eugene Evstafev <36392751+chigwell@users.noreply.github.com>
2025-12-26 13:46:53 -08:00
Bayram Annakov
adc6ef4c7c
Update main.py
Co-authored-by: Eugene Evstafev <36392751+chigwell@users.noreply.github.com>
2025-12-26 13:46:46 -08:00
Bayram Annakov
041bf0dbec
Update main.py
Co-authored-by: Eugene Evstafev <36392751+chigwell@users.noreply.github.com>
2025-12-26 13:46:38 -08:00
Bayram Annakov
78a21ef2d0
Update main.py
Co-authored-by: Eugene Evstafev <36392751+chigwell@users.noreply.github.com>
2025-12-26 13:46:31 -08:00
Bayram Annakov
943f66a67c
Apply suggestions from code review
Co-authored-by: Eugene Evstafev <36392751+chigwell@users.noreply.github.com>
2025-12-26 13:45:28 -08:00
Eugene Evstafev
3d8027fe77
Merge pull request #45 from BayramAnnakov/feat/draft-management
feat: add draft management tools (save_draft, get_drafts, clear_draft)
2025-12-26 09:48:07 +00:00
Bayram Annakov
6b1f4cda85 fix: detect manually marked unread chats in list_chats
Previously list_chats only checked dialog.unread_count, missing chats
that were manually marked as unread via Telegram's "mark as unread" feature.

Now also checks dialog.dialog.unread_mark flag:
- unread_count > 0: shows "Unread: N"
- unread_mark = True: shows "Unread: marked"

This matches the behavior of Telegram's "Unread" folder filter.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 19:17:22 -08:00
Bayram Annakov
37269e11ea feat: add draft management tools (save_draft, get_drafts, clear_draft)
Add three new tools for managing Telegram drafts:
- save_draft: Save a draft message to any chat/channel
- get_drafts: List all drafts across all chats
- clear_draft: Clear a draft from a specific chat

Uses Telethon's SaveDraftRequest and GetAllDraftsRequest APIs.
Drafts appear in Telegram's input field for review before sending.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 19:04:32 -08:00
Eugene Evstafev
4b077c708e
Merge pull request #44 from l1v0n1/docs/add-invite-to-group-to-readme
docs: add invite_to_group function to README
2025-12-25 19:41:41 +00:00
anonim
2ac8b93650 docs: add invite_to_group function to README
Add invite_to_group function to the Chat & Group Management section
of the README. This function exists in main.py with @mcp.tool() decorator
but was missing from the documentation.
2025-12-25 22:39:16 +03:00
Eugene Evstafev
c76e1a27a7
Merge pull request #43 from chigwell/l1v0n1-patch-1
docs: add message reaction tools to README
2025-12-25 19:26:22 +00:00
Kamil
a7baa31ab6
docs: add message reaction tools to README
Add documentation for three new message reaction tools from PR #41:

- send_reaction(chat_id, message_id, emoji, big=False): Add a reaction to a message
- remove_reaction(chat_id, message_id): Remove a reaction from a message
- get_message_reactions(chat_id, message_id, limit=50): Get all reactions on a message

These tools are now part of the Messaging section in the features list.
2025-12-25 22:23:26 +03:00
Eugene Evstafev
24a07d1f4f
Merge pull request #41 from dmitry-simple-it/feat/message-reactions
feat: add message reactions support
2025-12-23 17:00:55 +00:00
Dmitrii Zolotukhin
7a9ee58c71 feat: add message reactions support
Add three new MCP tools for handling Telegram message reactions:
- send_reaction: Send emoji reaction to a message
- remove_reaction: Remove your reaction from a message
- get_message_reactions: Get list of reactions on a message

All tools include proper ToolAnnotations and follow existing code patterns.
2025-12-23 19:55:54 +03:00
Eugene Evstafev
fcadc0f3c7
Merge pull request #40 from triepod-ai/feat/add-title-annotations
feat: Add title annotations to all 78 tools for improved LLM display
2025-12-23 14:02:12 +00:00
triepod-ai
49d70795f0 feat: Add title annotations to all 78 tools for improved LLM display
Add human-readable title annotations to all MCP tools to help clients
display tool names in a user-friendly format.

Changes:
- Added title annotation to all 78 tools (e.g., "Get Chats", "Send Message")
- Formatted with Black for code style consistency

This improves the user experience when MCP clients display tool lists.

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-23 07:55:43 -06:00
Eugene Evstafev
83c2c73a3b
Merge pull request #35 from uriyyo/main
Add ability to run telegram-mcp using uvx
2025-12-19 09:08:31 +00:00
Yurii Karabas
92a0dc31b5 fix lint errors 2025-12-18 23:47:12 +01:00
Yurii Karabas
7e2f4427e5
Merge branch 'chigwell:main' into main 2025-12-19 00:44:44 +02:00
Eugene Evstafev
0cb7b74ee5
Merge pull request #38 from dmitry-simple-it/fix/update-mcp-for-tool-annotations
fix: update uv.lock to resolve ToolAnnotations import error
2025-11-27 19:16:33 +00:00
Dmitrii Zolotukhin
f5bf9d1a24 fix: update uv.lock to resolve ToolAnnotations import error
Fixes #37

The mcp package was locked at version 1.6.0 which does not include
the ToolAnnotations type. This caused the server to fail on startup
with:

  ImportError: cannot import name 'ToolAnnotations' from 'mcp.types'

Updated mcp from 1.6.0 to 1.22.0 which includes ToolAnnotations
and is compatible with the code added in PR #34.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-27 22:13:08 +03:00
Yurii Karabas
603119073a Add scripts entrypoint to run telegram-mcp using uvx 2025-11-22 14:22:13 +01:00
Eugene Evstafev
6fca222f42
Merge pull request #34 from strato-space/feat/tool-annotations
feat: add comprehensive ToolAnnotations to all MCP tools
2025-11-18 15:00:50 +00:00
Valeriy_Pavlovich
be12812c62 black: reformatted main.py 2025-11-14 01:08:37 +03:00
Valeriy_Pavlovich
1c71806082 feat: add comprehensive ToolAnnotations to all MCP tools
- Add openWorldHint=True to all 63+ @mcp.tool decorators
- Add readOnlyHint=True to read-only operations (get/list/search/export functions)
- Add destructiveHint=True to state-changing operations (send/create/delete/edit functions)
- Add idempotentHint=True to safely repeatable operations (block/unblock/pin/unpin/ban/unban/etc.)
- Fix syntax errors: openWorldHint(True) → openWorldHint=True
- Remove incorrect idempotentHint from non-idempotent operations (send_file, press_inline_button, import_contacts)

These annotations help MCP clients understand tool behavior:
- readOnlyHint: tool doesn't modify environment
- destructiveHint: tool performs destructive updates
- idempotentHint: repeated calls with same args have no additional effect
- openWorldHint: tool interacts with external entities (Telegram API)

Improves tool discoverability and helps AI agents make better decisions about tool usage.
2025-11-14 00:26:35 +03:00
Valeriy Pavlovich
57b6ef44f8
Merge pull request #1 from chigwell/main
22 commits behind chigwell/telegram-mcp:main.
2025-11-13 01:33:19 +03:00
Eugene Evstafev
ac284bcd4e
Merge pull request #32 from Latand/feature/inline-buttons-subscribe
Add inline button helpers and channel subscription tool
2025-11-05 10:28:55 +00:00