Skip to content

klee1611/leetcode-srs

Repository files navigation

LeetCode SRS Manager

A spaced repetition system (SRS) for LeetCode problems using MCP (Model Context Protocol) and Groq AI.

Features

  • 📝 Add problems with difficulty ratings (AGAIN, HARD, GOOD, EASY)
  • 📅 Track review schedules with spaced repetition algorithm
  • 📚 List all completed problems
  • 🔄 Submit reviews to adjust future intervals
  • 🤖 AI-powered interface via Groq (Llama models)

Setup

  1. Install dependencies:
uv sync
  1. Configure environment variables in .env:
GROQ_API_KEY="your-groq-api-key-here"
DB_FILE="leetcode_srs.db"

Get a free API key at: https://console.groq.com/

  1. Run database migrations:
uv run migrate.py

Database Migrations

The project uses a simple migration system to manage database schema changes.

Commands

  • Apply pending migrations:

    uv run migrate.py
  • Check migration status:

    uv run migrate.py status
  • Create a new migration:

    uv run migrate.py create <migration_name>

Migration Files

Migrations are stored in migrations/ directory with format: NNN_description.sql

Example migration:

-- Migration: Add new column
-- Created: 2026-01-21
-- Description: Add last_reviewed_at column

ALTER TABLE problems ADD COLUMN last_reviewed_at TIMESTAMP;

Usage

Start the Client

uv run --env-file .env client_groq.py

Available MCP Tools

  1. add_new_problem - Add a newly completed problem

    • project: Project name (e.g., "LeetCode")
    • title: Problem title
    • url: Problem URL
    • rating: Difficulty (AGAIN/HARD/GOOD/EASY, default: GOOD)
  2. list_all_problems - List all problems with completion dates

    • project: Optional filter by project name
  3. get_todays_reviews - Get problems due for review today

  4. submit_review - Submit a review and update schedule

    • project: Project name
    • title: Problem title
    • rating: Performance rating (AGAIN/HARD/GOOD/EASY)

Spaced Repetition Algorithm

Initial intervals:

  • AGAIN/HARD: 1 day
  • GOOD: 2 days
  • EASY: 4 days

Review multipliers:

  • AGAIN: Reset to 1 day
  • HARD: × 1.2
  • GOOD: × 2.5
  • EASY: × 4.0

Development

The project consists of:

  • server.py - MCP server with tools
  • client_groq.py - Groq AI client with Llama models
  • migrate.py - Database migration manager
  • migrations/ - SQL migration files

License

MIT

Why Groq?

The client uses Groq's llama-3.3-70b-versatile model which offers:

  • ⚡ Extremely fast inference (using Groq's LPU technology)
  • 💰 Lower cost compared to other providers
  • 🆓 Generous free tier available
  • 🧠 Powerful 70B parameter model
  • 🔧 Full function calling support

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages