{"id":27521179,"url":"https://github.com/jinzcdev/leetcode-mcp-server","last_synced_at":"2025-04-18T07:59:23.433Z","repository":{"id":287748384,"uuid":"965242185","full_name":"jinzcdev/leetcode-mcp-server","owner":"jinzcdev","description":"MCP server for LeetCode API, enabling advanced automation and intelligent interaction with LeetCode problems, contests, solutions and user data.","archived":false,"fork":false,"pushed_at":"2025-04-13T17:12:40.000Z","size":87,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-13T18:27:48.333Z","etag":null,"topics":["algorithm","leetcode","mcp","mcp-server"],"latest_commit_sha":null,"homepage":"","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}},"created_at":"2025-04-12T18:13:47.000Z","updated_at":"2025-04-13T17:11:43.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":1,"template":false,"template_full_name":null,"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","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249458971,"owners_count":21275807,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["algorithm","leetcode","mcp","mcp-server"],"created_at":"2025-04-18T07:59:22.827Z","updated_at":"2025-04-18T07:59:23.370Z","avatar_url":"https://github.com/jinzcdev.png","language":"TypeScript","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[![GitHub License](https://img.shields.io/github/license/jinzcdev/leetcode-mcp-server.svg)](https://img.shields.io/github/license/jinzcdev/leetcode-mcp-server.svg)\n[![Stars](https://img.shields.io/github/stars/jinzcdev/leetcode-mcp-server)](https://github.com/jinzcdev/leetcode-mcp-server)\n[![smithery badge](https://smithery.ai/badge/@jinzcdev/leetcode-mcp-server)](https://smithery.ai/server/@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**: Supports both leetcode.com and leetcode.cn platforms\n- **Problem Data Retrieval**: Obtain detailed problem descriptions, constraints, examples, and solution approaches\n- **User Data Access**: Retrieve user profiles, submission history, and contest performance\n- **Advanced Search Capabilities**: Filter problems by tags, difficulty levels, and categories\n- **Daily Challenge Tracking**: Easily access daily challenge problems\n\n## Prerequisites\n\n1. Node.js runtime environment\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 and run the server\nnpm run build \u0026\u0026 node 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 Code. Access this by pressing `Ctrl/Cmd + Shift + P` and searching for `Preferences: Open User Settings (JSON)`.\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## Environment Variables\n\nThe server supports the following environment variables:\n\n- `LEETCODE_SITE`: LeetCode API endpoint ('global' or 'cn')\n- `LEETCODE_SESSION`: LeetCode session cookie for authenticated API access\n\n**Priority Note**:  \nCommand-line arguments take precedence over environment variables when both are specified. For example:\n\n- If `LEETCODE_SITE=cn` is set but you run `leetcode-mcp-server --site global`, the server will use `global`.\n- If `LEETCODE_SESSION` exists but you provide `--session \"new_cookie\"`, the command-line session value will be used.\n\n## Tools\n\nThe server provides a comprehensive suite of tools categorized by functionality and platform compatibility.\n\n### Problem Tools\n\nAvailable on both Global and China sites, with optional authentication.\n\n| Tool Name                    | Description                                                       | Parameters                                                                                                                                                                                                                                                                                             |\n| ---------------------------- | ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| **leetcode_daily_challenge** | Retrieves today's LeetCode Daily Challenge with complete metadata | None                                                                                                                                                                                                                                                                                                   |\n| **leetcode_problem**         | Retrieves comprehensive details for a specified LeetCode problem  | `titleSlug` (string, required): Problem URL identifier (e.g., 'two-sum')                                                                                                                                                                                                                               |\n| **leetcode_search_problems** | Executes filtered searches across LeetCode problems               | `category` (string, optional): Problem classification\u003cbr\u003e`tags` (string[], optional): Topic tags filter\u003cbr\u003e`difficulty` (string, optional): Problem complexity level ('EASY', 'MEDIUM', 'HARD')\u003cbr\u003e`limit` (number, optional): Maximum results count\u003cbr\u003e`offset` (number, optional): Pagination offset |\n\n### User Tools\n\nProvides user-specific data across both platforms.\n\n| Tool Name                         | Description                                                | Parameters                                                                                                            |\n| --------------------------------- | ---------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |\n| **leetcode_user_profile**         | Retrieves complete profile information for a LeetCode user | `username` (string, required): LeetCode username                                                                      |\n| **leetcode_user_contest_ranking** | Obtains contest ranking statistics for a user              | `username` (string, required): LeetCode username\u003cbr\u003e`attended` (boolean, optional): Filter for attended contests only |\n\n### Global Site-Specific User Tools\n\nExclusive to leetcode.com platform.\n\n| Tool Name                          | Description                                             | Parameters                                                                                    |\n| ---------------------------------- | ------------------------------------------------------- | --------------------------------------------------------------------------------------------- |\n| **leetcode_recent_submissions**    | Retrieves a user's recent submission history (Global)   | `username` (string, required): LeetCode username\u003cbr\u003e`limit` (number, optional): Results limit |\n| **leetcode_recent_ac_submissions** | Retrieves a user's recent accepted submissions (Global) | `username` (string, required): LeetCode username\u003cbr\u003e`limit` (number, optional): Results limit |\n\n### China Site-Specific User Tools\n\nExclusive to leetcode.cn platform.\n\n| Tool Name                               | Description                                   | Parameters                                                                                          |\n| --------------------------------------- | --------------------------------------------- | --------------------------------------------------------------------------------------------------- |\n| **leetcode_user_recent_ac_submissions** | Retrieves recent accepted submissions (China) | `username` (string, required): LeetCode China username\u003cbr\u003e`limit` (number, optional): Results limit |\n\n### Authenticated Common Tools\n\nRequires session authentication, available on both platforms.\n\n| Tool Name                              | Description                                   | Parameters                                                                                                                                                                                                                     |\n| -------------------------------------- | --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| **leetcode_user_status**               | Retrieves authenticated user's current status | None                                                                                                                                                                                                                           |\n| **leetcode_problem_submission_detail** | Provides detailed submission analysis         | `id` (number, required): Submission ID                                                                                                                                                                                         |\n| **leetcode_user_progress_questions**   | Tracks user's problem-solving progress        | `offset` (number, required): Pagination offset\u003cbr\u003e`limit` (number, required): Results limit\u003cbr\u003e`questionStatus` (enum, optional): 'ATTEMPTED' or 'SOLVED' filter\u003cbr\u003e`difficulty` (string[], optional): Complexity level filter |\n\n### Global Site-Specific Authenticated Tools\n\nAuthenticated tools exclusive to leetcode.com.\n\n| Name                              | Description                                     | Parameters                                                                                                                                                  |\n| --------------------------------- | ----------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| **leetcode_user_all_submissions** | Retrieves paginated submission history (Global) | `limit` (number, required): Results limit\u003cbr\u003e`offset` (number, required): Pagination offset\u003cbr\u003e`questionSlug` (string, optional): Problem identifier filter |\n\n### China Site-Specific Authenticated Tools\n\nAuthenticated tools exclusive to leetcode.cn.\n\n| Tool Name                         | Description                                        | Parameters                                                                                                                                                                                                                                                                                                                |\n| --------------------------------- | -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| **leetcode_user_all_submissions** | Retrieves comprehensive submission history (China) | `limit` (number, required): Results limit\u003cbr\u003e`offset` (number, required): Pagination offset\u003cbr\u003e`questionSlug` (string, optional): Problem identifier\u003cbr\u003e`lang` (string, optional): Programming language filter\u003cbr\u003e`status` (string, optional): Submission status filter\u003cbr\u003e`lastKey` (string, optional): Pagination token |\n\n## Resources\n\nThe server provides reference resources for platform metadata access via URI endpoints.\n\n| Resource Name          | Description                                    | URI                                                                           |\n| ---------------------- | ---------------------------------------------- | ----------------------------------------------------------------------------- |\n| **problem-categories** | Complete problem classification categories     | `leetcode://problems/categories/all`                                          |\n| **problem-tags**       | Algorithmic and data structure tags collection | `leetcode://problems/tags/all`                                                |\n| **problem-langs**      | Supported programming languages list           | `leetcode://problems/langs/all`                                               |\n| **solution-article**   | A LeetCode solution article                    | global: `leetcode://solutions/{topicId}`\u003cbr\u003ecn: `leetcode://solutions/{slug}` |\n\n## Authentication\n\nAdvanced features require 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.","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"],"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"}