TelegramBotMCP
Enables a Telegram chatbot to create Google Calendar events, schedule reminders, and summarize CSV files via an AI agent using the Model Context Protocol.
README
Telegram Bot with MCP Tools
This repository contains a Telegram chatbot that can interact with an AI agent and use external tools through the Model Context Protocol (MCP). The project is currently in an early production stage and is being developed as a basic but functional prototype.
Overview
The project combines:
- A Telegram bot interface
- An AI agent powered by OpenAI Agents
- An MCP server exposing tools to the agent
- Tool integrations for calendar events, reminders, and CSV file summaries
The goal is to let users chat with the bot in Telegram and ask it to perform actions such as creating calendar events or scheduling reminders.
Current Status
This project is still under active development and is currently very basic. The core flow works, but the implementation is intentionally simple and may evolve as more tools and features are added.
Main Features
Telegram integration
- Receives plain text messages from Telegram users
- Sends responses back to the user
- Uses the AI agent to interpret the request
AI agent and MCP
- Uses OpenAI Agents
- Connects to an MCP server through stdio
- Exposes tools that the agent can call dynamically
Available tools
The current tool set includes:
- Calendar integration
- Create Google Calendar events
- Reminders
- Schedule reminders for users
- Background worker checks and sends reminders when due
- Data files
- Summarize CSV files from the data directory
Project Structure
- main.py: entry point to start the MCP server
- runTelegram.py: entry point to start the Telegram bot
- src/telegram/telegramConnection.py: Telegram bot logic
- src/aiResponse/response.py: AI agent initialization, execution, and shutdown
- src/aiResponse/prompts/systemPrompt.md: system prompt used by the agent
- src/mcp/server/init.py: shared MCP server instance
- src/mcp/tools/: MCP tool implementations
- calendar_tool.py
- reminder_tool.py
- csv_tool.py
- src/functions/: helper modules for integrations
- calendar/calendar_conection.py
- reminders/reminders.py
- datafiles/readFile.py
Technologies Used
- Python 3.12+
- python-telegram-bot
- OpenAI Agents SDK
- MCP (Model Context Protocol)
- Google Calendar API
- pandas
- pyarrow
Dependencies
The project dependencies are defined in pyproject.toml. The main ones include:
- google-api-python-client
- google-auth
- google-auth-oauthlib
- mcp[cli]
- openai
- openai-agents
- pandas
- pyarrow
- python-telegram-bot
Environment Variables
The application expects the following environment variables:
- TELEGRAM_BOT_TOKEN: token for the Telegram bot
- OPENAI_MODEL_NAME: model name to use with OpenAI Agents
- MCP_PATH: module path for the MCP server entry point
You can define them in a .env file or export them in your shell.
Setup
-
Clone the repository.
-
Create and activate a virtual environment.
-
Install dependencies:
pip install -e . -
Create a .env file with the required environment variables.
-
Make sure the required credentials are available:
- Telegram bot token
- OpenAI model access
- Google Calendar credentials if you want calendar features
Running the Project
Start the MCP server:
python main.py
Start the Telegram bot:
python runTelegram.py
Once both are running, you can send messages to the bot in Telegram.
Example Usage
You can try requests such as:
- "Create a calendar event for tomorrow at 10:00"
- "Schedule a reminder for me at 8 PM"
- "Summarize the CSV file in the data folder"
Notes
- The repository includes some sample data files under src/functions/datafiles/.
- Reminder scheduling uses a local SQLite database file named reminders.db.
- Calendar integration uses a stored Google credentials file named token.pickle.
- The current implementation is intentionally minimal and serves as a starting point for expanding the bot with more tools and capabilities.
License
This project is distributed under the MIT License. See the LICENSE file for details.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。