TelegramBotMCP

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.

Category
Visit Server

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

  1. Clone the repository.

  2. Create and activate a virtual environment.

  3. Install dependencies:

    pip install -e .
    
  4. Create a .env file with the required environment variables.

  5. 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.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured