Skip to main content
Glama

learn-mcp

An MCP server for agent-guided DSA practice. Connect it to an IDE agent (Claude Code, Cursor, etc.) and instead of static LeetCode problems, the agent generates immersive, LeetCode-style problems on demand and tutors you through them — escalating hints, concept explanations, and multi-step think-throughs.

The server provides structure and memory (problems, sessions, hint escalation, progress); the connected agent provides the creativity and teaching. No LLM runs inside the server.

Install

Install once from GitHub — it builds itself on install and exposes a learn-mcp command:

npm install -g github:abp2204/learn-mcp

Then register it with any MCP-capable agent. Because it's a global command, the config is the same in every folder — and so is your progress (one store in your home dir).

Claude Code:

claude mcp add learn-mcp -- learn-mcp

Cursor / Claude Desktop / any client (mcpServers config):

{
  "mcpServers": {
    "learn-mcp": { "command": "learn-mcp" }
  }
}

Prefer not to install globally? Use npx instead — same effect, nothing installed:

{
  "mcpServers": {
    "learn-mcp": { "command": "npx", "args": ["-y", "github:abp2204/learn-mcp"] }
  }
}

Now open any project in your agent and say "generate me a medium graph problem" — it works regardless of which folder you're in.

From source (development)

git clone https://github.com/abp2204/learn-mcp && cd learn-mcp
npm install      # builds via the prepare script
npm run dev      # run from TS source (stdio)
npm run inspect  # explore the tools in the MCP Inspector

Related MCP server: LeetCode MCP Server

How a session goes

  1. You ask the agent for, say, a medium graph problem with a story.

  2. Agent authors it and calls generate_problem → it's stored with a stable id.

  3. start_session drops you into the problem (answers hidden).

  4. Stuck? get_hint escalates 1 → 4 (nudge → near-solution); the server tracks the level so hints don't over-reveal. explain_concept teaches an underlying idea. next_step advances multi-step problems.

  5. submit_solution records your attempt; a pass marks it solved.

  6. progress shows what you've solved and which topics are weak.

Tools

Tool

Purpose

generate_problem

Store an agent-authored, LeetCode-style problem

start_session

Begin a session; returns the solver-facing problem + sessionId

get_hint

Advance the escalating hint level (server-tracked)

explain_concept

Record/echo a taught concept

submit_solution

Record an attempt; pass solves the session

next_step

Advance a multi-step problem

progress

Single-user stats, solved-by-difficulty, weak topics

Plus an author_problem MCP prompt: a rubric the agent can pull in to write well-calibrated, immersive problems.

Storage

One global SQLite file in your home dir — ~/.learn-mcp/learn.sqlite (respects XDG_DATA_HOME; override with the LEARN_MCP_DB env var). This is why your problems and progress are shared across every folder and agent, and survive restarts. Uses Node's built-in node:sqlite, so there's no native build step. The server prints the active store path to stderr on startup.

Status

v1. Solutions are agent-judged (the agent evaluates your code and reports pass/fail). A sandboxed code executor with generated test cases is the planned next step. Domain is DSA; DSP is a parked future idea.

Development

See CLAUDE.md for architecture and conventions. Run the end-to-end test with:

node scripts/smoke.mjs

Requires Node 22.5+ (uses built-in node:sqlite).

Available Tools

7 tools
explain_conceptExplain conceptB

Record that a concept was taught during a session (keeps the flow's timeline honest) and echo the concept back. YOU write the explanation. Optionally tie it to a session for progress tracking.

Inputs: concept (required), sessionId.

generate_problemGenerate problemA

Store an agent-authored, LeetCode-style DSA problem and return its id/slug. YOU (the agent) write the creative, immersive content; this tool persists it with structure so it can be practiced in a session. For multi-step problems, provide steps. Provide a referenceApproach (hidden from the solver) to ground hints and judging.

Inputs: title (required), prompt (required), topics (required), examples (required), +6 more.

get_hintGet hintA

Advance the hint escalation for a session. Returns the level and guidance on HOW deep a hint to give at this level — YOU write the actual hint, grounded in the problem's referenceApproach. Levels run 1 (nudge) to 4 (near-solution).

Inputs: sessionId (required).

next_stepNext stepB

Advance a multi-step problem to its next stage and return that step's prompt (its referenceApproach stays hidden). Errors if the problem is single-step or already at the last step.

Inputs: sessionId (required).

progressProgressA

Single-user practice stats across all sessions: solved counts by difficulty, and per-topic attempted/solved (use to surface weak areas).

Inputs: no named parameters.

start_sessionStart sessionB

Begin a practice session for a stored problem. Returns the solver-facing problem (answers hidden) and a sessionId to use for hints, submissions, and steps.

Inputs: problemId (required).

submit_solutionSubmit solutionA

Record a solution attempt. In v1 judging is agent-side: YOU evaluate the code against the examples + referenceApproach and pass your verdict ('pass'/'fail') plus feedback. A 'pass' marks the session solved.

Inputs: code (required), verdict (required), sessionId (required), feedback, +1 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 7 tools

    Disambiguation5/5

    Each tool targets a distinct action in the learning workflow—explain, create, hint, step, progress, session, submit—with no overlap.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun snake_case pattern (e.g., explain_concept, start_session).

    Tool Count5/5

    Seven tools is well-scoped for a learning MCP server, covering concept recording, problem generation, session management, hints, and progress tracking.

    Completeness4/5

    The core learning loop is covered, but there is no tool to list or browse existing problems, which agents might need to select a problem for a session.

    Related MCP Connectors

    Related MCP Servers