Get the FREE Ultimate OpenClaw Setup Guide →

interactive-leetcode

An MCP server enabling guided DSA learning with AI on leetcode.com

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio sperekrestova-interactive-leetcode-mcp npx -y @sperekrestova/interactive-leetcode-mcp

How to use

Interactive LeetCode MCP provides an AI-assisted workflow to practice LeetCode problems through Claude-guided prompts. It supports authentication with LeetCode, problem retrieval and exploration, and code submission across multiple languages. Core tools exposed by the MCP server include: getting daily or specific problem details, submitting solutions and receiving real-time feedback, and a learning mode that offers progressively hint-based guidance before revealing full solutions. You can also fetch user profile and submission history to track progress. To use it, connect via the MCP client (Claude integration or your preferred MCP consumer) and run the available commands to authorize, select a problem, and submit your solution. The workflow is designed to simulate a guided problem-solving session with AI-assisted prompts to help you learn and improve your approach.

How to install

Prerequisites:

  • Node.js v20.x or above
  • npm (bundled with Node.js)
  • A modern web browser for LeetCode interaction

Installation (recommended):

  1. Install the MCP server package globally:
npm install -g @sperekrestova/interactive-leetcode-mcp
  1. Verify installation:
interactive-leetcode-mcp --version
  1. (Optional) Build from source if you prefer cloning the repo:
git clone https://github.com/SPerekrestova/interactive-leetcode-mcp.git
cd interactive-leetcode-mcp
npm install && npm run build
npm link
  1. Run the MCP server locally (example):
npx -y @sperekrestova/interactive-leetcode-mcp

Prerequisites recap:

  • Ensure Node.js is installed and accessible in your PATH
  • Have a LeetCode account for authentication flow
  • Ensure you have a suitable browser for the authentication steps when prompted

Additional notes

Tips and common considerations:

  • Authentication: The flow relies on LeetCode cookie-based authentication. Follow Claude's prompts to authorize, then provide the required cookies (csrftoken and LEETCODE_SESSION) when prompted.
  • Credentials expiry: LeetCode cookies may expire; re-authenticate via the MCP workflow when you encounter credentials expiry messages.
  • Language support: Supported languages include java, python, python3, cpp, c++, javascript, js, typescript, ts. Ensure you choose a compatible language when submitting solutions.
  • Troubleshooting: If the browser doesn’t open during authorization, you can manually navigate to https://leetcode.com/accounts/login/ and continue with the provided prompts. For issues with cookies, copy the VALUE of the cookie fields exactly and avoid extra spaces.
  • Environment variables: The MCP config can be extended with environment variables if your deployment requires API keys or custom endpoints. Start with an empty env block and populate as needed.
  • Usage with Claude: The MCP is designed to work with Claude prompts to guide the learning process. You can enable learning mode to receive hints before solutions and to work through problems step-by-step.

Related MCP Servers

Sponsor this space

Reach thousands of developers