# interactive-leetcode-mcp [Health: Active]

**Category:** 🎓 Education  
**Repository:** https://github.com/SPerekrestova/interactive-leetcode-mcp  
**GitHub Stars:** 12  
**npm Downloads (last month):** 387  
**Views:** 2  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/interactive-leetcode-mcp

## Description
Interactive LeetCode MCP server with authorization and solution submission capabilities

## Tools
Capabilities this server exposes over MCP:

- **get_started** — Returns the usage guide for this MCP server: which prompts to invoke and when, session flow, auth flow, and submission language map. Call this at the start of any LeetCode practice session.
- **get_daily_challenge** — Retrieves today's LeetCode Daily Challenge problem with complete details, including problem description, constraints, and examples. After fetching, invoke the leetcode_learning_mode and leetcode_problem_workflow prompts before helping the user work on it.
- **get_problem** — Retrieves details about a specific LeetCode problem, including its description, examples, constraints, and related information. After fetching, invoke the leetcode_learning_mode and leetcode_problem_workflow prompts before helping the user work on it.
- **search_problems** — Searches for LeetCode problems based on multiple filter criteria including categories, tags, difficulty levels, and keywords, with pagination support
- **get_user_profile** — Retrieves profile information about a LeetCode user, including user stats, solved problems, and profile details
- **get_recent_submissions** — Retrieves a user's recent submissions on LeetCode Global, including both accepted and failed submissions with detailed metadata
- **get_recent_ac_submissions** — Retrieves a user's recent accepted (AC) submissions on LeetCode Global, focusing only on successfully completed problems
- **get_user_status** — Retrieves the current user's status on LeetCode, including login status, premium membership details, and user information (requires authentication)
- **get_problem_submission_report** — Retrieves detailed information about a specific LeetCode submission by its ID, including source code, runtime stats, and test results (requires authentication)
- **get_problem_progress** — Retrieves the current user's problem-solving status with filtering options, including detailed solution history for attempted or solved questions (requires authentication)
- **get_all_submissions** — Retrieves a paginated list of the current user's submissions for a specific problem or all problems on LeetCode Global, with detailed submission metadata (requires authentication)
- **get_user_contest_ranking** — Retrieves a user's contest ranking information on LeetCode, including overall ranking, participation history, and performance metrics across contests
- **start_problem** — Opens (or resumes) a tutoring session for a LeetCode problem. Must be called before request_hint, list_problem_solutions, or get_problem_solution. Idempotent: re-running on a slug the user is already mid-way through preserves their hint progress.
- **request_hint** — Advances the hint level for an active session and returns the next hint. Levels: 1 clarification → 2 approach → 3 implementation sketch → 4 solution unlock. The community-solutions tools become callable only after this has been driven to level 4.
- **get_session_state** — Returns the persisted session for a problem, or null if the user has not called start_problem for it. Useful for restoring context after a restart.
- **reset_session** — Resets the tutoring session for a problem back to hint level 0. Use when the user wants to re-attempt the problem from scratch.
- **list_problem_solutions** — Retrieves community solution metadata (topicIds) for a problem. GATED: rejects with HINT_LEVEL_TOO_LOW unless the active session for the slug has reached the maximum hint level. Drive the user through request_hint until that level is reached.
- **get_problem_solution** — Retrieves the full content of a specific community solution. GATED: rejects with HINT_LEVEL_TOO_LOW unless the session for `titleSlug` has reached the maximum hint level. Pass the topicId returned by `list_problem_solutions`.
- **run_local_tests** — Runs the user's code locally in an isolated subprocess, captures stdout / stderr / exit code, and updates the session's lastLocalRunPassed flag. Use this in the inner loop instead of submit_solution — it costs no LeetCode submission and turns around in seconds. The agent is responsible for including test invocations (e.g. `print(Solution().twoSum([2,7,11,15], 9))`) in the code passed in. Currently runnable: python3, go, and java.
- **runner_doctor** — Reports which language runtimes (python3, go, java) and OS sandbox tools (bwrap, firejail, sandbox-exec) are detected on this host. Useful for diagnosing 'LANGUAGE_RUNTIME_NOT_FOUND' errors and confirming whether run_local_tests will be sandboxed.
- **start_leetcode_auth** — Initiates LeetCode authentication flow. Opens browser to LeetCode login (if possible) and provides instructions for the AI agent to guide the user through manual credential extraction from browser DevTools.
- **save_leetcode_credentials** — Validates and saves LeetCode credentials provided by the user. Validates credentials by making a test API call to LeetCode, then securely stores them for future authenticated requests.
- **check_auth_status** — Checks if LeetCode credentials exist and are still valid. Returns authentication status, username if authenticated, and credential age information.
- **submit_solution** — Submit a solution to a LeetCode problem and get results. Returns acceptance status, runtime/memory stats, or failed test case details. When LEETCODE_MCP_STRICT_MODE=1 is set, requires `run_local_tests` to have last passed for the problem first — saves real LeetCode submissions for solutions that pass examples locally.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "interactive-leetcode-mcp": {
    "command": "npx",
    "args": ["-y","@sperekrestova/interactive-leetcode-mcp@latest"]
  }
}
```

## Documentation

## What interactive-leetcode-mcp MCP server does

The interactive-leetcode-mcp MCP server connects an MCP-compatible client with LeetCode practice workflows. It can retrieve the daily challenge, search problems, fetch problem descriptions, and start a tracked practice session. The session supports progressive hints and can unlock community or editorial solution content after the configured hint progression.

Authentication uses LeetCode cookie values. The agent can initiate the login guidance, accept `csrftoken` and `LEETCODE_SESSION` values, validate them with a test API request, and save them for later use. Authentication status includes the username and credential age, with a warning when credentials may be nearing expiration.

## How it works

The interactive-leetcode-mcp MCP server is intended for conversational practice. An agent can load the usage guide, obtain a problem, open or resume a session, and help the user work through the problem with hints. The learning flow emphasizes understanding the problem, planning an approach, implementing it, checking complexity, and reviewing the result.

For local validation, the server checks which supported language runtimes are available and runs code against sample cases in a local subprocess sandbox. For remote evaluation, it submits code to LeetCode and returns acceptance status, runtime, memory use, or a failed test case. Supported language examples include Java, Python, C++, JavaScript, and TypeScript.

## Setup and configuration

Install the published package globally with npm, run it through `npx`, or build it from source. The documented runtime prerequisite is Node.js 20.x or newer. A browser is needed for the interactive login process, and a LeetCode account is required for authenticated features.

Claude Code can register the server with its CLI using the stdio transport. Claude Code and Claude Desktop can also load an MCP configuration that starts `npx` with the package, or starts Node against a locally built `build/index.js` file. The repository recommends a clean package smoke test for checking installation and CLI availability; completing the MCP handshake requires a separate stdio integration test.

## Tools and capabilities

The interactive-leetcode-mcp MCP server provides tools for:

- Authentication and credential status.
- Daily challenges, problem lookup, filtering, and pagination.
- Practice sessions, hint progression, session state, and resets.
- Local runtime checks and sample-test execution.
- Community or editorial solution listing and retrieval after hint unlock.
- Code submission with result details.
- Profiles, submission history, accepted submissions, progress, reports, and contest rankings.

Learning mode can also guide workspace setup by creating a file named for the problem slug and using an extension associated with the selected language.

## Limitations and notes

The project is under active development, and its documentation cautions that it may not work perfectly. Remote submission and user-data features depend on valid LeetCode credentials, while local execution depends on the relevant language runtime being installed. Solution-listing tools are gated by the practice session's hint level rather than being available immediately.

The provided setup examples document Claude Code and Claude Desktop specifically. Credentials are entered through the guided browser flow and may expire, so authentication status should be checked when requests fail or stored credentials become old.

_Full upstream README: https://allmcps.com/mcp/interactive-leetcode-mcp/readme_

