Skip to content

rdarshan927/tough

Repository files navigation

Tough Chat - Full Stack AI Assistant

A powerful full-stack chat application with MCP (Model Context Protocol) integration for Google Calendar, Tasks, and Notes. Built with React + TypeScript frontend and Python backend.

🌐 Live Demo: https://rdarshan927.github.io/tough

✨ Features

Core Features

  • πŸ€– Multi-Provider AI Support: Works with Groq, OpenAI, Anthropic, Together AI, and Ollama
  • 🎨 Beautiful Modern UI: Dark mode interface with syntax highlighting
  • πŸ“ Rich Markdown Support: Code blocks, tables, lists, and more
  • πŸ” Secure Backend: API keys stored server-side, not in browser

MCP Integration (New!)

  • πŸ“… Google Calendar: View, create, update, and delete calendar events
  • βœ… Google Tasks: Manage your todo lists with natural language
  • πŸ““ Notes System: Create and manage notes with AI assistance
  • πŸ”— OAuth2 Authentication: Secure Google account integration

Technical Features

  • πŸ’Ύ Persistent Storage: API keys and OAuth tokens securely stored
  • 🐳 Docker Ready: Easy deployment with Docker Compose
  • πŸš€ Fast & Responsive: Built with Vite for lightning-fast development
  • πŸ›‘οΈ Type-Safe: Full TypeScript coverage on frontend and backend

πŸ—οΈ Architecture

Frontend (React + TypeScript)
      ↓ HTTP/REST API
Backend (Python + Flask)
      ↓ MCP Protocol
Google APIs (Calendar, Tasks) + Notes (File-based)

πŸš€ Quick Start

Automated Setup (Recommended)

git clone https://github.com/rdarshan927/tough.git
cd "TOUGH CHAT"
./setup.sh

Then follow the on-screen instructions to configure your API keys.

Manual Setup

See SETUP.md for detailed instructions.

πŸ“¦ Project Structure

TOUGH CHAT/
β”œβ”€β”€ tough/
β”‚   β”œβ”€β”€ front-end/              # Frontend (React + TypeScript)
β”‚   β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”‚   β”œβ”€β”€ Chat.tsx       # Main chat interface
β”‚   β”‚   β”‚   β”œβ”€β”€ Chat-v2.tsx    # Backend-connected version
β”‚   β”‚   β”‚   β”œβ”€β”€ Store.ts       # Redux state management
β”‚   β”‚   β”‚   └── api/
β”‚   β”‚   β”‚       └── client.ts  # API client for backend
β”‚   β”‚   β”œβ”€β”€ Dockerfile
β”‚   β”‚   β”œβ”€β”€ docker-compose.yml
β”‚   β”‚   └── package.json
β”‚   β”‚
β”‚   └── tough-backend/          # Backend (Python + Flask)
β”‚       β”œβ”€β”€ src/
β”‚       β”‚   β”œβ”€β”€ __init__.py    # Package initialization
β”‚       β”‚   β”œβ”€β”€ app.py         # Flask application (placeholder)
β”‚       β”‚   β”œβ”€β”€ routes/        # API routes (to be implemented)
β”‚       β”‚   └── services/      # Business logic (to be implemented)
β”‚       β”œβ”€β”€ tests/             # Test files
β”‚       β”œβ”€β”€ data/              # Notes storage (auto-created)
β”‚       β”œβ”€β”€ tokens/            # OAuth tokens (auto-created)
β”‚       β”œβ”€β”€ requirements.txt   # Python dependencies
β”‚       └── venv/              # Virtual environment (auto-created)
β”‚
β”œβ”€β”€ SETUP.md                    # Detailed setup guide
β”œβ”€β”€ ARCHITECTURE.md             # System architecture
β”œβ”€β”€ IMPLEMENTATION.md           # Implementation details
β”œβ”€β”€ README.md                   # This file
└── setup.sh                    # Automated setup script

🎯 Usage Examples

Basic Chat

You: "Hello! What can you do?"
AI: "I'm Tough Agent! I can help you with various tasks including..."

Calendar Management

You: "What's on my calendar today?"
AI: "Let me check your calendar... [lists today's events]"

You: "Create a meeting tomorrow at 2 PM for project review"
AI: "I've created the event 'Project Review' for tomorrow at 2:00 PM"

Task Management

You: "Show me my todo list"
AI: "Here are your current tasks: [lists tasks]"

You: "Add a task to buy groceries"
AI: "I've added 'Buy groceries' to your task list"

Notes

You: "Create a note about today's standup meeting"
AI: "I've created a note with the title 'Standup Meeting'..."

πŸ”§ Configuration

Backend (.env)

# Required: At least one AI provider
GROQ_API_KEY=your_key_here
OPENAI_API_KEY=your_key_here

# Required: For Google integration
GOOGLE_CLIENT_ID=your_client_id
GOOGLE_CLIENT_SECRET=your_client_secret
GOOGLE_REDIRECT_URI=http://localhost:3001/api/auth/google/callback

# Server config
PORT=3001
FRONTEND_URL=http://localhost:5173

Frontend (.env)

VITE_API_URL=http://localhost:3001/api

🐳 Docker Deployment

Development

docker-compose up -d

Production

docker-compose -f docker-compose.prod.yml up -d

Access the app at http://localhost:3000

πŸ“š API Documentation

Chat Endpoint

POST /api/chat
Content-Type: application/json

{
  "messages": [
    { "role": "user", "content": "Hello!" }
  ],
  "provider": "groq",
  "model": "llama-3.3-70b-versatile"
}

MCP Tools Endpoint

POST /api/mcp/execute
Content-Type: application/json

{
  "toolName": "calendar_list_events",
  "parameters": {
    "startDate": "2025-10-25",
    "maxResults": 10
  }
}

See SETUP.md for complete API documentation.

πŸ› οΈ Development

Frontend Development

cd tough/front-end
npm run dev

Backend Development

cd tough/tough-backend
source venv/bin/activate  # Activate virtual environment
python -m src.app         # Run the Flask app

Build for Production

# Frontend
cd tough/front-end
npm run build

# Backend - Using Gunicorn
cd tough/tough-backend
source venv/bin/activate
gunicorn -w 4 -b 0.0.0.0:3001 "src.app:create_app()"

πŸ”’ Security

  • βœ… API keys stored server-side only
  • βœ… OAuth tokens encrypted and stored securely
  • βœ… CORS configured for frontend access only
  • βœ… Helmet.js for security headers
  • βœ… Environment variables for sensitive data
  • βœ… No sensitive data in browser localStorage

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

πŸ“§ Support

πŸ—ΊοΈ Roadmap

  • Add more MCP tools (Gmail, Drive, etc.)
  • Implement conversation history persistence
  • Add user authentication and multi-user support
  • Mobile app development
  • Voice input/output support
  • Plugin system for custom MCP tools

Made with ❀️ by the Tough Team

About

Open Source - Simple WebApp for storing your personal API and interacting with LLM models. Live @ https://rdarshan927.github.io/tough

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages