{"id":27521179,"url":"https://github.com/jinzcdev/leetcode-mcp-server","last_synced_at":"2026-05-02T06:33:49.639Z","repository":{"id":287748384,"uuid":"965242185","full_name":"jinzcdev/leetcode-mcp-server","owner":"jinzcdev","description":"An MCP server enabling automated access to LeetCode's problems, solutions, and public data with optional authentication for user-specific features, supporting leetcode.com \u0026 leetcode.cn sites.","archived":false,"fork":false,"pushed_at":"2026-03-18T09:02:21.000Z","size":321,"stargazers_count":99,"open_issues_count":4,"forks_count":19,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-19T00:20:55.475Z","etag":null,"topics":["ai","algorithm","lc","leetcode","llm","mcp","mcp-server"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@jinzcdev/leetcode-mcp-server","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jinzcdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-04-12T18:13:47.000Z","updated_at":"2026-03-18T09:02:21.000Z","dependencies_parsed_at":"2025-04-13T18:28:09.574Z","dependency_job_id":"559ef6bd-687a-4564-8bb6-acd60d8ad81a","html_url":"https://github.com/jinzcdev/leetcode-mcp-server","commit_stats":null,"previous_names":["jinzcdev/leetcode-mcp-server"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/jinzcdev/leetcode-mcp-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jinzcdev%2Fleetcode-mcp-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jinzcdev%2Fleetcode-mcp-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jinzcdev%2Fleetcode-mcp-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jinzcdev%2Fleetcode-mcp-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jinzcdev","download_url":"https://codeload.github.com/jinzcdev/leetcode-mcp-server/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jinzcdev%2Fleetcode-mcp-server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32525890,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-02T01:12:54.858Z","status":"online","status_checked_at":"2026-05-02T02:00:05.923Z","response_time":132,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","algorithm","lc","leetcode","llm","mcp","mcp-server"],"created_at":"2025-04-18T07:59:22.827Z","updated_at":"2026-05-02T06:33:49.632Z","avatar_url":"https://github.com/jinzcdev.png","language":"TypeScript","funding_links":[],"categories":["Productivity","Documentation \u0026 Learning Resources","🤖 AI/ML","サーバー実装","CI/CD \u0026 DevOps Pipelines","Coding Agents","Education and Learning","Uncategorized"],"sub_categories":["Learning \u0026 Flashcards","🤖 \u003ca name=\"coding-agents\"\u003e\u003c/a\u003eコーディングエージェント","🤖 Coding Agents","How to Submit","Uncategorized"],"readme":"# LeetCode MCP Server\n\n[![NPM Version](https://img.shields.io/npm/v/@jinzcdev/leetcode-mcp-server.svg)](https://www.npmjs.com/package/@jinzcdev/leetcode-mcp-server)\n[![NPM Downloads](https://img.shields.io/npm/dm/@jinzcdev/leetcode-mcp-server.svg)](https://www.npmjs.com/package/@jinzcdev/leetcode-mcp-server)\n[![GitHub License](https://img.shields.io/github/license/jinzcdev/leetcode-mcp-server.svg)](./LICENSE)\n[![Chinese Doc](https://img.shields.io/badge/简体中文-查看-orange)](README_zh-CN.md)\n[![Stars](https://img.shields.io/github/stars/jinzcdev/leetcode-mcp-server)](https://github.com/jinzcdev/leetcode-mcp-server)\n\nThe LeetCode MCP Server is a [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction) server that provides seamless integration with LeetCode APIs, enabling advanced automation and intelligent interaction with LeetCode's programming problems, contests, solutions, and user data.\n\n\u003ca href=\"https://glama.ai/mcp/servers/@jinzcdev/leetcode-mcp-server\"\u003e\n  \u003cimg width=\"380\" height=\"200\" src=\"https://glama.ai/mcp/servers/@jinzcdev/leetcode-mcp-server/badge\" alt=\"LeetCode Server MCP server\" /\u003e\n\u003c/a\u003e\n\n## Features\n\n- 🌐 **Multi-site Support**: Support​ both leetcode.com (Global) and leetcode.cn (China) platforms\n- 📊 **Problem Data Retrieval**: Obtain detailed problem descriptions, constraints, examples, official editorials, and ​user-submitted solutions\n- 👤 **User Data Access**: Retrieve user profiles, submission history, and contest performance\n- 🔒 **​Private Data Access**: Create and query user notes, track problem-solving progress, and analyze submission details (AC/WA analysis)\n- 🔍 **Advanced Search Capabilities**: Filter problems by tags, difficulty levels, categories, and keywords\n- 📅 **Daily Challenge Access**: Easily access daily challenge problems\n\n## Prerequisites\n\n1. Node.js (v20.x or above)\n2. (Optional) LeetCode session cookie for authenticated API access\n\n## Installation\n\n### Installing via Smithery\n\nTo install leetcode-mcp-server for Claude Desktop automatically via [Smithery](https://smithery.ai/server/@jinzcdev/leetcode-mcp-server):\n\n```bash\nnpx -y @smithery/cli install @jinzcdev/leetcode-mcp-server --client claude\n```\n\n### Manual Installation\n\n```bash\n# Install from npm\nnpm install @jinzcdev/leetcode-mcp-server -g\n\n# Or run with Global site configuration\nnpx -y @jinzcdev/leetcode-mcp-server --site global\n\n# Run with authentication (for accessing private data)\nnpx -y @jinzcdev/leetcode-mcp-server --site global --session \u003cYOUR_LEETCODE_SESSION_COOKIE\u003e\n```\n\nAlternatively, you can clone the repository and run it locally:\n\n```bash\n# Clone the repository\ngit clone https://github.com/jinzcdev/leetcode-mcp-server.git\n\n# Navigate to the project directory\ncd leetcode-mcp-server\n\n# Build the project\nnpm install \u0026\u0026 npm run build\n\n# Run the server\nnode build/index.js --site global\n```\n\n## Usage\n\n### Visual Studio Code Integration\n\nAdd the following JSON configuration to your User Settings (JSON) file. Access this by pressing `Ctrl/Cmd + Shift + P` and searching for `Preferences: Open User Settings (JSON)`.\n\n#### Option 1: Using Environment Variables\n\n```json\n{\n  \"mcp\": {\n    \"servers\": {\n      \"leetcode\": {\n        \"type\": \"stdio\",\n        \"command\": \"npx\",\n        \"args\": [\"-y\", \"@jinzcdev/leetcode-mcp-server\"],\n        \"env\": {\n          \"LEETCODE_SITE\": \"global\",\n          \"LEETCODE_SESSION\": \"\u003cYOUR_LEETCODE_SESSION_COOKIE\u003e\"\n        }\n      }\n    }\n  }\n}\n```\n\n#### Option 2: Using Command Line Arguments\n\n```json\n{\n  \"mcp\": {\n    \"servers\": {\n      \"leetcode\": {\n        \"type\": \"stdio\",\n        \"command\": \"npx\",\n        \"args\": [\n          \"-y\",\n          \"@jinzcdev/leetcode-mcp-server\",\n          \"--site\",\n          \"global\",\n          \"--session\",\n          \"\u003cYOUR_LEETCODE_SESSION_COOKIE\u003e\"\n        ]\n      }\n    }\n  }\n}\n```\n\nFor LeetCode China site, modify the `--site` parameter to `cn`.\n\n\u003e [!TIP]\n\u003e\n\u003e The server supports the following optional environment variables:\n\u003e\n\u003e - `LEETCODE_SITE`: LeetCode API endpoint ('global' or 'cn', default: 'global')\n\u003e - `LEETCODE_SESSION`: LeetCode session cookie for authenticated API access (default: empty)\n\u003e\n\u003e **Priority Note**:\n\u003e Command-line arguments take precedence over environment variables when both are specified. For example:\n\u003e\n\u003e - If `LEETCODE_SITE=cn` is set but you run `leetcode-mcp-server --site global`, the server will use `global`.\n\u003e - If `LEETCODE_SESSION` exists but you provide `--session \"new_cookie\"`, the command-line session value will be used.\n\n## Available Tools\n\n### Problems\n\n| Tool                    | Global | CN  | Auth Required | Description                                                  |\n| ----------------------- | :----: | :-: | :-----------: | ------------------------------------------------------------ |\n| **get_daily_challenge** |   ✅   | ✅  |      ❌       | Retrieves today's LeetCode Daily Challenge problem           |\n| **get_problem**         |   ✅   | ✅  |      ❌       | Retrieves details for a specific LeetCode problem            |\n| **search_problems**     |   ✅   | ✅  |      ❌       | Searches for LeetCode problems with multiple filter criteria |\n\n### Users\n\n| Tool                              | Global | CN  | Auth Required | Description                                                  |\n| --------------------------------- | :----: | :-: | :-----------: | ------------------------------------------------------------ |\n| **get_user_profile**              |   ✅   | ✅  |      ❌       | Retrieves profile information for a LeetCode user            |\n| **get_user_contest_ranking**      |   ✅   | ✅  |      ❌       | Obtains contest ranking statistics for a user                |\n| **get_recent_ac_submissions**     |   ✅   | ✅  |      ❌       | Retrieves a user's recent accepted submissions               |\n| **get_recent_submissions**        |   ✅   | ❌  |      ❌       | Retrieves a user's recent submissions history                |\n| **get_user_status**               |   ✅   | ✅  |      ✅       | Retrieves current user's current status                      |\n| **get_problem_submission_report** |   ✅   | ✅  |      ✅       | Provides detailed submission analysis for a specific problem |\n| **get_problem_progress**          |   ✅   | ✅  |      ✅       | Retrieves current user's problem-solving progress            |\n| **get_all_submissions**           |   ✅   | ✅  |      ✅       | Retrieves current user's submission history                  |\n\n### Submissions\n\n| Tool                | Global | CN  | Auth Required | Description                                                   |\n| ------------------- | :----: | :-: | :-----------: | ------------------------------------------------------------- |\n| **run_code**        |   ✅   | ✅  |      ✅       | Runs code for a problem and polls `/check/` until finished    |\n| **submit_solution** |   ✅   | ✅  |      ✅       | Submits code for a problem and polls `/check/` until finished |\n\n### Notes\n\n| Tool             | Global | CN  | Auth Required | Description                                           |\n| ---------------- | :----: | :-: | :-----------: | ----------------------------------------------------- |\n| **search_notes** |   ❌   | ✅  |      ✅       | Searches for user notes with filtering options        |\n| **get_note**     |   ❌   | ✅  |      ✅       | Retrieves notes for a specific problem by question ID |\n| **create_note**  |   ❌   | ✅  |      ✅       | Creates a new note for a specific problem             |\n| **update_note**  |   ❌   | ✅  |      ✅       | Updates an existing note with new content             |\n\n### Solutions\n\n| Tool                       | Global | CN  | Auth Required | Description                                                    |\n| -------------------------- | :----: | :-: | :-----------: | -------------------------------------------------------------- |\n| **list_problem_solutions** |   ✅   | ✅  |      ❌       | Retrieves a list of community solutions for a specific problem |\n| **get_problem_solution**   |   ✅   | ✅  |      ❌       | Retrieves the complete content of a specific solution          |\n\n## Tool Parameters\n\n### Problems\n\n- **get_daily_challenge** - Retrieves today's LeetCode Daily Challenge problem with complete details\n\n  - No parameters required\n\n- **get_problem** - Retrieves details about a specific LeetCode problem\n\n  - `titleSlug`: The URL slug/identifier of the problem (string, required)\n\n- **search_problems** - Searches for LeetCode problems based on multiple filter criteria\n  - `category`: Problem category filter (string, optional, default: \"all-code-essentials\")\n  - `tags`: List of topic tags to filter problems by (string[], optional)\n  - `difficulty`: Problem difficulty level filter (enum: \"EASY\", \"MEDIUM\", \"HARD\", optional)\n  - `searchKeywords`: Keywords to search in problem titles and descriptions (string, optional)\n  - `limit`: Maximum number of problems to return (number, optional, default: 10)\n  - `offset`: Number of problems to skip (number, optional)\n\n### Users\n\n- **get_user_profile** - Retrieves profile information about a LeetCode user\n\n  - `username`: LeetCode username (string, required)\n\n- **get_user_contest_ranking** - Retrieves a user's contest ranking information\n\n  - `username`: LeetCode username (string, required)\n  - `attended`: Whether to include only the contests the user has participated in (boolean, optional, default: true)\n\n- **get_recent_submissions** - Retrieves a user's recent submissions on LeetCode Global\n\n  - `username`: LeetCode username (string, required)\n  - `limit`: Maximum number of submissions to return (number, optional, default: 10)\n\n- **get_recent_ac_submissions** - Retrieves a user's recent accepted submissions\n\n  - `username`: LeetCode username (string, required)\n  - `limit`: Maximum number of submissions to return (number, optional, default: 10)\n\n- **get_user_status** - Retrieves the current user's status\n\n  - No parameters required\n\n- **get_problem_submission_report** - Retrieves detailed information about a specific submission\n\n  - `id`: The numerical submission ID (number, required)\n\n- **get_problem_progress** - Retrieves the current user's problem-solving progress\n\n  - `offset`: Number of questions to skip (number, optional, default: 0)\n  - `limit`: Maximum number of questions to return (number, optional, default: 100)\n  - `questionStatus`: Filter by question status (enum: \"ATTEMPTED\", \"SOLVED\", optional)\n  - `difficulty`: Filter by difficulty levels (string[], optional)\n\n- **get_all_submissions** - Retrieves paginated list of user's submissions\n  - `limit`: Maximum number of submissions to return (number, default: 20)\n  - `offset`: Number of submissions to skip (number, default: 0)\n  - `questionSlug`: Optional problem identifier (string, optional)\n  - `lang`: Programming language filter (string, optional, CN only)\n  - `status`: Submission status filter (enum: \"AC\", \"WA\", optional, CN only)\n  - `lastKey`: Pagination token for retrieving next page (string, optional, CN only)\n\n### Submissions\n\n- **run_code** - Runs code for a specific problem and waits until finished (requires authentication)\n\n  - `titleSlug`: The URL slug/identifier of the problem (string, required)\n  - `lang`: Programming language (string enum, required)\n  - `typedCode`: Source code to run (string, required)\n  - `dataInput`: Custom input to run (string, optional)\n  - `timeoutMs`: Polling timeout in milliseconds (number, optional, default: 120000)\n  - `pollIntervalMs`: Polling interval in milliseconds (number, optional, default: 1500)\n\n- **submit_solution** - Submits code for a specific problem and waits until finished (requires authentication)\n\n  - `titleSlug`: The URL slug/identifier of the problem (string, required)\n  - `lang`: Programming language (string enum, required)\n  - `typedCode`: Source code to submit (string, required)\n  - `timeoutMs`: Polling timeout in milliseconds (number, optional, default: 120000)\n  - `pollIntervalMs`: Polling interval in milliseconds (number, optional, default: 1500)\n\n### Notes\n\n- **search_notes** - Searches for user notes on LeetCode China\n\n  - `keyword`: Search term to filter notes (string, optional)\n  - `limit`: Maximum number of notes to return (number, optional, default: 10)\n  - `skip`: Number of notes to skip (number, optional, default: 0)\n  - `orderBy`: Sort order for returned notes (enum: \"ASCENDING\", \"DESCENDING\", optional, default: \"DESCENDING\")\n\n- **get_note** - Retrieves user notes for a specific LeetCode problem\n  - `questionId`: The question ID of the LeetCode problem (string, required)\n  - `limit`: Maximum number of notes to return (number, optional, default: 10)\n  - `skip`: Number of notes to skip (number, optional, default: 0)\n- **create_note** - Creates a new note for a specific LeetCode problem\n\n  - `questionId`: The question ID of the LeetCode problem (string, required)\n  - `content`: The content of the note, supports markdown format (string, required)\n  - `summary`: An optional short summary or title for the note (string, optional)\n\n- **update_note** - Updates an existing note with new content or summary\n  - `noteId`: The ID of the note to update (string, required)\n  - `content`: The new content for the note, supports markdown format (string, required)\n  - `summary`: An optional new short summary or title for the note (string, optional)\n\n### Solutions\n\n- **list_problem_solutions** - Retrieves a list of community solutions for a specific problem\n\n  - `questionSlug`: The URL slug/identifier of the problem (string, required)\n  - `limit`: Maximum number of solutions to return (number, optional, default: 10)\n  - `skip`: Number of solutions to skip (number, optional)\n  - `userInput`: Search term to filter solutions (string, optional)\n  - `tagSlugs`: Array of tag identifiers to filter solutions (string[], optional, default: [])\n  - `orderBy`: Sorting criteria for the returned solutions\n    - Global: enum: \"HOT\", \"MOST_RECENT\", \"MOST_VOTES\", optional, default: \"HOT\"\n    - CN: enum: \"DEFAULT\", \"MOST_UPVOTE\", \"HOT\", \"NEWEST_TO_OLDEST\", \"OLDEST_TO_NEWEST\", optional, default: \"DEFAULT\"\n\n- **get_problem_solution** - Retrieves the complete content of a specific solution\n  - `topicId`: Unique topic ID of the solution (string, required, Global only)\n  - `slug`: Unique slug/identifier of the solution (string, required, CN only)\n\n## Available Resources\n\n| Resource Name          | Global | CN  | Auth Required | Description                                                  |\n| ---------------------- | :----: | :-: | :-----------: | ------------------------------------------------------------ |\n| **problem-categories** |   ✅   | ✅  |      ❌       | A list of all problem classification categories              |\n| **problem-tags**       |   ✅   | ✅  |      ❌       | A detailed collection of algorithmic and data structure tags |\n| **problem-langs**      |   ✅   | ✅  |      ❌       | A complete list of all supported programming languages       |\n| **problem-detail**     |   ✅   | ✅  |      ❌       | Provides details about a specific problem                    |\n| **problem-solution**   |   ✅   | ✅  |      ❌       | Provides the complete content of a specific solution         |\n\n## Resource URIs\n\n- **problem-categories** - A list of all problem classification categories\n\n  - URI: `categories://problems/all`\n\n- **problem-tags** - A detailed collection of algorithmic and data structure tags\n\n  - URI: `tags://problems/all`\n\n- **problem-langs** - A complete list of all programming languages supported by LeetCode\n\n  - URI: `langs://problems/all`\n\n- **problem-detail** - Provides details about a specific LeetCode problem\n\n  - URI: `problem://{titleSlug}`\n  - Parameters:\n    - `titleSlug`: Problem identifier as it appears in the LeetCode URL\n\n- **problem-solution** - Provides the complete content of a specific solution\n  - Global URI: `solution://{topicId}`\n    - Parameters:\n      - `topicId`: Unique topic ID of the solution\n  - CN URI: `solution://{slug}`\n    - Parameters:\n      - `slug`: Unique slug/identifier of the solution\n\n## Authentication\n\nUser-specific data access requires LeetCode session authentication:\n\n1. Log in to LeetCode ([Global](https://leetcode.com) or [China](https://leetcode.cn) site)\n2. Extract `LEETCODE_SESSION` cookie from browser developer tools\n3. Configure server with `--session` flag or `LEETCODE_SESSION` environment variable\n\n## Response Format\n\nAll tools return JSON-formatted responses with the following structure:\n\n```json\n{\n  \"content\": [\n    {\n      \"type\": \"text\",\n      \"text\": \"JSON_DATA_STRING\"\n    }\n  ]\n}\n```\n\nThe `JSON_DATA_STRING` contains either the requested data or an error message for failed requests.\n\n## License\n\nThis project is licensed under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjinzcdev%2Fleetcode-mcp-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjinzcdev%2Fleetcode-mcp-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjinzcdev%2Fleetcode-mcp-server/lists"}