Skip to content
Back to search

mcp-server-leetcode

The LeetCode MCP Server is a Model Context Protocol (MCP) server that provides seamless integration with LeetCode APIs, enabling advanced automation and intelligent interaction with LeetCode's…

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/iamrudhresh--mcp-server-leetcode/badge.svg)](/listings/iamrudhresh--mcp-server-leetcode)

HTML

<a href="/listings/iamrudhresh--mcp-server-leetcode"><img src="/api/listings/iamrudhresh--mcp-server-leetcode/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

# Install from npm
npm install @iamrudhresh/mcp-server-leetcode -g

# Run with Global site configuration (stdio transport, default)
npx -y @iamrudhresh/mcp-server-leetcode --site global

# Run with authentication (for accessing private data)
npx -y @iamrudhresh/mcp-server-leetcode --site global --session <YOUR_LEETCODE_SESSION_COOKIE>

# Run as a Streamable HTTP server
npx -y @iamrudhresh/mcp-server-leetcode --transport http --port 3000 --site global

Alternatively, you can clone the repository and run it locally:

# Clone the repository
git clone https://github.com/iamrudhresh/mcp-server-leetcode.git

# Navigate to the project directory
cd leetcode-mcp-server

# Build the project
npm install && npm run build

# Run the server (stdio transport)
node build/index.js --site global

# Or run as a Streamable HTTP server
node build/index.js --transport http --port 3000 --site global

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 497 lines
  1. # LeetCode MCP Server
  2. [![NPM Version](https://img.shields.io/npm/v/@iamrudhresh/mcp-server-leetcode.svg)](https://www.npmjs.com/package/@iamrudhresh/mcp-server-leetcode)
  3. [![Chinese Doc](https://img.shields.io/badge/docs-中文-blue)](README_zh-CN.md)
  4. [![NPM Downloads](https://img.shields.io/npm/dm/@iamrudhresh/mcp-server-leetcode.svg)](https://www.npmjs.com/package/@iamrudhresh/mcp-server-leetcode)
  5. [![GitHub License](https://img.shields.io/github/license/iamrudhresh/mcp-server-leetcode.svg)](./LICENSE)
  6. [![LeetCode MCP Server on Glama](https://glama.ai/mcp/servers/iamrudhresh/mcp-server-leetcode/badges/score.svg)](https://glama.ai/mcp/servers/iamrudhresh/mcp-server-leetcode)
  7. [![Stars](https://img.shields.io/github/stars/iamrudhresh/mcp-server-leetcode)](https://github.com/iamrudhresh/mcp-server-leetcode)
  8. [![Docs](https://img.shields.io/badge/docs-GitHub%20Pages-orange)](docs/index.html)
  9. The 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.
  10. 👉 **[Explore Interactive Documentation & Configurator (GitHub Pages)](docs/index.html)**
  11. ## Features
  12. - 🌐 **Multi-site Support**: Support both leetcode.com (Global) and leetcode.cn (China) platforms
  13. - 🔌 **Dual Transport Modes**: Run as a stdio process (default) or as a [Streamable HTTP](https://modelcontextprotocol.io/docs/concepts/transports) server for web-based integrations
  14. - 📊 **Problem Data Retrieval**: Obtain detailed problem descriptions, constraints, examples, official editorials, and user-submitted solutions
  15. - 💻 **Starter Code Snippets**: Extract exact language boilerplate code (`get_code_snippet`) for 20+ supported languages
  16. - 🎲 **Random Problem Practice**: Pick random problems (`get_random_problem`) filtered by difficulty or tags
  17. - 🏆 **Contest Schedules & Tracking**: Query upcoming Weekly/Biweekly contest schedules (`get_upcoming_contests`) and user contest rankings
  18. - 💬 **MCP Prompts**: First-class prompt workflows for non-spoiler progressive hints (`get_hint`), problem breakdown (`explain_problem`), code review (`code_review`), and mock interviews (`mock_interview`)
  19. - 👤 **User Data Access**: Retrieve user profiles, submission history, and contest performance
  20. - 🔒 **Private Data Access**: Create and query user notes, manage problem lists, track problem-solving progress, and analyze submission details (AC/WA analysis)
  21. - 🔍 **Advanced Search Capabilities**: Filter problems by tags, difficulty levels, categories, and keywords
  22. - 📅 **Daily Challenge Access**: Easily access daily challenge problems
  23. ## Prerequisites
  24. 1. Node.js (v20.x or above)
  25. 2. (Optional) LeetCode session cookie for authenticated API access
  26. ## Installation
  27. ```bash
  28. # Install from npm
  29. npm install @iamrudhresh/mcp-server-leetcode -g
  30. # Run with Global site configuration (stdio transport, default)
  31. npx -y @iamrudhresh/mcp-server-leetcode --site global
  32. # Run with authentication (for accessing private data)
  33. npx -y @iamrudhresh/mcp-server-leetcode --site global --session <YOUR_LEETCODE_SESSION_COOKIE>
  34. # Run as a Streamable HTTP server
  35. npx -y @iamrudhresh/mcp-server-leetcode --transport http --port 3000 --site global
  36. ```
  37. Alternatively, you can clone the repository and run it locally:
  38. ```bash
  39. # Clone the repository
  40. git clone https://github.com/iamrudhresh/mcp-server-leetcode.git
  41. # Navigate to the project directory
  42. cd leetcode-mcp-server
  43. # Build the project
  44. npm install && npm run build
  45. # Run the server (stdio transport)
  46. node build/index.js --site global
  47. # Or run as a Streamable HTTP server
  48. node build/index.js --transport http --port 3000 --site global
  49. ```
  50. ## Usage
  51. The server supports two transport modes:
  52. | Transport | Description |
  53. | ----------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
  54. | `stdio` (default) | Standard input/output transport for local MCP clients |
  55. | `http` | [Streamable HTTP](https://modelcontextprotocol.io/docs/concepts/transports) transport for web-based integrations and remote access |
  56. ### Command-Line Options
  57. | Option | Alias | Default | Description |
  58. | ------------- | ----- | ----------- | ---------------------------------------------------------------- |
  59. | `--site` | `-s` | `global` | LeetCode API site: `global` (leetcode.com) or `cn` (leetcode.cn) |
  60. | `--session` | `-c` | — | LeetCode session cookie for authenticated requests |
  61. | `--transport` | `-t` | `stdio` | Transport mode: `stdio` or `http` |
  62. | `--port` | — | `3000` | HTTP server port (Streamable HTTP only) |
  63. | `--host` | — | `127.0.0.1` | HTTP server host (Streamable HTTP only) |
  64. | `--endpoint` | — | `/mcp` | HTTP endpoint path (Streamable HTTP only) |
  65. ### MCP Client Configuration (stdio)
  66. Add the following server entry to your MCP client configuration file:
  67. #### Option 1: Using Environment Variables
  68. ```json
  69. {
  70. "mcpServers": {
  71. "leetcode": {
  72. "command": "npx",
  73. "args": ["-y", "@iamrudhresh/mcp-server-leetcode"],
  74. "env": {
  75. "LEETCODE_SITE": "global",
  76. "LEETCODE_SESSION": "<YOUR_LEETCODE_SESSION_COOKIE>"
  77. }
  78. }
  79. }
  80. }
  81. ```
  82. #### Option 2: Using Command Line Arguments
  83. ```json
  84. {
  85. "mcpServers": {
  86. "leetcode": {
  87. "command": "npx",
  88. "args": [
  89. "-y",
  90. "@iamrudhresh/mcp-server-leetcode",
  91. "--site",
  92. "global",
  93. "--session",
  94. "<YOUR_LEETCODE_SESSION_COOKIE>"
  95. ]
  96. }
  97. }
  98. }
  99. ```
  100. For LeetCode China site, modify the `--site` parameter to `cn`.
  101. > [!NOTE]
  102. >
  103. > The exact configuration file location and JSON structure may vary by MCP client. Some clients use an `mcp.servers` wrapper or a `type` field — refer to your client's documentation and adapt the example accordingly.
  104. ### MCP Client Configuration (Streamable HTTP)
  105. First, start the server in HTTP mode:
  106. ```bash
  107. npx -y @iamrudhresh/mcp-server-leetcode --transport http --port 3000 --site global
  108. ```
  109. Then connect your MCP client to the running server:
  110. ```json
  111. {
  112. "mcpServers": {
  113. "leetcode": {
  114. "type": "http",
  115. "url": "http://127.0.0.1:3000/mcp"
  116. }
  117. }
  118. }
  119. ```
  120. To use authenticated endpoints, pass the session cookie when starting the server:
  121. ```bash
  122. npx -y @iamrudhresh/mcp-server-leetcode --transport http --port 3000 --site global --session <YOUR_LEETCODE_SESSION_COOKIE>
  123. ```
  124. > [!NOTE]
  125. > Some MCP clients use `"type": "http"` or `"type": "streamableHttp"` alongside the `url` field. Refer to your client's documentation for the exact HTTP transport configuration format.
  126. > [!TIP]
  127. >
  128. > The server supports the following optional environment variables:
  129. >
  130. > - `LEETCODE_SITE`: LeetCode API endpoint (`global` or `cn`, default: `global`)
  131. > - `LEETCODE_SESSION`: LeetCode session cookie for authenticated API access (default: empty)
  132. > - `LEETCODE_TRANSPORT`: Transport mode (`stdio` or `http`, default: `stdio`)
  133. > - `LEETCODE_HTTP_PORT`: HTTP server port when using Streamable HTTP (default: `3000`)
  134. > - `LEETCODE_HTTP_HOST`: HTTP server host when using Streamable HTTP (default: `127.0.0.1`)
  135. > - `LEETCODE_HTTP_ENDPOINT`: HTTP endpoint path when using Streamable HTTP (default: `/mcp`)
  136. >
  137. > **Priority Note**:
  138. > Command-line arguments take precedence over environment variables when both are specified. For example:
  139. >
  140. > - If `LEETCODE_SITE=cn` is set but you run `leetcode-mcp-server --site global`, the server will use `global`.
  141. > - If `LEETCODE_SESSION` exists but you provide `--session "new_cookie"`, the command-line session value will be used.
  142. ## Available Tools
  143. ### Problems
  144. | Tool | Global | CN | Auth Required | Description |
  145. | ----------------------- | :----: | :-: | :-----------: | ------------------------------------------------------------ |
  146. | **get_daily_challenge** | ✅ | ✅ | ❌ | Retrieves today's LeetCode Daily Challenge problem |
  147. | **get_problem** | ✅ | ✅ | ❌ | Retrieves details for a specific LeetCode problem |
  148. | **search_problems** | ✅ | ✅ | ❌ | Searches for LeetCode problems with multiple filter criteria |
  149. | **get_code_snippet** | ✅ | ✅ | ❌ | Extracts language-specific boilerplate starter code |
  150. | **get_random_problem** | ✅ | ✅ | ❌ | Selects a random problem filtered by difficulty or tags |
  151. ### Contests
  152. | Tool | Global | CN | Auth Required | Description |
  153. | ---------------------------- | :----: | :-: | :-----------: | ------------------------------------------------------------ |
  154. | **get_upcoming_contests** | ✅ | ✅ | ❌ | Retrieves upcoming Weekly & Biweekly contest schedule & URLs |
  155. | **get_user_contest_ranking** | ✅ | ✅ | ❌ | Obtains contest ranking statistics for a user |
  156. ### Prompts
  157. | Prompt | Description |
  158. | ------------------- | ------------------------------------------------------------------------------------------------- |
  159. | **explain_problem** | Step-by-step intuitive explanation breaking down problem constraints, patterns, and edge cases |
  160. | **get_hint** | Progressive, non-spoiler hints (Level 1: Intuition, Level 2: Data Structure, Level 3: Pseudocode) |
  161. | **code_review** | Evaluates submitted code for time/space complexity, correctness, edge cases, and style |
  162. | **mock_interview** | Simulates an interactive technical coding interview in a senior FAANG interviewer persona |
  163. ### Users
  164. | Tool | Global | CN | Auth Required | Description |
  165. | --------------------------------- | :----: | :-: | :-----------: | ------------------------------------------------------------ |
  166. | **get_user_profile** | ✅ | ✅ | ❌ | Retrieves profile information for a LeetCode user |
  167. | **get_user_contest_ranking** | ✅ | ✅ | ❌ | Obtains contest ranking statistics for a user |
  168. | **get_recent_ac_submissions** | ✅ | ✅ | ❌ | Retrieves a user's recent accepted submissions |
  169. | **get_recent_submissions** | ✅ | ❌ | ❌ | Retrieves a user's recent submissions history |
  170. | **get_user_status** | ✅ | ✅ | ✅ | Retrieves current user's current status |
  171. | **get_problem_submission_report** | ✅ | ✅ | ✅ | Provides detailed submission analysis for a specific problem |
  172. | **get_problem_progress** | ✅ | ✅ | ✅ | Retrieves current user's problem-solving progress |
  173. | **get_all_submissions** | ✅ | ✅ | ✅ | Retrieves current user's submission history |
  174. ### Submissions
  175. | Tool | Global | CN | Auth Required | Description |
  176. | ------------------- | :----: | :-: | :-----------: | ------------------------------------------------------------- |
  177. | **run_code** | ✅ | ✅ | ✅ | Runs code for a problem and polls `/check/` until finished |
  178. | **submit_solution** | ✅ | ✅ | ✅ | Submits code for a problem and polls `/check/` until finished |
  179. ### Notes
  180. | Tool | Global | CN | Auth Required | Description |
  181. | ---------------- | :----: | :-: | :-----------: | ----------------------------------------------------- |
  182. | **search_notes** | ❌ | ✅ | ✅ | Searches for user notes with filtering options |
  183. | **get_note** | ❌ | ✅ | ✅ | Retrieves notes for a specific problem by question ID |
  184. | **create_note** | ❌ | ✅ | ✅ | Creates a new note for a specific problem |
  185. | **update_note** | ❌ | ✅ | ✅ | Updates an existing note with new content |
  186. ### Problem Lists
  187. | Tool | Global | CN | Auth Required | Description |
  188. | ----------------------------- | :----: | :-: | :-----------: | ------------------------------------------------------------ |
  189. | **list_problem_lists** | ✅ | ✅ | ✅ | Lists the current user's problem lists (favorites) |
  190. | **get_problem_list** | ✅ | ✅ | ✅ | Retrieves a problem list's metadata and its questions |
  191. | **create_problem_list** | ✅ | ✅ | ✅ | Creates a new problem list, optionally with initial problems |
  192. | **update_problem_list** | ✅ | ✅ | ✅ | Renames a problem list, edits its description or visibility |
  193. | **add_problems_to_list** | ✅ | ✅ | ✅ | Adds problems to a problem list by slug or problem number |
  194. | **remove_problems_from_list** | ✅ | ✅ | ✅ | Removes problems from a problem list |
  195. | **reorder_problem_list** | ✅ | ✅ | ✅ | Reorders the problems inside a problem list |
  196. ### Solutions
  197. | Tool | Global | CN | Auth Required | Description |
  198. | -------------------------- | :----: | :-: | :-----------: | -------------------------------------------------------------- |
  199. | **list_problem_solutions** | ✅ | ✅ | ❌ | Retrieves a list of community solutions for a specific problem |
  200. | **get_problem_solution** | ✅ | ✅ | ❌ | Retrieves the complete content of a specific solution |
  201. ## Tool Parameters
  202. ### Problems
  203. - **get_daily_challenge** - Retrieves today's LeetCode Daily Challenge problem with complete details
  204. - No parameters required
  205. - **get_problem** - Retrieves details about a specific LeetCode problem
  206. - `titleSlug`: The URL slug/identifier of the problem (string, required)
  207. - **search_problems** - Searches for LeetCode problems based on multiple filter criteria
  208. - `category`: Problem category filter (string, optional, default: "all-code-essentials")
  209. - `tags`: List of topic tags to filter problems by (string[], optional)
  210. - `difficulty`: Problem difficulty level filter (enum: "EASY", "MEDIUM", "HARD", optional)
  211. - `searchKeywords`: Keywords to search in problem titles and descriptions (string, optional)
  212. - `limit`: Maximum number of problems to return (number, optional, default: 10)
  213. - `offset`: Number of problems to skip (number, optional)
  214. ### Users
  215. - **get_user_profile** - Retrieves profile information about a LeetCode user
  216. - `username`: LeetCode username (string, required)
  217. - **get_user_contest_ranking** - Retrieves a user's contest ranking information
  218. - `username`: LeetCode username (string, required)
  219. - `attended`: Whether to include only the contests the user has participated in (boolean, optional, default: true)
  220. - **get_recent_submissions** - Retrieves a user's recent submissions on LeetCode Global
  221. - `username`: LeetCode username (string, required)
  222. - `limit`: Maximum number of submissions to return (number, optional, default: 10)
  223. - **get_recent_ac_submissions** - Retrieves a user's recent accepted submissions
  224. - `username`: LeetCode username (string, required)
  225. - `limit`: Maximum number of submissions to return (number, optional, default: 10)
  226. - **get_user_status** - Retrieves the current user's status
  227. - No parameters required
  228. - **get_problem_submission_report** - Retrieves detailed information about a specific submission
  229. - `id`: The numerical submission ID (number, required)
  230. - **get_problem_progress** - Retrieves the current user's problem-solving progress
  231. - `offset`: Number of questions to skip (number, optional, default: 0)
  232. - `limit`: Maximum number of questions to return (number, optional, default: 100)
  233. - `questionStatus`: Filter by question status (enum: "ATTEMPTED", "SOLVED", optional)
  234. - `difficulty`: Filter by difficulty levels (string[], optional)
  235. - **get_all_submissions** - Retrieves paginated list of user's submissions
  236. - `limit`: Maximum number of submissions to return (number, default: 20)
  237. - `offset`: Number of submissions to skip (number, default: 0)
  238. - `questionSlug`: Optional problem identifier (string, optional)
  239. - `lang`: Programming language filter (string, optional, CN only)
  240. - `status`: Submission status filter (enum: "AC", "WA", optional, CN only)
  241. - `lastKey`: Pagination token for retrieving next page (string, optional, CN only)
  242. ### Submissions
  243. - **run_code** - Runs code for a specific problem and waits until finished (requires authentication)
  244. - `titleSlug`: The URL slug/identifier of the problem (string, required)
  245. - `lang`: Programming language (string enum, required)
  246. - `typedCode`: Source code to run (string, required)
  247. - `dataInput`: Custom input to run (string, optional)
  248. - `timeoutMs`: Polling timeout in milliseconds (number, optional, default: 120000)
  249. - `pollIntervalMs`: Polling interval in milliseconds (number, optional, default: 1500)
  250. - **submit_solution** - Submits code for a specific problem and waits until finished (requires authentication)
  251. - `titleSlug`: The URL slug/identifier of the problem (string, required)
  252. - `lang`: Programming language (string enum, required)
  253. - `typedCode`: Source code to submit (string, required)
  254. - `timeoutMs`: Polling timeout in milliseconds (number, optional, default: 120000)
  255. - `pollIntervalMs`: Polling interval in milliseconds (number, optional, default: 1500)
  256. ### Notes
  257. - **search_notes** - Searches for user notes on LeetCode China
  258. - `keyword`: Search term to filter notes (string, optional)
  259. - `limit`: Maximum number of notes to return (number, optional, default: 10)
  260. - `skip`: Number of notes to skip (number, optional, default: 0)
  261. - `orderBy`: Sort order for returned notes (enum: "ASCENDING", "DESCENDING", optional, default: "DESCENDING")
  262. - **get_note** - Retrieves user notes for a specific LeetCode problem
  263. - `questionId`: The question ID of the LeetCode problem (string, required)
  264. - `limit`: Maximum number of notes to return (number, optional, default: 10)
  265. - `skip`: Number of notes to skip (number, optional, default: 0)
  266. - **create_note** - Creates a new note for a specific LeetCode problem
  267. - `questionId`: The question ID of the LeetCode problem (string, required)
  268. - `content`: The content of the note, supports markdown format (string, required)
  269. - `summary`: An optional short summary or title for the note (string, optional)
  270. - **update_note** - Updates an existing note with new content or summary
  271. - `noteId`: The ID of the note to update (string, required)
  272. - `content`: The new content for the note, supports markdown format (string, required)
  273. - `summary`: An optional new short summary or title for the note (string, optional)
  274. ### Problem Lists
  275. Problem lists are identified by their `favoriteSlug`, the path segment after `/problem-list/` in the list URL.
  276. - **list_problem_lists** - Lists the current user's problem lists
  277. - `includeCollected`: Also return lists saved from other creators (boolean, optional, default: false)
  278. - **get_problem_list** - Retrieves a problem list's metadata and a page of its questions
  279. - `favoriteSlug`: The slug of the problem list (string, required)
  280. - `limit`: Maximum number of questions to return (number, optional, default: 50)
  281. - `skip`: Number of questions to skip (number, optional, default: 0)
  282. - `searchKeyword`: Keyword to filter questions by title (string, optional)
  283. - `sortField`: Sort field: `CUSTOM` (the order shown on the website), `FRONTEND_ID`, `DIFFICULTY`, `AC_RATE`, `FREQUENCY` or `CONTEST_POINT` (string, optional, default: `CUSTOM`)
  284. - `sortOrder`: `ASCENDING` or `DESCENDING` (string, optional, default: `ASCENDING`)
  285. - **create_problem_list** - Creates a new problem list
  286. - `name`: Display name of the list (string, required)
  287. - `description`: Description of the list (string, optional, default: "")
  288. - `isPublic`: Whether the list is publicly visible (boolean, optional, default: false)
  289. - `questionSlugs`: Problem slugs to add right after creation (string[], optional)
  290. - `questionIds`: Problem numbers to add right after creation, e.g. `[1, 1143]`; numbers that cannot be resolved are returned in `unresolved` ((string | number)[], optional)
  291. - **update_problem_list** - Renames a problem list, changes its description or toggles its visibility (at least one optional field is required)
  292. - `favoriteSlug`: The slug of the problem list (string, required)
  293. - `name`: New display name (string, optional)
  294. - `description`: New description (string, optional)
  295. - `isPublic`: New visibility (boolean, optional)
  296. - **add_problems_to_list** - Adds problems to a problem list (at least one of `questionSlugs` / `questionIds` is required; problems are appended in the given order, slugs first)
  297. - `favoriteSlug`: The slug of the problem list (string, required)
  298. - `questionSlugs`: Problem slugs to add, e.g. `["two-sum"]` (string[], optional)
  299. - `questionIds`: Problem numbers to add, e.g. `[1, 1143]` or `["LCP 82"]`; numbers that cannot be resolved are returned in `unresolved` ((string | number)[], optional)
  300. - **remove_problems_from_list** - Removes problems from a problem list
  301. - `favoriteSlug`: The slug of the problem list (string, required)
  302. - `questionSlugs`: Problem slugs to remove (string[], required)
  303. - **reorder_problem_list** - Reorders the problems inside a problem list (exactly one of `sortField` / `questionSlugs` is required; one problem is moved per request)
  304. - `favoriteSlug`: The slug of the problem list (string, required)
  305. - `sortField`: Sort the whole list by `FRONTEND_ID`, `DIFFICULTY`, `AC_RATE`, `FREQUENCY` or `CONTEST_POINT` (string, optional)
  306. - `sortOrder`: `ASCENDING` or `DESCENDING` (string, optional, default: `ASCENDING`)
  307. - `questionSlugs`: Problem slugs to move to the top, in this order; the remaining problems keep their relative order (string[], optional)
  308. ### Solutions
  309. - **list_problem_solutions** - Retrieves a list of community solutions for a specific problem
  310. - `questionSlug`: The URL slug/identifier of the problem (string, required)
  311. - `limit`: Maximum number of solutions to return (number, optional, default: 10)
  312. - `skip`: Number of solutions to skip (number, optional)
  313. - `userInput`: Search term to filter solutions (string, optional)
  314. - `tagSlugs`: Array of tag identifiers to filter solutions (string[], optional, default: [])
  315. - `orderBy`: Sorting criteria for the returned solutions
  316. - Global: enum: "HOT", "MOST_RECENT", "MOST_VOTES", optional, default: "HOT"
  317. - CN: enum: "DEFAULT", "MOST_UPVOTE", "HOT", "NEWEST_TO_OLDEST", "OLDEST_TO_NEWEST", optional, default: "DEFAULT"
  318. - **get_problem_solution** - Retrieves the complete content of a specific solution
  319. - `topicId`: Unique topic ID of the solution (string, required, Global only)
  320. - `slug`: Unique slug/identifier of the solution (string, required, CN only)
  321. ## Available Resources
  322. | Resource Name | Global | CN | Auth Required | Description |
  323. | ---------------------- | :----: | :-: | :-----------: | ------------------------------------------------------------ |
  324. | **problem-categories** | ✅ | ✅ | ❌ | A list of all problem classification categories |
  325. | **problem-tags** | ✅ | ✅ | ❌ | A detailed collection of algorithmic and data structure tags |
  326. | **problem-langs** | ✅ | ✅ | ❌ | A complete list of all supported programming languages |
  327. | **problem-detail** | ✅ | ✅ | ❌ | Provides details about a specific problem |
  328. | **problem-solution** | ✅ | ✅ | ❌ | Provides the complete content of a specific solution |
  329. ## Resource URIs
  330. - **problem-categories** - A list of all problem classification categories
  331. - URI: `categories://problems/all`
  332. - **problem-tags** - A detailed collection of algorithmic and data structure tags
  333. - URI: `tags://problems/all`
  334. - **problem-langs** - A complete list of all programming languages supported by LeetCode
  335. - URI: `langs://problems/all`
  336. - **problem-detail** - Provides details about a specific LeetCode problem
  337. - URI: `problem://{titleSlug}`
  338. - Parameters:
  339. - `titleSlug`: Problem identifier as it appears in the LeetCode URL
  340. - **problem-solution** - Provides the complete content of a specific solution
  341. - Global URI: `solution://{topicId}`
  342. - Parameters:
  343. - `topicId`: Unique topic ID of the solution
  344. - CN URI: `solution://{slug}`
  345. - Parameters:
  346. - `slug`: Unique slug/identifier of the solution
  347. ## Authentication
  348. User-specific data access requires LeetCode session authentication:
  349. 1. Log in to LeetCode ([Global](https://leetcode.com) or [China](https://leetcode.cn) site)
  350. 2. Extract `LEETCODE_SESSION` cookie from browser developer tools
  351. 3. Configure server with `--session` flag or `LEETCODE_SESSION` environment variable
  352. ## Response Format
  353. All tools return JSON-formatted responses with the following structure:
  354. ```json
  355. {
  356. "content": [
  357. {
  358. "type": "text",
  359. "text": "JSON_DATA_STRING"
  360. }
  361. ]
  362. }
  363. ```
  364. The `JSON_DATA_STRING` contains either the requested data or an error message for failed requests.
  365. ## License
  366. This project is licensed under the MIT License.

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.