amirdhs/mcp_server
If you are the rightful owner of mcp_server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
This MCP server provides a Telegram AI agent that can interact with Gmail, Google Calendar, and Google Tasks using the Ionos AI model.
MCP Server Setup Instructions
This MCP server provides a Telegram AI agent that can interact with Gmail, Google Calendar, and Google Tasks using the Ionos AI model.
Prerequisites
- Python 3.8 or higher
- Google Cloud Project with APIs enabled
- Telegram Bot Token
- Ionos AI API Key
Step 1: Install Dependencies
pip install -r requirements.txt
Step 2: Google Cloud Setup
- Go to Google Cloud Console
- Create a new project or select existing one
- Enable the following APIs:
- Gmail API
- Google Calendar API
- Google Tasks API
- Create OAuth2 credentials:
- Go to "Credentials" ā "Create Credentials" ā "OAuth client ID"
- Choose "Desktop application"
- Download the JSON file and rename it to
credentials.json
- Place it in the same directory as your script
Step 3: Telegram Bot Setup
- Message @BotFather on Telegram
- Use
/newbot
command to create a new bot - Follow the instructions and get your bot token
- Copy the token to your
.env
file
Step 4: Ionos AI Setup
- Get your API key from Ionos AI service
- Add it to your
.env
file
Step 5: Environment Configuration
- Copy
.env.example
to.env
- Fill in all the required values:
cp .env.example .env
# Edit .env with your actual values
Step 6: First Run and Authentication
- Run the server for the first time:
python mcp_server.py
-
The script will prompt you to authenticate with Google:
- A URL will be displayed
- Open it in your browser
- Grant permissions
- Copy the authorization code back to the terminal
-
Your credentials will be saved in
token.pickle
for future use
Usage
Available Tools
- send_telegram_message: Send messages via Telegram
- search_gmail: Search Gmail messages
- create_calendar_event: Create Google Calendar events
- create_task: Create Google Tasks
- ai_chat: Chat with Ionos AI model
Telegram Commands
/start
- Initialize the bot- Send any message to chat with the AI
Example Interactions
Search Gmail:
"Search for emails from john@example.com"
Create Calendar Event:
"Create a meeting for tomorrow at 2 PM for 1 hour about project review"
Create Task:
"Add a task to review the quarterly report by Friday"
File Structure
āāā mcp_server.py # Main MCP server
āāā requirements.txt # Python dependencies
āāā .env # Environment variables
āāā credentials.json # Google OAuth2 credentials
āāā token.pickle # Saved Google authentication token
āāā README.md # This file
Security Notes
- Keep your
.env
file secure and never commit it to version control - The
token.pickle
file contains sensitive authentication data - Use HTTPS in production environments
- Regularly rotate your API keys
Troubleshooting
Common Issues
- "ModuleNotFoundError": Make sure all dependencies are installed
- "Authentication failed": Check your Google credentials and re-run authentication
- "Telegram bot not responding": Verify your bot token and network connection
- "Ionos AI errors": Check your API key and rate limits
Logs
The server logs important events. Check the console output for error messages and debugging information.
Development
To extend functionality:
- Add new tools in the
setup_handlers()
method - Implement corresponding methods for each tool
- Update the resource list if needed
- Test thoroughly before deploying
Production Deployment
For production use:
- Use a process manager like systemd or supervisord
- Set up proper logging
- Configure firewall rules
- Use environment-specific configuration
- Set up monitoring and alerting
API Rate Limits
Be aware of API rate limits:
- Gmail API: 1 billion quota units per day
- Calendar API: 1 million requests per day
- Tasks API: 50,000 requests per day
- Ionos AI: Check your plan limits
Support
For issues or questions:
- Check the logs for error messages
- Verify all credentials are correct
- Test individual components separately
- Check API status pages for service outages