Thank you for your interest in contributing to telegram-bot-mcp! This project provides a Model Context Protocol (MCP) server that empowers AI coding agents to autonomously test, interact with, click buttons on, and verify Telegram bots.
- Python 3.10+
pip/ virtual environment
Clone the repository and install dependencies:
git clone https://github.com/Fire162/telegram-bot-mcp.git
cd telegram-bot-mcp
pip install -r requirements.txt- Copy
.env.exampleto.env:cp .env.example .env
- Obtain your
TELEGRAM_API_IDandTELEGRAM_API_HASHfrom my.telegram.org and add them to.env. - Set
TELEGRAM_TEST_MODE=truefor testing on Telegram's Sandbox DC 2 (orfalsefor production). - Run the interactive login helper to generate your session string:
python3 login.py
python3 server.py- Architecture: Keep MTProto interactions in
telegram_service.pyand MCP tool registrations inserver.py. - Typing & Clean Code: Use Python type hints (
typing) and clear docstrings for all MCP tools so AI agents can parse their JSON schemas accurately. - Dependencies: Keep dependencies minimal (
mcp,telethon,python-dotenv). Do not add third-party libraries for trivial logic. - Security First: Never commit
.env, session strings, or API credentials. - Documentation: If adding a new tool or capability, update:
server.py&telegram_service.pyAGENT.mddocs/AGENT_GUIDE.md.agents/plugins/telegram-bot/rules/AGENTS.mdCHANGELOG.mdwith timestamps formatted inAsia/Kolkatatimezone.
- Create a descriptive feature branch:
git checkout -b feat/my-new-tool
- Verify code syntax and functionality:
python3 -c "import py_compile; py_compile.compile('server.py', doraise=True); py_compile.compile('telegram_service.py', doraise=True)" - Commit with concise, meaningful commit messages.
- Push your branch and open a Pull Request on GitHub.