{
  "markdown": "# Interactive LeetCode MCP\n\n[![npm version](https://img.shields.io/npm/v/@sperekrestova/interactive-leetcode-mcp.svg)](https://www.npmjs.com/package/@sperekrestova/interactive-leetcode-mcp)\n[![npm downloads](https://img.shields.io/npm/dm/@sperekrestova/interactive-leetcode-mcp.svg)](https://www.npmjs.com/package/@sperekrestova/interactive-leetcode-mcp)\n[![GitHub stars](https://img.shields.io/github/stars/SPerekrestova/interactive-leetcode-mcp)](https://github.com/SPerekrestova/interactive-leetcode-mcp)\n[![MCP Registry](https://badge.mcpx.dev?status=on)](https://registry.modelcontextprotocol.io/v0.1/servers/io.github.SPerekrestova%2Finteractive-leetcode-mcp/versions/latest)\n[![GitHub license](https://img.shields.io/github/license/SPerekrestova/interactive-leetcode-mcp)](https://github.com/SPerekrestova/interactive-leetcode-mcp/blob/main/LICENSE)\n\n> Current project is under active development and may not work perfectly\n\n## Features\n\n<video src=\"https://github.com/user-attachments/assets/935bbc9f-7199-417e-8987-fd6cd60b8fb5\"></video>\n\n- 🔐 **AI-guided authentication** - Claude walks you through one-time credential setup\n- 🎓 **Learning-guided mode** - AI provides hints before solutions to maximize learning\n- 📝 **Solution submission** - Submit code and get instant results\n- 💬 **Conversational workflow** - Practice naturally with Claude Code\n- 🌍 **Multi-language support** - Java, Python, C++, JavaScript, TypeScript, and more\n- 📊 **Detailed feedback** - Runtime stats, memory usage, failed test cases\n- 📚 **Problem data** - Descriptions, constraints, examples, editorial solutions\n- 👤 **User tracking** - Profile data, submission history, contest rankings\n\n## Prerequisites\n\n- Node.js v20.x or above\n- LeetCode account\n- Any modern web browser (Chrome, Firefox, Safari, Edge, etc.)\n\n## Installation\n\n### Via NPM (Recommended)\n\n```bash\nnpm install -g @sperekrestova/interactive-leetcode-mcp\ninteractive-leetcode-mcp --version\ninteractive-leetcode-mcp --help\n```\n\nYou can also run the package without installing it globally:\n\n```bash\nnpx -y @sperekrestova/interactive-leetcode-mcp@latest --version\n```\n\n### From Source\n\n```bash\ngit clone https://github.com/SPerekrestova/interactive-leetcode-mcp.git\ncd interactive-leetcode-mcp\nnpm install && npm run build\nnpm link\n```\n\n### Fresh Environment Smoke Test\n\nUse this to verify the published npm package from a clean directory without any\nLeetCode credentials:\n\n```bash\nmkdir leetcode-mcp-smoke\ncd leetcode-mcp-smoke\nnpm init -y\nnpm install @sperekrestova/interactive-leetcode-mcp\nnpx --no-install interactive-leetcode-mcp --version\nnpx --no-install interactive-leetcode-mcp --help\n```\n\nThose commands confirm that Node can install the package and expose the CLI\nbinary. For actual MCP server validation, use an integration test that connects\nover stdio and completes the MCP handshake.\n\n## Configuration\n\n### Claude Code & Claude Desktop\n\nYou can execute this command in CLI\n\n```bash\nclaude mcp add --transport stdio leetcode -- npx -y @sperekrestova/interactive-leetcode-mcp@latest\n```\n\nOr add to your MCP configuration file (`~/.config/claude-code/mcp.json`) or (`~/Library/Application Support/Claude/claude_desktop_config.json`):\n\n```json\n{\n  \"mcpServers\": {\n    \"leetcode\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@sperekrestova/interactive-leetcode-mcp@latest\"]\n    }\n  }\n}\n```\n\n### Local build\n\n```json\n{\n  \"mcpServers\": {\n    \"leetcode\": {\n      \"command\": \"node\",\n      \"args\": [\"/path/to/this/project/interactive-leetcode-mcp/build/index.js\"]\n    }\n  }\n}\n```\n\n## Quick Start\n\n### 1. Authorize with LeetCode\n\n```\nYou: \"Authorize with LeetCode\"\nClaude: [Opens LeetCode in your browser and guides you through the process]\nClaude: \"Please log in to your account. Once logged in, I'll walk you through\n        getting two cookie values we need. First, press F12 to open DevTools...\"\nYou: [Follows Claude's step-by-step guidance]\nYou: \"Here are my cookies: csrftoken is abc123... and LEETCODE_SESSION is xyz789...\"\nClaude: \"✓ Perfect! Your credentials are validated and saved. Welcome back, johndoe!\"\n```\n\n### 2. Practice a Problem\n\n```\nYou: \"I want to practice two-sum\"\nClaude: [Fetches problem and creates working file]\n```\n\n### 3. Get Help When Stuck\n\n```\nYou: \"Give me a hint\"\nClaude: [Provides contextual guidance based on your code]\n```\n\n### 4. Submit Your Solution\n\n```\nYou: \"Submit my solution\"\nClaude: \"🎉 Accepted! Runtime: 2ms (beats 95.3%)\"\n```\n\n## Available Tools\n\n### Getting Started\n\n**`get_started`**\n\n- Returns the server usage guide, learning flow, authentication flow, and\n  submission language map\n- Call this at the start of a LeetCode practice session\n\n### Authorization\n\n**`start_leetcode_auth`**\n\n- Initiates authentication flow\n- Opens browser to LeetCode login (when possible)\n- Returns structured instructions for AI agent to guide you\n- No parameters required\n\n**`save_leetcode_credentials`**\n\n- Validates and saves your LeetCode credentials\n- Parameters: `csrftoken`, `session` (cookie values you provide)\n- Makes test API call to verify credentials\n- Securely stores credentials for future use\n\n**`check_auth_status`**\n\n- Checks if you're authenticated\n- Returns username and credential age\n- Warns if credentials may expire soon\n- No parameters required\n\n### Problem Tools\n\n**`get_daily_challenge`**\n\n- Fetch today's daily coding challenge\n\n**`get_problem`**\n\n- Get detailed problem information by slug\n- Parameters: `titleSlug` (e.g., \"two-sum\")\n\n**`search_problems`**\n\n- Search problems by difficulty, tags, keywords\n- Supports filtering and pagination\n\n### Session and Learning Tools\n\n**`start_problem`**\n\n- Opens or resumes a tutoring session for a problem\n- Parameters: `titleSlug`, optional `language`\n- Required before problem-specific hint and solution tools\n\n**`request_hint`**\n\n- Advances progressive hint levels for the active session\n- Parameters: `titleSlug`\n- Unlocks community solution tools after the final hint level\n\n**`get_session_state`**\n\n- Shows current hint level and session metadata\n- Parameters: `titleSlug`\n\n**`reset_session`**\n\n- Resets hint progress for a problem\n- Parameters: `titleSlug`\n\n### Local Runner Tools\n\n**`runner_doctor`**\n\n- Reports which local runtimes are available for supported languages\n\n**`run_local_tests`**\n\n- Runs user code against sample tests in a local subprocess sandbox\n- Parameters: `titleSlug`, `language`, `code`, optional `timeoutMs`\n\n### Solution Tools\n\n**`list_problem_solutions`**\n\n- Lists community/editorial solution articles for a problem\n- Parameters: `questionSlug`, optional `limit`, `skip`, `orderBy`, `userInput`,\n  `tagSlugs`\n- Requires the session to reach the solution-unlocked hint level\n\n**`get_problem_solution`**\n\n- Fetches a specific solution article\n- Parameters: `topicId`, `titleSlug`\n- Requires the session to reach the solution-unlocked hint level\n\n### Submission Tools\n\n**`submit_solution`**\n\n- Submit code and get real-time results\n- Parameters: `problemSlug`, `code`, `language`\n- Returns: acceptance status, runtime, memory, or failed test case\n\n### User Tools\n\n**`get_user_profile`**\n\n- Retrieve user profile information\n\n**`get_recent_submissions`**\n\n- Get submission history with filtering\n\n**`get_recent_ac_submissions`**\n\n- Get recent accepted submissions\n\n**`get_user_status`**\n\n- Get authenticated user's status/profile summary\n\n**`get_problem_submission_report`**\n\n- Get submission report for one problem\n\n**`get_problem_progress`**\n\n- Get solved/attempted progress for a problem\n\n**`get_all_submissions`**\n\n- Get paginated submission history\n\n**`get_user_contest_ranking`**\n\n- View contest performance and rankings\n\n## Learning Mode\n\nThe Interactive LeetCode MCP includes AI agent guidance through MCP Prompts to create a better learning experience.\n\n### Features\n\n**Workspace Setup:**\nWhen learning mode is active, Claude will:\n\n- Create a workspace file named `{problem-slug}.{extension}`\n- Paste the code template into the file\n- Set up proper naming conventions (e.g., Java class names)\n\n**Learning-Guided Mode:**\nWhen active, Claude follows these guidelines:\n\n- Provides progressive hints (4 levels) before revealing solutions\n- Asks guiding questions about approach and complexity\n- Encourages independent problem-solving\n- Only shows complete solutions when explicitly requested\n\n**Problem Workflow:**\nGuides you through the complete cycle:\n\n1. Understand the problem\n2. Plan the approach\n3. Set up workspace\n4. Implement with hints\n5. Optimize and analyze complexity\n6. Submit and review results\n\n### How to Use Learning Mode\n\nTo activate learning mode, tell Claude you want to practice with guidance — for example, \"Let's practice in learning mode\" or \"I want to learn two-sum with hints.\" Once active:\n\n1. **Call `get_started`** to load the server's usage guide\n2. **Fetch a problem** with `get_daily_challenge`, `search_problems`, or\n   `get_problem`\n3. **Open a session** with `start_problem`\n4. **Ask for hints** via `request_hint` rather than jumping straight to solutions\n5. **Implement your solution** with progressive guidance\n6. **Request the solution** only after the final hint level or when you want to\n   compare with an optimal approach\n\n## Dogfood Testing\n\nTo test the MCP server as a black-box MCP client without live LeetCode traffic:\n\n```bash\nnpm run dogfood:local\n```\n\nThis builds the server, spawns `build/index.js` over stdio, connects with the\nMCP SDK client, uses an isolated `HOME`, serves LeetCode responses from fixtures,\nand drives a user-like flow through `runner_doctor`, `start_problem`,\n`request_hint`, `run_local_tests`, and `get_session_state`.\n\nSee [DOGFOOD_TESTING.md](DOGFOOD_TESTING.md) for the full workflow and a\ncopy-paste prompt for local Claude/agent dogfood testing.\n\n## Troubleshooting\n\n**\"Not authorized\" or \"Invalid credentials\" error**\n\n- Ask Claude to \"Authorize with LeetCode\" to start fresh authentication\n- Make sure you're logged into LeetCode in your browser before extracting cookies\n- Verify you copied the complete cookie values (they can be very long)\n- Check that you didn't accidentally copy extra spaces or characters\n\n**\"Credentials have expired\"**\n\n- LeetCode cookies typically expire after 7-14 days\n- Simply ask Claude to \"Authorize with LeetCode\" again\n- You'll need to extract fresh cookies from your browser\n\n**Can't find DevTools or cookies**\n\n- Ask Claude which browser you're using - Claude will provide browser-specific instructions\n- In Chrome: Press F12, click \"Application\" tab, expand \"Cookies\"\n- In Firefox: Press F12, click \"Storage\" tab, expand \"Cookies\"\n- In Safari: Enable Developer menu first (Preferences → Advanced), then Develop → Show Web Inspector\n\n**Copied wrong values**\n\n- Make sure you're copying the VALUE column, not the name\n- The values should be long random strings (50+ characters)\n- Double-click the value to select all of it before copying\n- If you're unsure, Claude can guide you through the process again\n\n**Browser doesn't open during authorization**\n\n- That's okay! Just open https://leetcode.com/accounts/login/ manually\n- Claude will still guide you through the cookie extraction process\n\n**\"Unsupported language\" error**\n\n- Supported languages: java, python, python3, cpp, c++, javascript, js, typescript, ts\n\n**Submission timeout**\n\n- LeetCode may be experiencing high traffic - wait and retry\n- Check your internet connection\n\n## Skills & Plugins\n\nThis repo also ships an **agent skill** that teaches Claude (and other AI agents) how to use the MCP server correctly — including session flow, prompt invocations, learning mode, and authentication.\n\n### Claude Code Plugin\n\nInstall the skill directly as a Claude Code plugin:\n\n```\n/plugin marketplace add SPerekrestova/interactive-leetcode-mcp\n/plugin install interactive-leetcode-mcp@interactive-leetcode-mcp\n```\n\nThen start a practice session with:\n\n```\n/interactive-leetcode-mcp:interactive-leetcode-mcp\n```\n\n### ClawHub (OpenClaw / Clawbot)\n\nThe skill is also published on [ClawHub](https://clawhub.ai/SPerekrestova/interactive-leetcode) for use with OpenClaw-compatible agents.\n\n## Acknowledgements\n\nForked from [Leetcode mcp](https://github.com/jinzcdev/leetcode-mcp-server))\n\n## License\n\nMIT © SPerekrestova\n\n## Links\n\n- [NPM Package](https://www.npmjs.com/package/@sperekrestova/interactive-leetcode-mcp)\n- [Report Issues](https://github.com/SPerekrestova/interactive-leetcode-mcp/issues)\n- [MCP Documentation](https://modelcontextprotocol.io)\n",
  "bytes": 12424,
  "sha": "bd1b2af5952b25f4477493c7e731c1f33c3aaf40a7a9722ca8eafc0f2d598589",
  "repo_slug": "sperekrestova/interactive-leetcode-mcp",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_sperekrestova_interactive_leet_f32d50b4/readme"
}