Commit graph

87 commits

Author SHA1 Message Date
Korzhavin Ivan
80245bcdc9 fix: resolve stash conflict 2025-10-20 01:01:13 +02:00
Korzhavin Ivan
f8a8b581f4 fix: merge conflict 2025-10-20 01:00:55 +02:00
Eugene Evstafev
97884fd1c1
Merge pull request #24 from korjavin/main
Refactor error logging in main.py to structured JSON format with backward compatibility
2025-10-19 17:16:57 +01:00
Korzhavin Ivan
cbe429b474 Merge branch 'main' of https://github.com/chigwell/telegram-mcp into feature/id-validation-decorator
Resolved conflict in log_and_format_error function by:
- Combining ErrorCategory enum (from main) with user_message parameter (from feature branch)
- Supporting both ErrorCategory and string prefixes (for validation errors)
- Keeping validation decorator functionality intact

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-19 15:23:15 +02:00
Korzhavin Ivan
2a7134be39 fix: Apply Black formatting to pass CI checks
Applied Black code formatting to main.py to resolve linting
failures in GitHub Actions for PR #24.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-19 15:19:34 +02:00
Korzhavin Ivan
251be7219d chore: Add Black and flake8 as dev dependencies
Added Black and flake8 to development dependencies to ensure
consistent code formatting and linting across the project.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-19 15:18:32 +02:00
Korzhavin Ivan
6bbeae8c98 fix: Apply Black formatting to pass CI checks
Applied Black code formatting to main.py and test_validation.py
to resolve linting failures in GitHub Actions.

Changes include:
- Proper line breaking for long lines
- Consistent quote style (single to double quotes)
- Better formatting of return statements

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-19 15:18:05 +02:00
Eugene Evstafev
eb6a6d0ff2
Merge pull request #30 from Marenz/poll
feat: add poll creation functionality
2025-10-17 16:39:36 +01:00
Mathias L. Baumann
7f078dd1e7 feat: add poll creation functionality
- Implement create_poll tool using Telethon's native poll API
- Support for multiple choice, quiz mode, public votes, and close dates
2025-10-17 17:32:14 +02:00
Eugene Evstafev
e7995ae001
Merge pull request #31 from strato-space/feat/list_topics
feat: Add forum topics support with `list_topics` tool
2025-10-16 10:27:11 +01:00
Valeriy Pavlovich
aa6d2761ce feat: Add forum topics support with list_topics tool
Add new list_topics() MCP tool to retrieve forum topics from Telegram
supergroups with forum feature enabled.

Features:
- Validates chat is a supergroup with forum enabled
- Supports pagination via offset_topic parameter
- Supports search filtering via search_query parameter
- Returns comprehensive topic metadata:
  * Topic ID and title
  * Total messages and unread count
  * Status flags (closed, hidden)
  * Last activity timestamp
- Proper error handling and logging

Documentation:
- Added list_topics to README Messaging tools list
- Added complete code example with implementation
- Added example output showing typical usage

Uses Telethon's GetForumTopicsRequest API for reliable forum topic
retrieval from supergroups.
2025-10-14 15:39:00 +03:00
Eugene Evstafev
da3f3ec524
Merge pull request #28 from strato-space/main
fix: make list_messages respect date/search limits (#27)
2025-10-13 20:12:27 +01:00
Valeriy Pavlovich
f08667c47a Format main.py with Black 2025-10-13 21:20:24 +03:00
Valeriy Pavlovich
553125cd76 Make list_messages predictable and efficient for date ranges and search: avoid over-fetch, apply limit after filtering, and separate search from date offsets #27
- stream search results via `client.iter_messages()` and apply date bounds in-code so we collect up to `limit` matches
- use server-side iteration for date-only queries with inclusive upper bounds to avoid over-fetching
- keep the existing `get_messages()` fast path when no filters are provided
2025-10-12 07:14:25 +03:00
Korjavin Ivan
127c953801
Merge pull request #1 from korjavin/feature/structured-json-logging
Implement Structured JSON Error Logging
2025-09-06 22:32:57 +02:00
google-labs-jules[bot]
50b01ca494 feat: implement structured JSON error logging
- Add python-json-logger dependency.
- Configure file handler to use JsonFormatter for structured logging.
- Keep console handler with the existing text format.
- Refactor log_and_format_error to log a dictionary with structured error data.
2025-09-01 14:39:30 +00:00
Eugene Evstafev
3cd0489769
Merge pull request #22 from korjavin/feature/error-code-enum
refactor: Replace hardcoded error prefixes with an Enum
2025-08-30 23:07:10 +01:00
Eugene Evstafev
b15c3e7b29
Merge pull request #21 from korjavin/main
Fix run how-to to use uv for consistency with production case
2025-08-30 23:06:09 +01:00
Korzhavin Ivan
30f759e3cb Fix unnecesary python downgrade 2025-08-29 23:23:27 +02:00
google-labs-jules[bot]
34bdd58905 feat: Implement input validation decorator for chat/user IDs
Adds a new `@validate_id` decorator to validate `chat_id` and `user_id` parameters in `main.py`.

This decorator ensures that all IDs passed to functions are in a valid format before making RPC calls to the Telegram API. It handles:
- Integer IDs (positive and negative)
- String representations of integer IDs
- Usernames (e.g., "@username")
- Lists of IDs

Key changes:
- Created a `validate_id` decorator in `main.py`.
- Applied the decorator to all functions that accept `chat_id`, `user_id`, or similar parameters.
- Updated the central `log_and_format_error` function to handle custom validation error messages and a specific `VALIDATION-001` error code for logging.
- Added a new test suite (`test_validation.py`) with comprehensive tests for the decorator.
- Updated `README.md` and `session_string_generator.py` with documentation about the new validation.
2025-08-29 23:16:13 +02:00
google-labs-jules[bot]
59fb2dcd10 refactor: Replace hardcoded error prefixes with an Enum 2025-08-29 23:13:59 +02:00
Korzhavin Ivan
016fd31603 Fix run how-to to use uv for consistency with production case 2025-08-28 22:18:58 +02:00
Eugene Evstafev
9464b4de75
Merge pull request #19 from TimTProd/add_replies
feat: enhance message display with reply information
2025-08-06 19:39:07 +01:00
Tim
78a99b06f2 refactor: clean up whitespace and improve code formatting using black . 2025-08-06 21:07:59 +03:00
TimTProd
2dc8454a4f
Merge branch 'main' into add_replies 2025-08-06 20:19:38 +03:00
Eugene Evstafev
574fe149e5
Merge pull request #17 from TimTProd/add_nicknames
feat: add get_sender_name function to enhance message formatting
2025-08-06 17:53:53 +01:00
Tim
103ce35594 feat: enhance message display with reply information
Updated message formatting in various functions to include details about replies. When a message is a reply, it now shows the ID of the original message and the sender's name, improving context for users.
2025-08-06 19:37:30 +03:00
Tim
f0072801cb feat: add get_sender_name function to enhance message formatting
Introduced a new helper function, get_sender_name, to retrieve the sender's name from messages. Updated various message display functions to include the sender's name in the output, improving clarity and context for users
2025-07-24 17:28:42 +03:00
Eugene Evstafev
e16b41115c
Merge pull request #9 from chigwell/test-branch
docs: update README.md
2025-04-26 08:20:56 +01:00
Eugene Evstafev
3f59865361 docs: update README.md 2025-04-26 08:17:23 +01:00
Eugene Evstafev
bb464e52fa
Merge pull request #8 from l1v0n1/main
Merge v2.0.2: Dockerization & CI Enhancements into Telegram MCP Mainline
2025-04-24 17:41:46 +01:00
anonim
b1f0e79b6b chore: update references to the renamed container in documentation and workflows
Renamed all instances of 'telegram-mcp-server' to 'telegram-mcp' in docker-compose.yml, README.md, and the Docker build workflow to ensure consistency and clarity across the project.
2025-04-24 15:09:38 +03:00
anonim
91039571ca chore: rename container in docker-compose.yml for consistency
Updated the container name in docker-compose.yml from 'telegram_mcp_server' to 'telegram-mcp' to align with naming conventions and improve clarity.
2025-04-24 15:09:00 +03:00
anonim
461f267822 docs: add CI badges to README.md
Added badges for Python linting and Docker build validation to the README.md, enhancing visibility of the project's continuous integration status and encouraging best practices in code quality and deployment.
2025-04-24 15:04:05 +03:00
anonim
3d3aef8360 docs: add Docker setup instructions to README.md
Introduced a new section in the README.md detailing how to run the server using Docker, including steps for building the image and running the container with both Docker Compose and the `docker run` command. This enhances the documentation for users looking to simplify dependency management.
2025-04-24 15:03:11 +03:00
anonim
02f326ce38 chore: add dummy .env file creation step in Docker build workflow
Introduced a step in the Docker build workflow to create a dummy .env file with placeholder values for TELEGRAM_API_ID, TELEGRAM_API_HASH, and TELEGRAM_SESSION_STRING, facilitating local development and testing.
2025-04-24 14:54:24 +03:00
anonim
3c66504fb5 refactor: enhance error handling structure in main.py
Improved the organization and clarity of error handling in main.py by consolidating exception management and refining error messages, particularly in asynchronous functions.
2025-04-24 14:44:26 +03:00
anonim
cb4935fb42 refactor: streamline error handling in main.py
Updated error handling mechanisms in main.py to improve clarity and efficiency. This includes consolidating error messages and enhancing the structure of exception handling across asynchronous functions.
2025-04-24 14:35:19 +03:00
Eugene Evstafev
10ff5b79b0
Merge pull request #6 from l1v0n1/main
Refactor: Tool Cleanup for Reliability and Compatibility
2025-04-23 12:39:33 +01:00
anonim
214bd6c6e5 style: improve code formatting and consistency in main.py
Refactored several sections of main.py to enhance readability by adjusting line breaks and indentation. This includes formatting changes in error handling and function calls across various asynchronous functions.
2025-04-22 18:39:58 +03:00
anonim
b46f9a4e34 Merge branch 'main' of https://github.com/l1v0n1/telegram-mcp-server 2025-04-22 18:35:06 +03:00
anonim
d562cf61fb refactor: Remove file handling functions from main.py and update README.md
Removed several functions that required direct file path access, including `send_file`, `download_media`, `set_profile_photo`, `edit_chat_photo`, `send_voice`, `send_sticker`, and `upload_file`, due to limitations in the current MCP environment. Updated the README to reflect these changes and added a section on removed functionality.
2025-04-22 18:24:46 +03:00
Eugene Evstafev
74b39d4164
docs: add "Star History" section 2025-04-19 11:09:22 +01:00
Eugene Evstafev
e1aba2370a
Merge pull request #4 from chigwell/update-readme
docs: update credentials in README.md
2025-04-18 14:28:17 +01:00
Eugene Evstafev
cd35b7b893 docs: update credentials in README.md 2025-04-18 14:27:55 +01:00
Eugene Evstafev
1ef0188e5c
Merge pull request #3 from chigwell/add-github-workflows
feat: add github's workflow for "Python Lint & Format Check"
2025-04-18 14:26:18 +01:00
Eugene Evstafev
fb20c458be refactor(ci): remove unused comments 2025-04-18 14:25:39 +01:00
Eugene Evstafev
eca9fb48cf refactor: update formatting 2025-04-18 14:25:24 +01:00
Eugene Evstafev
ff0f42626b feat: add github's workflow for "Python Lint & Format Check" 2025-04-18 14:21:44 +01:00
Eugene Evstafev
e3842dade9
Merge pull request #2 from l1v0n1/main
Telegram MCP v2.0: Major Functionality Enhancements & Robust Error Handling
2025-04-18 13:06:32 +01:00