sandeepkmishra01-glitch/smart-email-mcp
If you are the rightful owner of smart-email-mcp 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.
Smart Email MCP Server is a robust Model Context Protocol server designed for intelligent email processing and seamless Telegram integration, utilizing OAuth authentication for secure Gmail account access.
Smart Email MCP Server
A powerful Model Context Protocol (MCP) server that provides intelligent email processing and Telegram integration with OAuth authentication for Gmail accounts.
š Features
- š§ Multi-Account Email Monitoring: Monitor multiple Gmail accounts simultaneously
- š¤ Telegram Bot Integration: Interact with your emails via Telegram commands
- š OAuth 2.0 Authentication: Secure authentication for Gmail accounts
- š Web Interface: Beautiful web dashboard for email management
- š Real-time Notifications: Get instant notifications for new emails
- š Smart Email Processing: Intelligent email filtering and categorization
- š± Mobile-Friendly: Responsive design for mobile devices
š Quick Start
Prerequisites
- Python 3.8 or higher
- Gmail accounts with OAuth 2.0 enabled
- Telegram Bot Token
Installation
-
Clone the repository
git clone https://github.com/yourusername/smart-email-mcp.git cd smart-email-mcp
-
Install dependencies
cd mcp-server pip install -r requirements.txt
-
Configure OAuth credentials
- Set up Google Cloud Console project
- Enable Gmail API
- Create OAuth 2.0 credentials
- Download
credentials.json
tomcp-server/
directory
-
Set up environment variables
cp env.example .env # Edit .env with your configuration
-
Run OAuth setup
python multi_oauth_setup.py
-
Start the MCP server
python run_mcp_server.py
š Project Structure
smart-email-mcp/
āāā mcp-server/ # Main application directory
ā āāā src/ # Source code
ā ā āāā mcp_server.py # Main MCP server
ā ā āāā email_utils/ # Email processing utilities
ā ā āāā telegram_bot/ # Telegram bot implementation
ā ā āāā subagents/ # MCP subagents
ā āāā config/ # Configuration files
ā āāā data/ # Data storage
ā āāā logs/ # Application logs
ā āāā requirements.txt # Python dependencies
ā āāā .env # Environment variables
ā āāā run_mcp_server.py # Standard MCP server startup
āāā .gitignore # Git ignore rules
āāā README.md # This file
āāā start_mcp_server.bat # Windows startup script
š§ Configuration
Environment Variables (.env)
# Telegram Bot Configuration
TELEGRAM_BOT_TOKEN=your_telegram_bot_token
TELEGRAM_CHAT_ID=your_chat_id
# Gmail OAuth Configuration
GOOGLE_CLIENT_ID=your_client_id
GOOGLE_CLIENT_SECRET=your_client_secret
GOOGLE_REDIRECT_URI=http://localhost:8080/callback
# Server Configuration
HOST=localhost
PORT=8000
DEBUG=True
# Email Configuration
EMAIL_CHECK_INTERVAL=300 # 5 minutes
MAX_EMAILS_PER_CHECK=50
OAuth Setup
-
Google Cloud Console Setup
- Create a new project
- Enable Gmail API
- Create OAuth 2.0 credentials
- Add authorized redirect URIs
-
Run OAuth Authentication
python multi_oauth_setup.py
This will:
- Authenticate your personal Gmail account
- Authenticate your Georgetown email account
- Generate OAuth tokens
š¤ Telegram Bot Commands
Once the server is running, you can interact with your emails via Telegram:
/start
- Initialize the bot/help
- Show available commands/status
- Check server status/emails
- Get recent emails/search <query>
- Search emails/monitor
- Toggle email monitoring/settings
- Configure preferences
š Web Interface
Access the web interface at http://localhost:8000
to:
- View email dashboard
- Manage email accounts
- Configure settings
- View system logs
- Monitor server status
š MCP Protocol Features
This server implements the Model Context Protocol (MCP) with:
- Standard HTTP responses (200 OK)
- Persistent connections
- Regular polling intervals
- Graceful error handling
- Process monitoring
- Comprehensive logging
š Security Features
- OAuth 2.0 Authentication: Secure Gmail access
- Environment Variables: Sensitive data protection
- Token Management: Automatic token refresh
- Input Validation: Secure command processing
- Error Handling: Graceful failure management
š ļø Development
Running in Development Mode
cd mcp-server
python run_mcp_server.py
Running with Standard Protocol
cd mcp-server
python run_mcp_server.py
Windows Quick Start
Double-click start_mcp_server.bat
or run:
start_mcp_server.bat
š Logging
The application provides comprehensive logging:
- Application Logs:
mcp_server.log
- Email Processing: Real-time email monitoring logs
- Telegram Bot: Bot interaction logs
- Error Tracking: Detailed error information
š§ Troubleshooting
Common Issues
-
OAuth Authentication Failed
- Verify Google Cloud Console setup
- Check credentials.json file
- Ensure redirect URI is correct
-
Telegram Bot Not Responding
- Verify bot token in .env
- Check internet connection
- Ensure bot is not blocked
-
Email Not Being Monitored
- Check OAuth tokens are valid
- Verify Gmail API is enabled
- Check email check interval settings
Debug Mode
Enable debug mode in .env
:
DEBUG=True
š License
This project is licensed under the MIT License - see the LICENSE file for details.
š¤ Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
š Support
For support and questions:
- Create an issue on GitHub
- Check the troubleshooting section
- Review the logs for error details
š Updates
To update the application:
git pull origin main
pip install -r requirements.txt
python run_mcp_server.py
Built with ā¤ļø for intelligent email management